25 lines
441 B
Ruby
25 lines
441 B
Ruby
# 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
|