Class: Kaui::RoleDefinitionsController

Inherits:
EngineController show all
Defined in:
app/controllers/kaui/role_definitions_controller.rb

Constant Summary

Constants included from EngineControllerUtil

EngineControllerUtil::SIMPLE_PAGINATION_THRESHOLD

Instance Method Summary collapse

Methods inherited from EngineController

#check_for_redirect_to_tenant_screen, #current_ability, #current_user, #options_for_klient, #populate_account_details, #retrieve_allowed_users_for_current_user, #retrieve_tenants_for_current_user

Instance Method Details

#createObject



7
8
9
10
11
12
13
14
15
16
17
18
19
# File 'app/controllers/kaui/role_definitions_controller.rb', line 7

def create
  # Sanity is done on the server side
  @role_definition = Kaui::RoleDefinition.new(params.require(:role_definition))
  @role_definition.permissions = @role_definition.permissions.split(',')

  begin
    @role_definition = @role_definition.create(current_user.kb_username, params[:reason], params[:comment], options_for_klient)
    redirect_to admin_allowed_users_path, :notice => 'Role was successfully created'
  rescue => e
    flash.now[:error] = "Error while creating role: #{as_string(e)}"
    render :action => :new
  end
end

#newObject



3
4
5
# File 'app/controllers/kaui/role_definitions_controller.rb', line 3

def new
  @role_definition = Kaui::RoleDefinition.new
end