debian-mirror-gitlab/app/serializers/group_access_token_entity.rb

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

27 lines
569 B
Ruby
Raw Normal View History

2022-08-27 11:52:29 +05:30
# frozen_string_literal: true
# rubocop: disable Gitlab/NamespacedClass
2022-10-11 01:57:18 +05:30
class GroupAccessTokenEntity < AccessTokenEntityBase
2022-08-27 11:52:29 +05:30
include Gitlab::Routing
expose :revoke_path do |token, options|
group = options.fetch(:group)
next unless group
revoke_group_settings_access_token_path(
id: token,
2022-11-25 23:54:43 +05:30
group_id: group.full_path)
2022-08-27 11:52:29 +05:30
end
2022-10-11 01:57:18 +05:30
expose :role do |token, options|
2022-08-27 11:52:29 +05:30
group = options.fetch(:group)
next unless group
next unless token.user
2022-10-11 01:57:18 +05:30
group.member(token.user)&.human_access
2022-08-27 11:52:29 +05:30
end
end
# rubocop: enable Gitlab/NamespacedClass