Class: Pageflow::SitePolicy Private
- Inherits:
-
ApplicationPolicy
- Object
- ApplicationPolicy
- Pageflow::SitePolicy
- Defined in:
- app/policies/pageflow/site_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 Attribute Summary collapse
- #user ⇒ Object readonly private
Instance Method Summary collapse
-
#initialize(user, site) ⇒ SitePolicy
constructor
private
A new instance of SitePolicy.
- #manage_root_entry? ⇒ Boolean private
- #read? ⇒ Boolean private
- #update? ⇒ Boolean private
Constructor Details
#initialize(user, site) ⇒ SitePolicy
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 SitePolicy.
42 43 44 45 |
# File 'app/policies/pageflow/site_policy.rb', line 42 def initialize(user, site) @user = user @account_role_query = AccountRoleQuery.new(user, site.account) end |
Instance Attribute Details
#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.
40 41 42 |
# File 'app/policies/pageflow/site_policy.rb', line 40 def user @user end |
Instance Method Details
#manage_root_entry? ⇒ 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.
57 58 59 60 |
# File 'app/policies/pageflow/site_policy.rb', line 57 def manage_root_entry? @user.admin? || @account_role_query.has_at_least_role?(:manager) end |
#read? ⇒ 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.
47 48 49 50 51 |
# File 'app/policies/pageflow/site_policy.rb', line 47 def read? @user.admin? || (@account_role_query.has_at_least_role?(:manager) && Pageflow.config.allow_multiaccount_users) end |
#update? ⇒ 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.
53 54 55 |
# File 'app/policies/pageflow/site_policy.rb', line 53 def update? read? end |