Sha256: b5793745befecb677eda1e4750fa880ce024e9ac8f4288137f474c1d718fcae5

Contents?: true

Size: 783 Bytes

Versions: 4

Compression:

Stored size: 783 Bytes

Contents

# frozen_string_literal: true

module Kaui
  class RoleDefinitionsController < Kaui::EngineController
    def new
      @role_definition = Kaui::RoleDefinition.new
    end

    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 StandardError => e
        flash.now[:error] = "Error while creating role: #{as_string(e)}"
        render action: :new
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
kaui-3.0.4 app/controllers/kaui/role_definitions_controller.rb
kaui-3.0.2 app/controllers/kaui/role_definitions_controller.rb
kaui-2.2.1 app/controllers/kaui/role_definitions_controller.rb
kaui-3.0.1 app/controllers/kaui/role_definitions_controller.rb