Allow track organizers to only add role track_organizer, and only for the track(s) they are organizing

This commit is contained in:
Stella Rouzi 2019-03-10 21:06:04 +02:00
parent 5a1f75e4f5
commit 5317b072c0

View file

@ -292,6 +292,8 @@ class AdminAbility
role.resource_type == 'Conference' || role.resource_type == 'Track'
end
cannot :toggle_user, Role
can :toggle_user, Role do |role|
role.resource_type == 'Track' && track_ids_for_track_organizer.include?(role.resource_id)
end