Class: Pageflow::UserPolicy::Scope Private
- Inherits:
-
Scope
- Object
- Scope
- Pageflow::UserPolicy::Scope
- Defined in:
- app/policies/pageflow/user_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
- #scope ⇒ Object readonly private
- #user ⇒ Object readonly private
Instance Method Summary collapse
-
#initialize(user, scope) ⇒ Scope
constructor
private
A new instance of Scope.
- #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 |
# File 'app/policies/pageflow/user_policy.rb', line 8 def initialize(user, scope) @user = user @scope = scope end |
Instance Attribute Details
#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/user_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/user_policy.rb', line 6 def user @user end |
Instance Method Details
#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.
13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'app/policies/pageflow/user_policy.rb', line 13 def resolve if user.admin? scope.all else manager_accounts_ids = AccountPolicy::Scope .new(@user, Account).member_addable.map(&:id) scope.joins(:memberships) .where('pageflow_memberships.entity_type = \'Pageflow::Account\'') .where(membership_in_managed_account(manager_accounts_ids)).distinct end end |