Class: Pageflow::FolderPolicy
- Inherits:
-
ApplicationPolicy
- Object
- ApplicationPolicy
- Pageflow::FolderPolicy
- Defined in:
- app/policies/pageflow/folder_policy.rb
Defined Under Namespace
Classes: Scope
Instance Method Summary collapse
-
#initialize(user, folder) ⇒ FolderPolicy
constructor
A new instance of FolderPolicy.
- #manage? ⇒ Boolean
- #show_account_selection_on? ⇒ Boolean
Constructor Details
#initialize(user, folder) ⇒ FolderPolicy
Returns a new instance of FolderPolicy.
34 35 36 37 |
# File 'app/policies/pageflow/folder_policy.rb', line 34 def initialize(user, folder) @user = user @folder = folder end |
Instance Method Details
#manage? ⇒ Boolean
39 40 41 |
# File 'app/policies/pageflow/folder_policy.rb', line 39 def manage? allows?(%w(publisher manager)) end |
#show_account_selection_on? ⇒ Boolean
43 44 45 46 |
# File 'app/policies/pageflow/folder_policy.rb', line 43 def show_account_selection_on? (@user.admin? && Account.all.size > 1) || @user.memberships.as_publisher_or_above.on_accounts.size > 1 end |