Class: Pageflow::AccountPolicy::Scope
- Inherits:
-
Scope
- Object
- Scope
- Pageflow::AccountPolicy::Scope
- Defined in:
- app/policies/pageflow/account_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
- #entry_creatable ⇒ Object
- #entry_movable ⇒ Object
- #folder_addable ⇒ Object
-
#initialize(user, scope) ⇒ Scope
constructor
A new instance of Scope.
- #member_addable ⇒ Object
- #resolve ⇒ Object
- #sites_accessible ⇒ Object
Constructor Details
Instance Attribute Details
#query ⇒ Object (readonly)
Returns the value of attribute query.
4 5 6 |
# File 'app/policies/pageflow/account_policy.rb', line 4 def query @query end |
#scope ⇒ Object (readonly)
Returns the value of attribute scope.
4 5 6 |
# File 'app/policies/pageflow/account_policy.rb', line 4 def scope @scope end |
#user ⇒ Object (readonly)
Returns the value of attribute user.
4 5 6 |
# File 'app/policies/pageflow/account_policy.rb', line 4 def user @user end |
Instance Method Details
#entry_creatable ⇒ Object
20 21 22 23 24 25 26 |
# File 'app/policies/pageflow/account_policy.rb', line 20 def entry_creatable if user.admin? scope.all else query.with_role_at_least(:publisher) end end |
#entry_movable ⇒ Object
28 29 30 |
# File 'app/policies/pageflow/account_policy.rb', line 28 def entry_movable entry_creatable end |
#folder_addable ⇒ Object
36 37 38 |
# File 'app/policies/pageflow/account_policy.rb', line 36 def folder_addable entry_creatable end |
#member_addable ⇒ Object
40 41 42 43 44 45 46 |
# File 'app/policies/pageflow/account_policy.rb', line 40 def member_addable if user.admin? scope.all else query.with_role_at_least(:manager) end end |
#resolve ⇒ Object
12 13 14 15 16 17 18 |
# File 'app/policies/pageflow/account_policy.rb', line 12 def resolve if user.admin? scope.all else query.with_role_at_least(:member) end end |
#sites_accessible ⇒ Object
32 33 34 |
# File 'app/policies/pageflow/account_policy.rb', line 32 def sites_accessible entry_creatable end |