Class: Pageflow::Admin::EntryTabPolicy Private
- Inherits:
-
Object
- Object
- Pageflow::Admin::EntryTabPolicy
- 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.
Instance Attribute Summary collapse
- #query ⇒ Object readonly private
- #tab ⇒ Object readonly private
- #user ⇒ Object readonly private
Instance Method Summary collapse
-
#initialize(user, tab) ⇒ EntryTabPolicy
constructor
private
A new instance of EntryTabPolicy.
- #see? ⇒ Boolean private
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.
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
#query ⇒ Object (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.
5 6 7 |
# File 'app/policies/pageflow/admin/entry_tab_policy.rb', line 5 def query @query end |
#tab ⇒ Object (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.
5 6 7 |
# File 'app/policies/pageflow/admin/entry_tab_policy.rb', line 5 def tab @tab end |
#user ⇒ Object (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.
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.
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.required_account_role query.has_at_least_account_role?(tab.required_account_role) elsif tab.required_role query.has_at_least_role?(tab.required_role) else !tab.admin_only? end end |