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/project_type.rb')
-rw-r--r--app/graphql/types/project_type.rb14
1 files changed, 14 insertions, 0 deletions
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