Sha256: a50c71919360d469f719e70db23ecce69c50400e96c0a56af95706dd863d384f
Contents?: true
Size: 963 Bytes
Versions: 60
Compression:
Stored size: 963 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.new('Access Denied', action, resource) unless authorized?(controller, action, resource) end end
Version data entries
60 entries across 60 versions & 1 rubygems