account_policy.rb 620 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  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 unsuspend?
  16. staff?
  17. end
  18. def silence?
  19. staff? && !record.user&.staff?
  20. end
  21. def unsilence?
  22. staff?
  23. end
  24. def redownload?
  25. admin?
  26. end
  27. def remove_avatar?
  28. staff?
  29. end
  30. def remove_header?
  31. staff?
  32. end
  33. def subscribe?
  34. admin?
  35. end
  36. def unsubscribe?
  37. admin?
  38. end
  39. def memorialize?
  40. admin? && !record.user&.admin?
  41. end
  42. end