Add latest changes from gitlab-org/security/gitlab@16-3-stable-ee

This commit is contained in:
GitLab Bot
2023-08-30 19:46:44 +00:00
parent 6a5fe8e743
commit 160a0406be
9 changed files with 62 additions and 18 deletions

View File

@ -17,8 +17,15 @@ module API
project.import_state&.relation_hard_failures(limit: 100) || []
end
expose :import_error, documentation: { type: 'string', example: 'Error message' } do |project, _options|
project.import_state&.last_error
expose :import_error, documentation: { type: 'string', example: 'Error message' } do |project, options|
next unless options[:current_user]
next unless project.import_state&.last_error
if Ability.allowed?(options[:current_user], :read_import_error, project)
project.import_state&.last_error
else
_("Ask a maintainer to check the import status for more details.")
end
end
expose :stats, documentation: { type: 'object' } do |project, _options|

View File

@ -111,7 +111,7 @@ module API
).execute
if response.success?
present(response.payload, with: Entities::ProjectImportStatus)
present(response.payload, with: Entities::ProjectImportStatus, current_user: current_user)
else
render_api_error!(response.message, response.http_status)
end
@ -134,7 +134,7 @@ module API
end
route_setting :skip_authentication, true
get ':id/import' do
present user_project, with: Entities::ProjectImportStatus
present user_project, with: Entities::ProjectImportStatus, current_user: current_user
end
params do
@ -182,7 +182,7 @@ module API
).execute
if response.success?
present(response.payload, with: Entities::ProjectImportStatus)
present(response.payload, with: Entities::ProjectImportStatus, current_user: current_user)
else
render_api_error!(response.message, response.http_status)
end
@ -241,7 +241,7 @@ module API
).execute
if response.success?
present(response.payload, with: Entities::ProjectImportStatus)
present(response.payload, with: Entities::ProjectImportStatus, current_user: current_user)
else
render_api_error!(response.message, response.http_status)
end