Class: Pageflow::EntryPolicy::Scope
- Inherits:
-
Scope
- Object
- Scope
- Pageflow::EntryPolicy::Scope
- Defined in:
- app/policies/pageflow/entry_policy.rb
Instance Attribute Summary collapse
-
#query ⇒ Object
readonly
Returns the value of attribute query.
-
#scope ⇒ Object
readonly
Returns the value of attribute scope.
-
#user ⇒ Object
readonly
Returns the value of attribute user.
Instance Method Summary collapse
- #editor_or_above ⇒ Object
-
#initialize(user, scope) ⇒ Scope
constructor
A new instance of Scope.
- #manager_or_above ⇒ Object
- #member_addable ⇒ Object
- #publisher_or_above ⇒ Object
- #resolve ⇒ Object
Constructor Details
Instance Attribute Details
#query ⇒ Object (readonly)
Returns the value of attribute query.
4 5 6 |
# File 'app/policies/pageflow/entry_policy.rb', line 4 def query @query end |
#scope ⇒ Object (readonly)
Returns the value of attribute scope.
4 5 6 |
# File 'app/policies/pageflow/entry_policy.rb', line 4 def scope @scope end |
#user ⇒ Object (readonly)
Returns the value of attribute user.
4 5 6 |
# File 'app/policies/pageflow/entry_policy.rb', line 4 def user @user end |
Instance Method Details
#editor_or_above ⇒ Object
20 21 22 |
# File 'app/policies/pageflow/entry_policy.rb', line 20 def editor_or_above query.with_role_at_least(:editor) end |
#manager_or_above ⇒ Object
32 33 34 |
# File 'app/policies/pageflow/entry_policy.rb', line 32 def manager_or_above query.with_role_at_least(:manager) end |
#member_addable ⇒ Object
28 29 30 |
# File 'app/policies/pageflow/entry_policy.rb', line 28 def member_addable publisher_or_above end |
#publisher_or_above ⇒ Object
24 25 26 |
# File 'app/policies/pageflow/entry_policy.rb', line 24 def publisher_or_above query.with_role_at_least(:publisher) end |
#resolve ⇒ Object
12 13 14 15 16 17 18 |
# File 'app/policies/pageflow/entry_policy.rb', line 12 def resolve if user.admin? scope.all else query.with_role_at_least(:previewer) end end |