status_policy.rb 611 B

1234567891011121314151617181920212223242526272829
  1. # frozen_string_literal: true
  2. class Admin::StatusPolicy < ApplicationPolicy
  3. def initialize(current_account, record, preloaded_relations = {})
  4. super(current_account, record)
  5. @preloaded_relations = preloaded_relations
  6. end
  7. def index?
  8. role.can?(:manage_reports, :manage_users)
  9. end
  10. def show?
  11. role.can?(:manage_reports, :manage_users) && (record.public_visibility? || record.unlisted_visibility? || record.reported?)
  12. end
  13. def destroy?
  14. role.can?(:manage_reports)
  15. end
  16. def update?
  17. role.can?(:manage_reports)
  18. end
  19. def review?
  20. role.can?(:manage_taxonomies)
  21. end
  22. end