Class: Pageflow::Admin::AdminOnlyTabPolicy

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

Overview

Since:

  • 12.2

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(user, tab) ⇒ AdminOnlyTabPolicy

Returns a new instance of AdminOnlyTabPolicy.

Since:

  • 12.2



6
7
8
9
# File 'app/policies/pageflow/admin/admin_only_tab_policy.rb', line 6

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

Instance Attribute Details

#tabObject (readonly)

Since:

  • 12.2



4
5
6
# File 'app/policies/pageflow/admin/admin_only_tab_policy.rb', line 4

def tab
  @tab
end

#userObject (readonly)

Since:

  • 12.2



4
5
6
# File 'app/policies/pageflow/admin/admin_only_tab_policy.rb', line 4

def user
  @user
end

Instance Method Details

#see?Boolean

Returns:

  • (Boolean)

Since:

  • 12.2



11
12
13
# File 'app/policies/pageflow/admin/admin_only_tab_policy.rb', line 11

def see?
  !tab.admin_only? || user.admin?
end