Module: AccessGranted::Rails::ControllerMethods
- Defined in:
- lib/access-granted/rails/controller_methods.rb
Class Method Summary collapse
Instance Method Summary collapse
- #authorize!(*args) ⇒ Object
- #can?(*args) ⇒ Boolean
- #cannot?(*args) ⇒ Boolean
- #current_policy ⇒ Object
Class Method Details
.included(base) ⇒ Object
8 9 10 |
# File 'lib/access-granted/rails/controller_methods.rb', line 8 def self.included(base) base.helper_method :can?, :cannot?, :current_policy if base.respond_to? :helper_method end |
Instance Method Details
#authorize!(*args) ⇒ Object
20 21 22 |
# File 'lib/access-granted/rails/controller_methods.rb', line 20 def (*args) current_policy.(*args) end |
#can?(*args) ⇒ Boolean
12 13 14 |
# File 'lib/access-granted/rails/controller_methods.rb', line 12 def can?(*args) current_policy.can?(*args) end |
#cannot?(*args) ⇒ Boolean
16 17 18 |
# File 'lib/access-granted/rails/controller_methods.rb', line 16 def cannot?(*args) current_policy.cannot?(*args) end |
#current_policy ⇒ Object
4 5 6 |
# File 'lib/access-granted/rails/controller_methods.rb', line 4 def current_policy @current_policy ||= ::AccessPolicy.new(current_user) end |