Sha256: 0507cf57e127cc354664f624085508f3aba3398c5f10aeab322f0f24659a591e

Contents?: true

Size: 483 Bytes

Versions: 4

Compression:

Stored size: 483 Bytes

Contents

module Ddr
  module Auth
    module RoleBasedAccessControlsEnforcement

      def self.included(controller)
        controller.delegate :authorized_to_act_as_superuser?, to: :current_ability
        controller.helper_method :authorized_to_act_as_superuser?
      end

      def current_ability
        @current_ability ||= AbilityFactory.call(current_user, request.env)
      end

      def enforce_show_permissions
        authorize! :read, params[:id]
      end

    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
ddr-core-1.1.2 lib/ddr/auth/role_based_access_controls_enforcement.rb
ddr-core-1.1.1 lib/ddr/auth/role_based_access_controls_enforcement.rb
ddr-core-1.1.0 lib/ddr/auth/role_based_access_controls_enforcement.rb
ddr-core-1.0.0 lib/ddr/auth/role_based_access_controls_enforcement.rb