Welcome to mirror list, hosted at ThFree Co, Russian Federation.

organization_user_type.rb « organizations « types « graphql « app - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 41924586f382c89f28643c49ac01a477caec639a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# frozen_string_literal: true

module Types
  module Organizations
    class OrganizationUserType < BaseObject
      graphql_name 'OrganizationUser'
      description 'A user with access to the organization.'

      include UsersHelper

      authorize :read_organization_user

      alias_method :organization_user, :object

      field :badges,
        [GraphQL::Types::String],
        null: true,
        description: 'Badges describing the user within the organization.',
        alpha: { milestone: '16.4' }
      field :id,
        GraphQL::Types::ID,
        null: false,
        description: 'ID of the organization user.',
        alpha: { milestone: '16.4' }
      field :user,
        ::Types::UserType,
        null: false,
        description: 'User that is associated with the organization.',
        alpha: { milestone: '16.4' }

      def badges
        user_badges_in_admin_section(organization_user.user).pluck(:text) # rubocop:disable CodeReuse/ActiveRecord
      end
    end
  end
end