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