Class: Pageflow::SitePolicy
- Inherits:
-
ApplicationPolicy
- Object
- ApplicationPolicy
- Pageflow::SitePolicy
- Defined in:
- app/policies/pageflow/site_policy.rb
Defined Under Namespace
Classes: Scope
Instance Attribute Summary collapse
-
#user ⇒ Object
readonly
Returns the value of attribute user.
Instance Method Summary collapse
-
#initialize(user, site) ⇒ SitePolicy
constructor
A new instance of SitePolicy.
- #read? ⇒ Boolean
- #update? ⇒ Boolean
Constructor Details
#initialize(user, site) ⇒ SitePolicy
Returns a new instance of SitePolicy.
40 41 42 43 |
# File 'app/policies/pageflow/site_policy.rb', line 40 def initialize(user, site) @user = user @account_role_query = AccountRoleQuery.new(user, site.account) end |
Instance Attribute Details
#user ⇒ Object (readonly)
Returns the value of attribute user.
38 39 40 |
# File 'app/policies/pageflow/site_policy.rb', line 38 def user @user end |
Instance Method Details
#read? ⇒ Boolean
45 46 47 48 49 |
# File 'app/policies/pageflow/site_policy.rb', line 45 def read? @user.admin? || (@account_role_query.has_at_least_role?(:manager) && Pageflow.config.allow_multiaccount_users) end |
#update? ⇒ Boolean
51 52 53 |
# File 'app/policies/pageflow/site_policy.rb', line 51 def update? read? end |