Class: Pageflow::Admin::EntryTabPolicy Private

Inherits:
Object
  • Object
show all
Defined in:
app/policies/pageflow/admin/entry_tab_policy.rb

Overview

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.

Since:

  • 12.2

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(user, tab) ⇒ EntryTabPolicy

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

Since:

  • 12.2



7
8
9
10
11
# File 'app/policies/pageflow/admin/entry_tab_policy.rb', line 7

def initialize(user, tab)
  @user = user
  @tab = tab
  @query = EntryRoleQuery.new(user, tab.resource)
end

Instance Attribute Details

#queryObject (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.

Since:

  • 12.2



5
6
7
# File 'app/policies/pageflow/admin/entry_tab_policy.rb', line 5

def query
  @query
end

#tabObject (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.

Since:

  • 12.2



5
6
7
# File 'app/policies/pageflow/admin/entry_tab_policy.rb', line 5

def tab
  @tab
end

#userObject (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.

Since:

  • 12.2



5
6
7
# File 'app/policies/pageflow/admin/entry_tab_policy.rb', line 5

def user
  @user
end

Instance Method Details

#see?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)

Since:

  • 12.2



13
14
15
16
17
18
19
20
21
22
23
# File 'app/policies/pageflow/admin/entry_tab_policy.rb', line 13

def see?
  if user.admin?
    true
  elsif tab.
    query.(tab.)
  elsif tab.required_role
    query.has_at_least_role?(tab.required_role)
  else
    !tab.admin_only?
  end
end