debian-mirror-gitlab/app/graphql/resolvers/users/groups_resolver.rb

40 lines
1.2 KiB
Ruby
Raw Normal View History

2021-11-11 11:23:49 +05:30
# frozen_string_literal: true
module Resolvers
module Users
class GroupsResolver < BaseResolver
2021-12-11 22:18:48 +05:30
include ResolvesGroups
2021-11-11 11:23:49 +05:30
include Gitlab::Graphql::Authorize::AuthorizeResource
type Types::GroupType.connection_type, null: true
authorize :read_user_groups
authorizes_object!
argument :search, GraphQL::Types::String,
required: false,
description: 'Search by group name or path.'
argument :permission_scope,
::Types::PermissionTypes::GroupEnum,
required: false,
description: 'Filter by permissions the user has on groups.'
before_connection_authorization do |nodes, current_user|
2021-12-11 22:18:48 +05:30
Preloaders::GroupPolicyPreloader.new(nodes, current_user).execute
2021-11-11 11:23:49 +05:30
end
2021-12-11 22:18:48 +05:30
def ready?(**args)
Feature.enabled?(:paginatable_namespace_drop_down_for_project_creation, current_user, default_enabled: :yaml)
2021-11-11 11:23:49 +05:30
end
private
2021-12-11 22:18:48 +05:30
def resolve_groups(**args)
Groups::UserGroupsFinder.new(current_user, object, args).execute
2021-11-11 11:23:49 +05:30
end
end
end
end
Resolvers::Users::GroupsResolver.prepend_mod_with('Resolvers::Users::GroupsResolver')