Class: Pageflow::AccountPolicy::Scope Private
- Inherits:
-
Scope
- Object
- Scope
- Pageflow::AccountPolicy::Scope
- Defined in:
- app/policies/pageflow/account_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
- #entry_creatable ⇒ Object private
- #entry_movable ⇒ Object private
- #folder_addable ⇒ Object private
-
#initialize(user, scope) ⇒ Scope
constructor
private
A new instance of Scope.
- #member_addable ⇒ Object private
- #resolve ⇒ Object private
- #sites_accessible ⇒ 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/account_policy.rb', line 8 def initialize(user, scope) @user = user @scope = scope @query = AccountRoleQuery::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/account_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/account_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/account_policy.rb', line 6 def user @user end |
Instance Method Details
#entry_creatable ⇒ 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 25 26 27 28 |
# File 'app/policies/pageflow/account_policy.rb', line 22 def entry_creatable if user.admin? scope.all else query.with_role_at_least(:publisher) end end |
#entry_movable ⇒ 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/account_policy.rb', line 30 def entry_movable entry_creatable end |
#folder_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.
38 39 40 |
# File 'app/policies/pageflow/account_policy.rb', line 38 def folder_addable entry_creatable 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.
42 43 44 45 46 47 48 |
# File 'app/policies/pageflow/account_policy.rb', line 42 def member_addable if user.admin? scope.all else query.with_role_at_least(:manager) end 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/account_policy.rb', line 14 def resolve if user.admin? scope.all else query.with_role_at_least(:member) end end |
#sites_accessible ⇒ 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/account_policy.rb', line 34 def sites_accessible entry_creatable end |