Fix authorization of adding/removing users from roles

Only organizers should be able to add/remove users from all roles.
Only organizers should be able to edit/update the description of roles of their conference.
Cfp/info_desk/voluters coordinators should be to able to add/remove users only to their own teams.
This commit is contained in:
Nishanth Vijayan 2016-04-03 20:26:00 +05:30
parent ab339fadb0
commit 03fcdecdf2
3 changed files with 25 additions and 46 deletions

View file

@ -2,11 +2,13 @@ module Admin
class RolesController < Admin::BaseController
load_and_authorize_resource :conference, find_by: :short_title
before_action :set_selection
authorize_resource :role, except: :index
# Show flash message with ajax calls
after_action :prepare_unobtrusive_flash, only: :toggle_user
def index
@roles = Role.where(resource: @conference)
authorize! :index, @role
end
def show