2020-07-29 11:09:39 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
class PersonalAccessTokenPolicy < BasePolicy
|
|
|
|
condition(:is_owner) { user && subject.user_id == user.id }
|
|
|
|
|
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
|