Class: Doorkeeper::ApplicationPolicy::Scope
- Inherits:
-
Object
- Object
- Doorkeeper::ApplicationPolicy::Scope
- Defined in:
- app/policies/doorkeeper/application_policy.rb
Instance Attribute Summary collapse
-
#scope ⇒ Object
readonly
Returns the value of attribute scope.
-
#user ⇒ Object
readonly
Returns the value of attribute user.
Instance Method Summary collapse
-
#initialize(user, scope) ⇒ Scope
constructor
A new instance of Scope.
- #resolve ⇒ Object
Constructor Details
#initialize(user, scope) ⇒ Scope
Returns a new instance of Scope.
42 43 44 45 |
# File 'app/policies/doorkeeper/application_policy.rb', line 42 def initialize(user, scope) @user = user @scope = scope end |
Instance Attribute Details
#scope ⇒ Object (readonly)
Returns the value of attribute scope.
40 41 42 |
# File 'app/policies/doorkeeper/application_policy.rb', line 40 def scope @scope end |
#user ⇒ Object (readonly)
Returns the value of attribute user.
40 41 42 |
# File 'app/policies/doorkeeper/application_policy.rb', line 40 def user @user end |
Instance Method Details
#resolve ⇒ Object
47 48 49 |
# File 'app/policies/doorkeeper/application_policy.rb', line 47 def resolve user&.is_moderator? ? scope : scope.where(owner: user) end |