Sha256: b5d4b6b0a76e04cdaf824309c6bdd975f6452aecb49a3f8248ec2f8379f43234

Contents?: true

Size: 1.13 KB

Versions: 18

Compression:

Stored size: 1.13 KB

Contents

require_dependency "adeia/application_controller"

module Adeia
  class PermissionsController < ApplicationController
    load_and_authorize

    def index
      @table = PermissionTable.new(self, @permissions, search: true)
      @table.respond
    end

    def new
      @permission = Permission.new
    end

    def create
      @permission = Permission.new(permission_params)
      if @permission.save
        redirect_to permissions_path, success: t("adeia.permissions.create.success")
      else
        render 'new'
      end
    end

    def edit
    end

    def update
      if @permission.update_attributes(permission_params)
        redirect_to permissions_path, success: t("adeia.permissions.update.success")
      else
        render 'edit'
      end
    end

    def destroy
      @permission.destroy
      redirect_to permissions_path, success: t("adeia.permissions.destroy.success")
    end

    private

    def permission_params
      params.require(:permission).permit(:permission_type, :adeia_element_id, :global_owner, :read_right, :create_right, :update_right, :destroy_right, :resource_id, actions_attributes: [:name])
    end

  end
end

Version data entries

18 entries across 18 versions & 1 rubygems

Version Path
adeia-0.15.1 app/controllers/adeia/permissions_controller.rb
adeia-0.15.0 app/controllers/adeia/permissions_controller.rb
adeia-0.14.0 app/controllers/adeia/permissions_controller.rb
adeia-0.13.1 app/controllers/adeia/permissions_controller.rb
adeia-0.13.0 app/controllers/adeia/permissions_controller.rb
adeia-0.12.0 app/controllers/adeia/permissions_controller.rb
adeia-0.11.11 app/controllers/adeia/permissions_controller.rb
adeia-0.11.10 app/controllers/adeia/permissions_controller.rb
adeia-0.11.9 app/controllers/adeia/permissions_controller.rb
adeia-0.11.8 app/controllers/adeia/permissions_controller.rb
adeia-0.11.7 app/controllers/adeia/permissions_controller.rb
adeia-0.11.6 app/controllers/adeia/permissions_controller.rb
adeia-0.11.5 app/controllers/adeia/permissions_controller.rb
adeia-0.11.4 app/controllers/adeia/permissions_controller.rb
adeia-0.11.3 app/controllers/adeia/permissions_controller.rb
adeia-0.11.2 app/controllers/adeia/permissions_controller.rb
adeia-0.11.0 app/controllers/adeia/permissions_controller.rb
adeia-0.10.5 app/controllers/adeia/permissions_controller.rb