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

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

28 lines
645 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 ProjectAccessTokenEntity < AccessTokenEntityBase
2022-08-27 11:52:29 +05:30
include Gitlab::Routing
expose :revoke_path do |token, options|
project = options.fetch(:project)
next unless project
revoke_namespace_project_settings_access_token_path(
id: token,
2022-11-25 23:54:43 +05:30
namespace_id: project.namespace.full_path,
2022-08-27 11:52:29 +05:30
project_id: project.path)
end
2022-10-11 01:57:18 +05:30
expose :role do |token, options|
2022-08-27 11:52:29 +05:30
project = options.fetch(:project)
next unless project
next unless token.user
2022-10-11 01:57:18 +05:30
project.member(token.user)&.human_access
2022-08-27 11:52:29 +05:30
end
end
# rubocop: enable Gitlab/NamespacedClass