summaryrefslogtreecommitdiff
path: root/app/controllers/projects/application_controller.rb
diff options
context:
space:
mode:
Diffstat (limited to 'app/controllers/projects/application_controller.rb')
-rw-r--r--app/controllers/projects/application_controller.rb15
1 files changed, 15 insertions, 0 deletions
diff --git a/app/controllers/projects/application_controller.rb b/app/controllers/projects/application_controller.rb
index 62233c8c3c9..028b7af02c9 100644
--- a/app/controllers/projects/application_controller.rb
+++ b/app/controllers/projects/application_controller.rb
@@ -32,6 +32,21 @@ class Projects::ApplicationController < ApplicationController
->(project) { !project.pending_delete? }
end
+ def authorize_read_build_trace!
+ return if can?(current_user, :read_build_trace, build)
+
+ if build.debug_mode?
+ access_denied!(
+ _('You must have developer or higher permissions in the associated project to view job logs when debug trace ' \
+ "is enabled. To disable debug trace, set the 'CI_DEBUG_TRACE' variable to 'false' in your pipeline " \
+ 'configuration or CI/CD settings. If you need to view this job log, a project maintainer must add you to ' \
+ 'the project with developer permissions or higher.')
+ )
+ else
+ access_denied!(_('The current user is not authorized to access the job log.'))
+ end
+ end
+
def build_canonical_path(project)
params[:namespace_id] = project.namespace.to_param
params[:project_id] = project.to_param