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

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'app/graphql/types/organizations/organization_user_type.rb')
-rw-r--r--app/graphql/types/organizations/organization_user_type.rb36
1 files changed, 36 insertions, 0 deletions
diff --git a/app/graphql/types/organizations/organization_user_type.rb b/app/graphql/types/organizations/organization_user_type.rb
new file mode 100644
index 00000000000..41924586f38
--- /dev/null
+++ b/app/graphql/types/organizations/organization_user_type.rb
@@ -0,0 +1,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