ADD 更改工作流的权限

This commit is contained in:
Jasder 2020-10-16 11:57:20 +08:00
parent 6df01dead1
commit 5156450eac
6 changed files with 6 additions and 8 deletions

View File

@ -18,8 +18,8 @@ class Ci::BaseController < ApplicationController
end end
end end
def authorize_manage_builds! def authenticate_manager!
unless @project.owner?(current_user) unless @project.manager?(current_user)
return render_forbidden return render_forbidden
end end
end end
@ -28,7 +28,7 @@ class Ci::BaseController < ApplicationController
return render_forbidden unless current_user.admin? return render_forbidden unless current_user.admin?
end end
def authorize_owner_project! def authorize_owner!
unless @project.owner?(current_user) unless @project.owner?(current_user)
return render_forbidden return render_forbidden
end end

View File

@ -2,7 +2,7 @@ class Ci::BuildsController < Ci::BaseController
include RepositoriesHelper include RepositoriesHelper
before_action :load_project before_action :load_project
before_action :authorize_owner_project! before_action :authorize_owner!, only: [:restart, :stop]
before_action :load_repo before_action :load_repo
before_action :find_cloud_account, except: [:index, :show] before_action :find_cloud_account, except: [:index, :show]

View File

@ -3,7 +3,7 @@ class Ci::CloudAccountsController < Ci::BaseController
skip_before_action :connect_to_ci_database, only: %i[create bind] skip_before_action :connect_to_ci_database, only: %i[create bind]
before_action :load_project, only: %i[create activate] 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 :load_repo, only: %i[activate]
before_action :find_cloud_account, only: %i[show oauth_grant] before_action :find_cloud_account, only: %i[show oauth_grant]
before_action :validate_params!, only: %i[create bind] before_action :validate_params!, only: %i[create bind]

View File

@ -4,7 +4,7 @@ class Ci::ProjectsController < Ci::BaseController
before_action :load_project before_action :load_project
before_action :load_repo, only: [:update_trustie_pipeline, :activate, :deactivate] 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] before_action :find_cloud_account, only: [:authorize, :activate, :deactivate]
def authorize def authorize

View File

@ -2,7 +2,6 @@ json.step current_user.devops_step
json.cloud_account do json.cloud_account do
if @cloud_account && !current_user.devops_uninit? if @cloud_account && !current_user.devops_uninit?
json.ip @cloud_account.drone_ip json.ip @cloud_account.drone_ip
json.redirect_url "#{@cloud_account.drone_url}/login" if current_user.devops_unverified?
else else
json.nil! json.nil!
end end

View File

@ -3,7 +3,6 @@ json.ci_certification current_user.ci_certification?
json.cloud_account do json.cloud_account do
if @cloud_account && !current_user.devops_uninit? if @cloud_account && !current_user.devops_uninit?
json.ip @cloud_account.drone_ip json.ip @cloud_account.drone_ip
json.redirect_url "#{@cloud_account.drone_url}/login" if current_user.devops_unverified?
else else
json.nil! json.nil!
end end