Class: Itsf::Backend::EnginePolicy
- Inherits:
-
Struct
- Object
- Struct
- Itsf::Backend::EnginePolicy
- Defined in:
- app/policies/itsf/backend/engine_policy.rb
Instance Attribute Summary collapse
-
#engine ⇒ Object
Returns the value of attribute engine.
-
#user ⇒ Object
Returns the value of attribute user.
Instance Method Summary collapse
Instance Attribute Details
#engine ⇒ Object
Returns the value of attribute engine
2 3 4 |
# File 'app/policies/itsf/backend/engine_policy.rb', line 2 def engine @engine end |
#user ⇒ Object
Returns the value of attribute user
2 3 4 |
# File 'app/policies/itsf/backend/engine_policy.rb', line 2 def user @user end |
Instance Method Details
#access? ⇒ Boolean
3 4 5 6 7 8 9 10 11 12 13 |
# File 'app/policies/itsf/backend/engine_policy.rb', line 3 def access? = self.class.name.gsub('Policy', '').underscore allowed = user.respond_to?(:allowed_to?) ? user.allowed_to?() : false if allowed Rails.logger.debug "User #{user.try_all(*Itsf::Backend.resource_title_methods)} is allowed to access #{}" else Rails.logger.debug "User #{user.try_all(*Itsf::Backend.resource_title_methods)} is not allowed to access #{}" end allowed end |