Skip to content

Commit

Permalink
handle missing consortium_id #433
Browse files Browse the repository at this point in the history
  • Loading branch information
Martin Fenner committed Feb 24, 2020
1 parent 1c6a4d5 commit a9a7fb9
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions app/models/ability.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,10 @@ def initialize(user)
end
can [:read], Provider
can [:manage], ProviderPrefix do |provider_prefix|
provider_prefix.provider.consortium_id == user.consortium_id.upcase
provider_prefix.provider && provider_prefix.provider.consortium_id == user.consortium_id.upcase
end
can [:manage], Client do |client|
client.provider.consortium_id == user.consortium_id.upcase
client.provider && client.provider.consortium_id == user.consortium_id.upcase
end
can [:manage], ClientPrefix #, :client_id => user.provider_id

Expand All @@ -46,7 +46,7 @@ def initialize(user)
can [:read], User
can [:read], Phrase
can [:read], Activity do |activity|
activity.doi.findable? || activity.doi.provider.consortium_id == user.consortium_id.upcase
activity.doi.findable? || activity.doi.provider && activity.doi.provider.consortium_id == user.consortium_id.upcase
end
elsif user.role_id == "provider_admin" && user.provider_id.present?
can [:update, :read, :read_billing_information], Provider, symbol: user.provider_id.upcase
Expand Down

0 comments on commit a9a7fb9

Please sign in to comment.