summaryrefslogtreecommitdiff
path: root/lib/ci/api/helpers.rb
diff options
context:
space:
mode:
authorLin Jen-Shin <godfat@godfat.org>2016-12-15 00:28:55 +0800
committerLin Jen-Shin <godfat@godfat.org>2016-12-15 00:28:55 +0800
commite485b3f6ad3c220655e4aa909d93bca7a4ae6afc (patch)
tree044bed77b311d0e23620015ad774c3627d1652ed /lib/ci/api/helpers.rb
parent278baa5b618c5595045415a55d863daf9a15d792 (diff)
downloadgitlab-ce-e485b3f6ad3c220655e4aa909d93bca7a4ae6afc.tar.gz
Give forbidden if project for the build was deleted
Closes #25309
Diffstat (limited to 'lib/ci/api/helpers.rb')
-rw-r--r--lib/ci/api/helpers.rb7
1 files changed, 5 insertions, 2 deletions
diff --git a/lib/ci/api/helpers.rb b/lib/ci/api/helpers.rb
index e608f5f6cad..0202b3cf8a3 100644
--- a/lib/ci/api/helpers.rb
+++ b/lib/ci/api/helpers.rb
@@ -13,8 +13,11 @@ module Ci
forbidden! unless current_runner
end
- def authenticate_build_token!(build)
- forbidden! unless build_token_valid?(build)
+ def authenticate_build!(build, verify_token: true)
+ 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
def runner_registration_token_valid?