logo

mastofe

My custom branche(s) on git.pleroma.social/pleroma/mastofe git clone https://hacktivis.me/git/mastofe.git

invite_policy.rb (390B)


  1. # frozen_string_literal: true
  2. class InvitePolicy < ApplicationPolicy
  3. def index?
  4. staff?
  5. end
  6. def create?
  7. min_required_role?
  8. end
  9. def destroy?
  10. owner? || (Setting.min_invite_role == 'admin' ? admin? : staff?)
  11. end
  12. private
  13. def owner?
  14. record.user_id == current_user&.id
  15. end
  16. def min_required_role?
  17. current_user&.role?(Setting.min_invite_role)
  18. end
  19. end