Module: EffectiveDatatables
- Defined in:
- lib/effective_datatables.rb,
lib/effective_datatables/engine.rb,
lib/effective_datatables/version.rb,
lib/generators/effective_datatables/install_generator.rb
Defined Under Namespace
Modules: Generators
Classes: Engine
Constant Summary
collapse
- VERSION =
'4.0.1'.freeze
Class Method Summary
collapse
Class Method Details
.authorize!(controller, action, resource) ⇒ Object
32
33
34
|
# File 'lib/effective_datatables.rb', line 32
def self.authorize!(controller, action, resource)
raise Effective::AccessDenied unless authorized?(controller, action, resource)
end
|
.authorized?(controller, action, resource) ⇒ Boolean
19
20
21
22
23
24
25
26
27
28
29
30
|
# File 'lib/effective_datatables.rb', line 19
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
|
.setup {|_self| ... } ⇒ Object
15
16
17
|
# File 'lib/effective_datatables.rb', line 15
def self.setup
yield self
end
|