Sha256: 8d5ab474886c8cca42d7b2a9beee34f9eb8b0a3ad9ea1414f940dee34c6b3bd7
Contents?: true
Size: 924 Bytes
Versions: 17
Compression:
Stored size: 924 Bytes
Contents
require 'inline_svg' require 'effective_bootstrap/engine' require 'effective_bootstrap/version' module EffectiveBootstrap # The following are all valid config keys mattr_accessor :authorization_method def self.setup yield self end def self.authorized?(controller, action, resource) @_exceptions ||= [Effective::AccessDenied, (CanCan::AccessDenied if defined?(CanCan)), (Pundit::NotAuthorizedError if defined?(Pundit))].compact return !!authorization_method unless authorization_method.respond_to?(:call) controller = controller.controller if controller.respond_to?(:controller) begin !!(controller || self).instance_exec((controller || self), action, resource, &authorization_method) rescue *@_exceptions false end end def self.authorize!(controller, action, resource) raise Effective::AccessDenied unless authorized?(controller, action, resource) end end
Version data entries
17 entries across 17 versions & 1 rubygems