Skip to content

Commit

Permalink
tweak abilities. #432
Browse files Browse the repository at this point in the history
  • Loading branch information
Martin Fenner committed Feb 27, 2020
1 parent 670b007 commit 6aa13d7
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions app/models/ability.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,12 @@ def initialize(user)
elsif user.role_id == "staff_user"
can :read, :all
elsif user.role_id == "consortium_admin" && user.provider_id.present?
can [:update, :read, :read_billing_information], Provider, symbol: user.provider_id.upcase
can [:manage], Provider do |provider|
can [:new, :create, :delete], Provider do |provider|
user.provider_id.casecmp(provider.consortium_id)
end
can [:update, :read, :read_billing_information], Provider do |provider|
user.provider_id.casecmp(provider.id) || user.provider_id.casecmp(provider.consortium_id)
end
can [:read], Provider
can [:manage], ProviderPrefix do |provider_prefix|
provider_prefix.provider && user.provider_id.casecmp(provider_prefix.provider.consortium_id)
Expand Down

0 comments on commit 6aa13d7

Please sign in to comment.