Class: Locomotive::PagePolicy
Instance Attribute Summary
#membership, #resource
Instance Method Summary
collapse
#destroy_all?, #initialize, #persisted?, #site_admin?, #site_admin_or_designer?, #site_staff?, #super_admin?
Instance Method Details
16
17
18
|
# File 'app/policies/locomotive/page_policy.rb', line 16
def create?
site_staff? && !membership.visitor?
end
|
24
25
26
|
# File 'app/policies/locomotive/page_policy.rb', line 24
def destroy?
site_staff? && !@resource.index_or_not_found? && !membership.visitor?
end
|
12
13
14
|
# File 'app/policies/locomotive/page_policy.rb', line 12
def edit?
site_staff?
end
|
4
5
6
|
# File 'app/policies/locomotive/page_policy.rb', line 4
def index?
site_staff?
end
|
8
9
10
|
# File 'app/policies/locomotive/page_policy.rb', line 8
def new?
site_staff?
end
|
#permitted_attributes ⇒ Object
32
33
34
35
36
37
38
39
|
# File 'app/policies/locomotive/page_policy.rb', line 32
def permitted_attributes
attributes = [:title, :layout_id, :slug, :parent_id, :listed, :published, :redirect, :redirect_url, :redirect_type, :seo_title, :meta_description, :meta_keywords]
if site_admin_or_designer?
attributes += [:cache_enabled, :cache_control, :cache_vary]
attributes += [:handle]
end
attributes
end
|
28
29
30
|
# File 'app/policies/locomotive/page_policy.rb', line 28
def show?
site_admin_or_designer? || !@resource.hidden?
end
|
20
21
22
|
# File 'app/policies/locomotive/page_policy.rb', line 20
def update?
site_staff? && !membership.visitor?
end
|