mirror of
https://github.com/openSUSE/osem.git
synced 2026-08-13 19:54:02 +00:00
Introduce organization admins
This commit is contained in:
parent
f37d3095e1
commit
b72e64b238
6 changed files with 96 additions and 41 deletions
|
|
@ -8,7 +8,7 @@ module Admin
|
|||
return false
|
||||
end
|
||||
unless (current_user.has_role? :organizer, :any) || (current_user.has_role? :cfp, :any) ||
|
||||
(current_user.has_role? :info_desk, :any) ||
|
||||
(current_user.has_role? :info_desk, :any) || (current_user.has_role? :organization_admin, :any) ||
|
||||
(current_user.has_role? :volunteers_coordinator, :any) || current_user.is_admin
|
||||
raise CanCan::AccessDenied.new('You are not authorized to access this area!')
|
||||
end
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
module Admin
|
||||
class OrganizationsController < Admin::BaseController
|
||||
load_and_authorize_resource :organization
|
||||
after_action :assign_role, only: :create
|
||||
|
||||
def index
|
||||
@organizations = Organization.all
|
||||
|
|
@ -45,6 +46,10 @@ module Admin
|
|||
|
||||
private
|
||||
|
||||
def assign_role
|
||||
current_user.add_role :organization_admin, @organization
|
||||
end
|
||||
|
||||
def organization_params
|
||||
params.require(:organization).permit(:name, :description, :picture)
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue