Class: Pageflow::FolderPolicy::Scope Private
- Inherits:
-
Scope
- Object
- Scope
- Pageflow::FolderPolicy::Scope
- Defined in:
- app/policies/pageflow/folder_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/folder_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/folder_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/folder_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 |
# File 'app/policies/pageflow/folder_policy.rb', line 13 def resolve if user.admin? scope.all else scope.where('account_id IN (?) OR id IN (?)', accounts_where_user_is_at_least_previewer(user).map(&:id), user.entries.map(&:folder_id)) end end |