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/group_type.rb')
-rw-r--r--app/graphql/types/group_type.rb14
1 files changed, 14 insertions, 0 deletions
diff --git a/app/graphql/types/group_type.rb b/app/graphql/types/group_type.rb
index 01b741b5a98..0bd0f251c1a 100644
--- a/app/graphql/types/group_type.rb
+++ b/app/graphql/types/group_type.rb
@@ -62,6 +62,10 @@ module Types
null: true,
description: 'Indicates if a group has email notifications disabled.'
+ field :max_access_level, Types::AccessLevelType,
+ null: false,
+ description: 'The maximum access level of the current user in the group.'
+
field :mentions_disabled,
type: GraphQL::Types::Boolean,
null: true,
@@ -375,6 +379,16 @@ module Types
end
end
+ def max_access_level
+ return Gitlab::Access::NO_ACCESS if current_user.nil?
+
+ BatchLoader::GraphQL.for(object.id).batch do |group_ids, loader|
+ current_user.max_member_access_for_group_ids(group_ids).each do |group_id, max_access_level|
+ loader.call(group_id, max_access_level)
+ end
+ end
+ end
+
private
def group