1
0
Fork 0
mirror of https://github.com/mastodon/mastodon.git synced 2024-08-20 21:08:15 -07:00
mastodon/app/policies/invite_policy.rb

30 lines
430 B
Ruby
Raw Normal View History

# frozen_string_literal: true
class InvitePolicy < ApplicationPolicy
def index?
staff?
end
def create?
min_required_role?
end
def deactivate_all?
admin?
end
def destroy?
owner? || (Setting.min_invite_role == 'admin' ? admin? : staff?)
end
private
def owner?
record.user_id == current_user&.id
end
def min_required_role?
current_user&.role?(Setting.min_invite_role)
end
end