Class: Pageflow::EntryPolicy::Scope Private
- Inherits:
-
Scope
- Object
- Scope
- Pageflow::EntryPolicy::Scope
- Defined in:
- app/policies/pageflow/entry_policy.rb
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Instance Attribute Summary collapse
- #query ⇒ Object readonly private
- #scope ⇒ Object readonly private
- #user ⇒ Object readonly private
Instance Method Summary collapse
- #editor_or_above ⇒ Object private
-
#initialize(user, scope) ⇒ Scope
constructor
private
A new instance of Scope.
- #manager_or_above ⇒ Object private
- #member_addable ⇒ Object private
- #publisher_or_above ⇒ Object private
- #resolve ⇒ Object private
Constructor Details
#initialize(user, scope) ⇒ Scope
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a new instance of Scope.
8 9 10 11 12 |
# File 'app/policies/pageflow/entry_policy.rb', line 8 def initialize(user, scope) @user = user @scope = scope @query = EntryRoleQuery::Scope.new(user, scope) end |
Instance Attribute Details
#query ⇒ Object (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
6 7 8 |
# File 'app/policies/pageflow/entry_policy.rb', line 6 def query @query end |
#scope ⇒ Object (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
6 7 8 |
# File 'app/policies/pageflow/entry_policy.rb', line 6 def scope @scope end |
#user ⇒ Object (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
6 7 8 |
# File 'app/policies/pageflow/entry_policy.rb', line 6 def user @user end |
Instance Method Details
#editor_or_above ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
22 23 24 |
# File 'app/policies/pageflow/entry_policy.rb', line 22 def editor_or_above query.with_role_at_least(:editor) end |
#manager_or_above ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
34 35 36 |
# File 'app/policies/pageflow/entry_policy.rb', line 34 def manager_or_above query.with_role_at_least(:manager) end |
#member_addable ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
30 31 32 |
# File 'app/policies/pageflow/entry_policy.rb', line 30 def member_addable publisher_or_above end |
#publisher_or_above ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
26 27 28 |
# File 'app/policies/pageflow/entry_policy.rb', line 26 def publisher_or_above query.with_role_at_least(:publisher) end |
#resolve ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
14 15 16 17 18 19 20 |
# File 'app/policies/pageflow/entry_policy.rb', line 14 def resolve if user.admin? scope.all else query.with_role_at_least(:previewer) end end |