2020-07-29 11:09:39 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
class PersonalAccessTokenPolicy < BasePolicy
|
2021-08-03 17:09:39 -04:00
|
|
|
condition(:is_owner) { user && subject.user_id == user.id && !subject.impersonation }
|
2020-07-29 11:09:39 -04:00
|
|
|
|
2020-08-11 08:09:55 -04:00
|
|
|
rule { (is_owner | admin) & ~blocked }.policy do
|
2020-07-29 11:09:39 -04:00
|
|
|
enable :read_token
|
2020-08-07 11:10:17 -04:00
|
|
|
enable :revoke_token
|
2020-07-29 11:09:39 -04:00
|
|
|
end
|
|
|
|
end
|