debian-mirror-gitlab/app/policies/personal_access_token_policy.rb
2021-08-04 16:29:09 +05:30

10 lines
274 B
Ruby

# frozen_string_literal: true
class PersonalAccessTokenPolicy < BasePolicy
condition(:is_owner) { user && subject.user_id == user.id && !subject.impersonation }
rule { (is_owner | admin) & ~blocked }.policy do
enable :read_token
enable :revoke_token
end
end