trabajo-afectivo/app/policies/knowledge_base_policy.rb

26 lines
441 B
Ruby
Raw Permalink Normal View History

2022-01-01 13:38:12 +00:00
# Copyright (C) 2012-2022 Zammad Foundation, https://zammad-foundation.org/
class KnowledgeBasePolicy < ApplicationPolicy
def show?
access_editor? || access_reader?
end
def update?
access_editor?
end
private
def access
@access ||= KnowledgeBase::EffectivePermission.new(user, record).access_effective
end
def access_editor?
access == 'editor'
end
def access_reader?
access == 'reader'
end
end