suggested changes
change description of organization_admin remove assign_role callback
This commit is contained in:
parent
8839a928ed
commit
7d408ee33c
3 changed files with 2 additions and 7 deletions
|
|
@ -1,7 +1,6 @@
|
||||||
module Admin
|
module Admin
|
||||||
class OrganizationsController < Admin::BaseController
|
class OrganizationsController < Admin::BaseController
|
||||||
load_and_authorize_resource :organization
|
load_and_authorize_resource :organization
|
||||||
after_action :assign_role, only: :create
|
|
||||||
|
|
||||||
def index
|
def index
|
||||||
@organizations = Organization.all
|
@organizations = Organization.all
|
||||||
|
|
@ -46,10 +45,6 @@ module Admin
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
def assign_role
|
|
||||||
current_user.add_role :organization_admin, @organization
|
|
||||||
end
|
|
||||||
|
|
||||||
def organization_params
|
def organization_params
|
||||||
params.require(:organization).permit(:name, :description, :picture)
|
params.require(:organization).permit(:name, :description, :picture)
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -12,6 +12,6 @@ class Organization < ActiveRecord::Base
|
||||||
private
|
private
|
||||||
|
|
||||||
def create_roles
|
def create_roles
|
||||||
Role.where(name: 'organization_admin', resource: self).first_or_create(description: "For the administrators of an organization (who shall have full access to the organization and it's conferences)")
|
roles.where(name: 'organization_admin').first_or_create(description: 'For the administrators of an organization and its conferences')
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@ namespace :roles do
|
||||||
task add: :environment do
|
task add: :environment do
|
||||||
|
|
||||||
Organization.all.each do |org|
|
Organization.all.each do |org|
|
||||||
Role.where(name: 'organization_admin', resource: org).first_or_create(description: "For the administrators of an organization (who shall have full access to the organization and it's conferences)")
|
Role.where(name: 'organization_admin', resource: org).first_or_create(description: 'For the administrators of an organization and its conferences')
|
||||||
end
|
end
|
||||||
|
|
||||||
Conference.all.each do |c|
|
Conference.all.each do |c|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue