You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
26 lines
342 B
26 lines
342 B
7 years ago
|
# 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
|