Sha256: c74f7c9b261432b2eff71bf3ec95f7ffb54a9f394e40e061f35727abdd3b3ca4

Contents?: true

Size: 869 Bytes

Versions: 9

Compression:

Stored size: 869 Bytes

Contents

module Locomotive
  class PagePolicy < ApplicationPolicy

    def index?
      site_staff?
    end

    def new?
      site_staff?
    end

    def edit?
      site_staff?
    end

    def create?
      site_staff? && !membership.visitor?
    end

    def update?
      site_staff? && !membership.visitor?
    end

    def destroy?
      site_staff? && !@resource.index_or_not_found? && !membership.visitor?
    end

    def show?
      site_admin_or_designer? || !@resource.hidden?
    end

    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

  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
locomotivecms-4.2.0.alpha2 app/policies/locomotive/page_policy.rb
locomotivecms-4.2.0.alpha1 app/policies/locomotive/page_policy.rb
locomotivecms-4.1.1 app/policies/locomotive/page_policy.rb
locomotivecms-4.1.0 app/policies/locomotive/page_policy.rb
locomotivecms-4.1.0.rc1 app/policies/locomotive/page_policy.rb
locomotivecms-4.0.3 app/policies/locomotive/page_policy.rb
locomotivecms-4.0.2 app/policies/locomotive/page_policy.rb
locomotivecms-4.0.1 app/policies/locomotive/page_policy.rb
locomotivecms-4.0.0 app/policies/locomotive/page_policy.rb