Class: Pageflow::FolderPolicy

Inherits:
ApplicationPolicy show all
Defined in:
app/policies/pageflow/folder_policy.rb

Defined Under Namespace

Classes: Scope

Instance Method Summary collapse

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

Returns:

  • (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

Returns:

  • (Boolean)


43
44
45
46
# File 'app/policies/pageflow/folder_policy.rb', line 43

def 
  (@user.admin? && Account.all.size > 1) ||
    @user.memberships.as_publisher_or_above.on_accounts.size > 1
end