diff --git a/app/controllers/ci/base_controller.rb b/app/controllers/ci/base_controller.rb index aeabb0d3e..59dc1cb84 100644 --- a/app/controllers/ci/base_controller.rb +++ b/app/controllers/ci/base_controller.rb @@ -18,8 +18,8 @@ class Ci::BaseController < ApplicationController end end - def authorize_manage_builds! - unless @project.owner?(current_user) + def authenticate_manager! + unless @project.manager?(current_user) return render_forbidden end end @@ -28,7 +28,7 @@ class Ci::BaseController < ApplicationController return render_forbidden unless current_user.admin? end - def authorize_owner_project! + def authorize_owner! unless @project.owner?(current_user) return render_forbidden end diff --git a/app/controllers/ci/builds_controller.rb b/app/controllers/ci/builds_controller.rb index e797a746d..4900a890a 100644 --- a/app/controllers/ci/builds_controller.rb +++ b/app/controllers/ci/builds_controller.rb @@ -2,7 +2,7 @@ class Ci::BuildsController < Ci::BaseController include RepositoriesHelper before_action :load_project - before_action :authorize_owner_project! + before_action :authorize_owner!, only: [:restart, :stop] before_action :load_repo before_action :find_cloud_account, except: [:index, :show] diff --git a/app/controllers/ci/cloud_accounts_controller.rb b/app/controllers/ci/cloud_accounts_controller.rb index 1271c708e..a1429078e 100644 --- a/app/controllers/ci/cloud_accounts_controller.rb +++ b/app/controllers/ci/cloud_accounts_controller.rb @@ -3,7 +3,7 @@ class Ci::CloudAccountsController < Ci::BaseController skip_before_action :connect_to_ci_database, only: %i[create bind] before_action :load_project, only: %i[create activate] - before_action :authorize_owner_project!, only: %i[create activate] + before_action :authorize_owner!, only: %i[create activate] before_action :load_repo, only: %i[activate] before_action :find_cloud_account, only: %i[show oauth_grant] before_action :validate_params!, only: %i[create bind] diff --git a/app/controllers/ci/projects_controller.rb b/app/controllers/ci/projects_controller.rb index bf09fb002..c7b7338f1 100644 --- a/app/controllers/ci/projects_controller.rb +++ b/app/controllers/ci/projects_controller.rb @@ -4,7 +4,7 @@ class Ci::ProjectsController < Ci::BaseController before_action :load_project before_action :load_repo, only: [:update_trustie_pipeline, :activate, :deactivate] - before_action :authorize_owner_project!, only: [:authorize] + before_action :authorize_owner!, only: [:authorize] before_action :find_cloud_account, only: [:authorize, :activate, :deactivate] def authorize diff --git a/app/views/ci/cloud_accounts/bind.json.jbuilder b/app/views/ci/cloud_accounts/bind.json.jbuilder index 230f4672f..cff42cefe 100644 --- a/app/views/ci/cloud_accounts/bind.json.jbuilder +++ b/app/views/ci/cloud_accounts/bind.json.jbuilder @@ -2,7 +2,6 @@ json.step current_user.devops_step json.cloud_account do if @cloud_account && !current_user.devops_uninit? json.ip @cloud_account.drone_ip - json.redirect_url "#{@cloud_account.drone_url}/login" if current_user.devops_unverified? else json.nil! end diff --git a/app/views/ci/cloud_accounts/show.json.jbuilder b/app/views/ci/cloud_accounts/show.json.jbuilder index 847b750d5..efb2d7db9 100644 --- a/app/views/ci/cloud_accounts/show.json.jbuilder +++ b/app/views/ci/cloud_accounts/show.json.jbuilder @@ -3,7 +3,6 @@ json.ci_certification current_user.ci_certification? json.cloud_account do if @cloud_account && !current_user.devops_uninit? json.ip @cloud_account.drone_ip - json.redirect_url "#{@cloud_account.drone_url}/login" if current_user.devops_unverified? else json.nil! end