You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

59 lines
710 B

  1. # frozen_string_literal: true
  2. class AccountPolicy < ApplicationPolicy
  3. def index?
  4. staff?
  5. end
  6. def show?
  7. staff?
  8. end
  9. def warn?
  10. staff? && !record.user&.staff?
  11. end
  12. def suspend?
  13. staff? && !record.user&.staff?
  14. end
  15. def destroy?
  16. record.suspended? && record.deletion_request.present? && admin?
  17. end
  18. def unsuspend?
  19. staff?
  20. end
  21. def silence?
  22. staff? && !record.user&.staff?
  23. end
  24. def unsilence?
  25. staff?
  26. end
  27. def redownload?
  28. admin?
  29. end
  30. def remove_avatar?
  31. staff?
  32. end
  33. def remove_header?
  34. staff?
  35. end
  36. def subscribe?
  37. admin?
  38. end
  39. def unsubscribe?
  40. admin?
  41. end
  42. def memorialize?
  43. admin? && !record.user&.admin?
  44. end
  45. end