mirror of
https://framagit.org/tykayn/mastodon.git
synced 2023-08-25 08:33:12 +02:00
26 lines
342 B
Ruby
26 lines
342 B
Ruby
|
# frozen_string_literal: true
|
||
|
|
||
|
class InvitePolicy < ApplicationPolicy
|
||
|
def index?
|
||
|
staff?
|
||
|
end
|
||
|
|
||
|
def create?
|
||
|
min_required_role?
|
||
|
end
|
||
|
|
||
|
def destroy?
|
||
|
owner? || 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
|