diff options
author | Kamil Trzcinski <ayufan@ayufan.eu> | 2015-12-10 17:29:44 +0100 |
---|---|---|
committer | Kamil Trzcinski <ayufan@ayufan.eu> | 2015-12-11 18:02:09 +0100 |
commit | 8cdd54cc0696b76daa2baf463d02d944b50bac6a (patch) | |
tree | eb3e5c1aeef92181b49217c965685e5b9ba67c74 /lib | |
parent | e80e3f5372d6bcad1fbe04a85b3086bb66794828 (diff) | |
download | gitlab-ce-8cdd54cc0696b76daa2baf463d02d944b50bac6a.tar.gz |
Add runners token
Diffstat (limited to 'lib')
-rw-r--r-- | lib/ci/api/helpers.rb | 4 | ||||
-rw-r--r-- | lib/ci/api/runners.rb | 2 | ||||
-rw-r--r-- | lib/ci/api/triggers.rb | 2 | ||||
-rw-r--r-- | lib/gitlab/backend/grack_auth.rb | 2 |
4 files changed, 3 insertions, 7 deletions
diff --git a/lib/ci/api/helpers.rb b/lib/ci/api/helpers.rb index 02502333756..9891b5e38ea 100644 --- a/lib/ci/api/helpers.rb +++ b/lib/ci/api/helpers.rb @@ -13,10 +13,6 @@ module Ci forbidden! unless current_runner end - def authenticate_project_token!(project) - forbidden! unless project.valid_token?(params[:project_token]) - end - def authenticate_build_token!(build) token = (params[BUILD_TOKEN_PARAM] || env[BUILD_TOKEN_HEADER]).to_s forbidden! unless token && build.valid_token?(token) diff --git a/lib/ci/api/runners.rb b/lib/ci/api/runners.rb index dd77bd65863..1e738a73157 100644 --- a/lib/ci/api/runners.rb +++ b/lib/ci/api/runners.rb @@ -36,7 +36,7 @@ module Ci tag_list: params[:tag_list], is_shared: true ) - elsif project = Project.find_by(token: params[:token]) + elsif project = Project.find_by(runners_token: params[:token]) # Create a specific runner for project. project.ci_runners.create( description: params[:description], diff --git a/lib/ci/api/triggers.rb b/lib/ci/api/triggers.rb index 6d2cdd8c682..63b42113513 100644 --- a/lib/ci/api/triggers.rb +++ b/lib/ci/api/triggers.rb @@ -14,7 +14,7 @@ module Ci post ":id/refs/:ref/trigger" do required_attributes! [:token] - project = Project.find_by_ci_id(params[:id]) + project = Project.find_by(ci_id: params[:id].to_i) trigger = Ci::Trigger.find_by_token(params[:token].to_s) not_found! unless project && trigger unauthorized! unless trigger.project == project diff --git a/lib/gitlab/backend/grack_auth.rb b/lib/gitlab/backend/grack_auth.rb index 5a032b572ae..d854c1c8683 100644 --- a/lib/gitlab/backend/grack_auth.rb +++ b/lib/gitlab/backend/grack_auth.rb @@ -78,7 +78,7 @@ module Grack underscored_service = matched_login['s'].underscore if underscored_service == 'gitlab_ci' - return project && project.builds_enabled? && project.valid_token?(password) + return project && project.builds_enabled? && project.valid_build_token?(password) elsif Service.available_services_names.include?(underscored_service) service_method = "#{underscored_service}_service" service = project.send(service_method) |