1
0
mirror of https://github.com/whippyshou/mastodon synced 2024-11-25 07:37:08 +09:00
whippy-edition/app/policies/invite_policy.rb
2017-12-01 12:26:19 +01:00

26 lines
390 B
Ruby

# frozen_string_literal: true
class InvitePolicy < ApplicationPolicy
def index?
staff?
end
def create?
min_required_role?
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