debian-mirror-gitlab/lib/api/entities/user_safe.rb

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

18 lines
547 B
Ruby
Raw Normal View History

2020-03-13 15:44:24 +05:30
# frozen_string_literal: true
module API
module Entities
class UserSafe < Grape::Entity
2022-10-11 01:57:18 +05:30
include RequestAwareEntity
2023-01-13 00:05:48 +05:30
expose :id, documentation: { type: 'integer', example: 1 }
expose :username, documentation: { type: 'string', example: 'admin' }
expose :name, documentation: { type: 'string', example: 'Administrator' } do |user|
2022-10-11 01:57:18 +05:30
current_user = request.respond_to?(:current_user) ? request.current_user : options.fetch(:current_user, nil)
user.redacted_name(current_user)
2021-12-07 22:27:20 +05:30
end
2020-03-13 15:44:24 +05:30
end
end
end