Class: Pageflow::FolderPolicy Private

Inherits:
ApplicationPolicy show all
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.

Defined Under Namespace

Classes: Scope

Instance Method Summary collapse

Constructor Details

#initialize(user, folder) ⇒ FolderPolicy

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 FolderPolicy.



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

def initialize(user, folder)
  @user = user
  @folder = folder
end

Instance Method Details

#manage?Boolean

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:

  • (Boolean)


49
50
51
# File 'app/policies/pageflow/folder_policy.rb', line 49

def manage?
  allows?(%w[publisher manager])
end

#show_account_selection_on?Boolean

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:

  • (Boolean)


53
54
55
56
# File 'app/policies/pageflow/folder_policy.rb', line 53

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