Class: GenericAuth::Guard
- Inherits:
-
Object
- Object
- GenericAuth::Guard
- Defined in:
- lib/generic_auth/guard.rb
Class Method Summary collapse
Class Method Details
.authorize(activity, object, *args) ⇒ Object
3 4 5 6 7 8 9 10 11 12 |
# File 'lib/generic_auth/guard.rb', line 3 def self. activity, object, *args permitted = false Engine.instance.user.roles.each do |role| if Engine.instance.permitted? role, activity, object, *args permitted = true break end end raise GenericAuth::AuthError, "User not authorized for activity #{activity}" unless permitted end |