Sha256: c8e35e499cd99de2fce6758b5989cdabe98d47218c3f580c72dc58d2da8f001f

Contents?: true

Size: 367 Bytes

Versions: 3

Compression:

Stored size: 367 Bytes

Contents

module Pageflow
  class EntryTemplatePolicy < ApplicationPolicy
    def initialize(user, entry_template)
      @user = user
      @entry_template = entry_template
    end

    def edit?
      allows?(%w(publisher manager))
    end

    private

    def allows?(roles)
      @user.memberships.where(role: roles, entity: @entry_template.account).any?
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
pageflow-15.2.2 app/policies/pageflow/entry_template_policy.rb
pageflow-15.2.1 app/policies/pageflow/entry_template_policy.rb
pageflow-15.2.0 app/policies/pageflow/entry_template_policy.rb