From 784a3db6274bf16a64d2cd947d42182c85cf605f Mon Sep 17 00:00:00 2001 From: GitLab Bot Date: Tue, 23 Jan 2024 06:08:58 +0000 Subject: Add latest changes from gitlab-org/gitlab@master --- app/graphql/types/project_type.rb | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'app/graphql/types/project_type.rb') diff --git a/app/graphql/types/project_type.rb b/app/graphql/types/project_type.rb index 7f49c717c78..aacd67e269e 100644 --- a/app/graphql/types/project_type.rb +++ b/app/graphql/types/project_type.rb @@ -110,6 +110,10 @@ module Types null: true, description: 'Indicates if the project has Large File Storage (LFS) enabled.' + field :max_access_level, Types::AccessLevelType, + null: false, + description: 'The maximum access level of the current user in the project.' + field :merge_requests_ff_only_enabled, GraphQL::Types::Boolean, null: true, description: 'Indicates if no merge commits should be created and all merges should instead be ' \ @@ -823,6 +827,16 @@ module Types } end + def max_access_level + return Gitlab::Access::NO_ACCESS if current_user.nil? + + BatchLoader::GraphQL.for(object.id).batch do |project_ids, loader| + current_user.max_member_access_for_project_ids(project_ids).each do |project_id, max_access_level| + loader.call(project_id, max_access_level) + end + end + end + private def project -- cgit v1.2.3