summaryrefslogtreecommitdiff
path: root/lib/ci/api/helpers.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/ci/api/helpers.rb')
-rw-r--r--lib/ci/api/helpers.rb9
1 files changed, 7 insertions, 2 deletions
diff --git a/lib/ci/api/helpers.rb b/lib/ci/api/helpers.rb
index 0202b3cf8a3..51b05aa0cb6 100644
--- a/lib/ci/api/helpers.rb
+++ b/lib/ci/api/helpers.rb
@@ -13,9 +13,14 @@ module Ci
forbidden! unless current_runner
end
- def authenticate_build!(build, verify_token: true)
+ def authenticate_build!(build)
+ not_found! unless build
+ forbidden! if !build_token_valid?(build)
+ validate_build!(build)
+ end
+
+ def validate_build!(build)
not_found! unless build
- forbidden! if verify_token && !build_token_valid?(build)
forbidden!('Project has been deleted!') unless build.project
forbidden!('Build has been erased!') if build.erased?
end