Allow the track organizer to manage events

He/She can manage the events of his/her tracks and their commercials
This commit is contained in:
AEtherC0r3 2017-08-09 14:53:27 +03:00 committed by Stella Rouzi
parent a87c6e55f7
commit af7efdb6fe
4 changed files with 34 additions and 9 deletions

View file

@ -298,5 +298,14 @@ class AdminAbility
can :toggle_user, Role do |role|
role.resource_type == 'Track' && track_ids_for_track_organizer.include?(role.resource_id)
end
# Show Events in the admin sidebar
can :update, Event do |event|
event.new_record? && conf_ids_for_track_organizer.include?(event.program.conference_id)
end
can :manage, Event, track_id: track_ids_for_track_organizer
can :manage, Commercial, commercialable_type: 'Event',
commercialable_id: Event.where(track_id: track_ids_for_track_organizer).pluck(:id)
end
end