Class: Authz::RolesController Private

Inherits:
ApplicationController show all
Defined in:
app/controllers/authz/roles_controller.rb

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Instance Method Summary collapse

Methods included from Controllers::AuthorizationManager

#apply_authz_scopes, #authorize, #authorized?, #authorized_path?, #skip_authorization, #verify_authorized

Instance Method Details

#createObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



26
27
28
29
30
31
32
33
34
35
# File 'app/controllers/authz/roles_controller.rb', line 26

def create
  @role = Role.new(role_params)
  if @role.save
    flash[:success] = "#{@role.name} created successfully"
    redirect_to role_path(@role)
  else
    flash.now[:error] = "There was an issue creating this role"
    render 'new'
  end
end

#destroyObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



52
53
54
55
56
57
58
59
60
61
# File 'app/controllers/authz/roles_controller.rb', line 52

def destroy
  @role = Role.find(params[:id])
  if @role.destroy
    flash[:success] = "#{@role.name} destroyed successfully"
    redirect_to roles_path
  else
    flash.now[:error] = "There was an issue destroying #{@role.name}"
    render 'show'
  end
end

#editObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



37
38
39
# File 'app/controllers/authz/roles_controller.rb', line 37

def edit
  @role = Role.find(params[:id])
end

#indexObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



7
8
9
# File 'app/controllers/authz/roles_controller.rb', line 7

def index
  @roles = Role.all.page(params[:roles_page])
end

#newObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



22
23
24
# File 'app/controllers/authz/roles_controller.rb', line 22

def new
  @role = Role.new
end

#showObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



11
12
13
14
15
16
17
18
19
20
# File 'app/controllers/authz/roles_controller.rb', line 11

def show
  @role = Role.find(params[:id])
  @associated_controller_actions = @role.controller_actions.distinct.page(params[:controller_actions_page]).per(10)
  @associated_business_processes = @role.business_processes.distinct.page(params[:business_processes_page]).per(10)
  @scoping_rules = {}
  ::Authz::Scopables::Base.get_scopables_modules.each do |scoping_module|
    @scoping_rules[scoping_module.to_s] = ScopingRule.find_by(scopable: scoping_module.to_s,
                                                              role: @role)
  end
end

#updateObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



41
42
43
44
45
46
47
48
49
50
# File 'app/controllers/authz/roles_controller.rb', line 41

def update
  @role = Role.find(params[:id])
  if @role.update(role_params)
    flash[:success] = "#{@role.name} updated successfully"
    redirect_to role_path(@role)
  else
    flash.now[:error] = "There was an issue updating this role"
    render 'edit'
  end
end