diff options
Diffstat (limited to 'app/graphql/resolvers/organizations/organization_users_resolver.rb')
-rw-r--r-- | app/graphql/resolvers/organizations/organization_users_resolver.rb | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/app/graphql/resolvers/organizations/organization_users_resolver.rb b/app/graphql/resolvers/organizations/organization_users_resolver.rb new file mode 100644 index 00000000000..b4790da6c0a --- /dev/null +++ b/app/graphql/resolvers/organizations/organization_users_resolver.rb @@ -0,0 +1,36 @@ +# frozen_string_literal: true + +module Resolvers + module Organizations + class OrganizationUsersResolver < BaseResolver + include Gitlab::Graphql::Authorize::AuthorizeResource + include LooksAhead + + type Types::Organizations::OrganizationUserType.connection_type, null: true + + authorize :read_organization_user + + alias_method :organization, :object + + def resolve_with_lookahead + authorize!(object) + + apply_lookahead(organization_users) + end + + private + + def organization_users + ::Organizations::OrganizationUsersFinder + .new(organization: organization, current_user: context[:current_user]) + .execute + end + + def preloads + { + user: [:user] + } + end + end + end +end |