setting_policy.rb 385 B

123456789101112131415161718192021
  1. # Copyright (C) 2012-2023 Zammad Foundation, https://zammad-foundation.org/
  2. class SettingPolicy < ApplicationPolicy
  3. def show?
  4. permitted?
  5. end
  6. def update?
  7. permitted?
  8. end
  9. private
  10. def permitted?
  11. return false if record.preferences[:protected]
  12. return true if !record.preferences[:permission]
  13. user.permissions?(record.preferences[:permission])
  14. end
  15. end