account_policy.rb 942 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  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? && !record.instance_actor?
  14. end
  15. def destroy?
  16. record.suspended_temporarily? && admin?
  17. end
  18. def unsuspend?
  19. staff? && record.suspension_origin_local?
  20. end
  21. def sensitive?
  22. staff? && !record.user&.staff?
  23. end
  24. def unsensitive?
  25. staff?
  26. end
  27. def silence?
  28. staff? && !record.user&.staff?
  29. end
  30. def unsilence?
  31. staff?
  32. end
  33. def redownload?
  34. admin?
  35. end
  36. def remove_avatar?
  37. staff?
  38. end
  39. def remove_header?
  40. staff?
  41. end
  42. def subscribe?
  43. admin?
  44. end
  45. def unsubscribe?
  46. admin?
  47. end
  48. def memorialize?
  49. admin? && !record.user&.admin? && !record.instance_actor?
  50. end
  51. def unblock_email?
  52. staff?
  53. end
  54. def review?
  55. staff?
  56. end
  57. end