Update destroy ci_user attassion
This commit is contained in:
parent
0777db4ab4
commit
81ec264483
|
@ -3124,7 +3124,8 @@ http://localhost:3000/api/users/ci/cloud_account | jq
|
||||||
|
|
||||||
|参数名|类型|说明|
|
|参数名|类型|说明|
|
||||||
|-|-|-|
|
|-|-|-|
|
||||||
|step |int|0: 未绑定;1: 未认证(已绑定),2: 已认证|
|
|step |int|0: 未绑定;1: 未认证(已绑定)|
|
||||||
|
|devops_certification |boolean|true: 已认证, false: 未认证|
|
||||||
|ip |string|ci服务器ip|
|
|ip |string|ci服务器ip|
|
||||||
|redirect_url |string|认证地址|
|
|redirect_url |string|认证地址|
|
||||||
|
|
||||||
|
@ -3132,6 +3133,7 @@ http://localhost:3000/api/users/ci/cloud_account | jq
|
||||||
```json
|
```json
|
||||||
{
|
{
|
||||||
"step": 0,
|
"step": 0,
|
||||||
|
"devops_certification": false,
|
||||||
"cloud_account": {
|
"cloud_account": {
|
||||||
"ip": "xxx.xxx.xxx.x",
|
"ip": "xxx.xxx.xxx.x",
|
||||||
"redirect_url": "http://localhost:3000/login",
|
"redirect_url": "http://localhost:3000/login",
|
||||||
|
|
|
@ -125,15 +125,16 @@ class Ci::CloudAccountsController < Ci::BaseController
|
||||||
|
|
||||||
def unbind_account!(user)
|
def unbind_account!(user)
|
||||||
cloud_account = user.ci_cloud_account
|
cloud_account = user.ci_cloud_account
|
||||||
case user.devops_step
|
ci_user = cloud_account.ci_user
|
||||||
when User::DEVOPS_UNINIT, cloud_account.blank?
|
|
||||||
|
if user.devops_step == User::DEVOPS_UNINIT || cloud_account.blank?
|
||||||
return render_error('你未绑定CI服务器')
|
return render_error('你未绑定CI服务器')
|
||||||
when User::DEVOPS_UNVERIFIED
|
elsif user.devops_step == User::DEVOPS_UNVERIFIED || user.ci_certification?
|
||||||
cloud_account.destroy!
|
ci_user.destroy! if ci_user
|
||||||
when User::DEVOPS_CERTIFICATION
|
|
||||||
cloud_account.ci_user.destroy!
|
|
||||||
Ci::Repo.where(repo_namespace: user.login).delete_all
|
Ci::Repo.where(repo_namespace: user.login).delete_all
|
||||||
|
cloud_account.destroy!
|
||||||
end
|
end
|
||||||
|
|
||||||
user.projects.update_all(open_devops: false)
|
user.projects.update_all(open_devops: false)
|
||||||
user.set_drone_step!(User::DEVOPS_UNINIT)
|
user.set_drone_step!(User::DEVOPS_UNINIT)
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
json.step current_user.devops_step
|
json.step current_user.devops_step
|
||||||
|
json.devops_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
|
||||||
|
|
Loading…
Reference in New Issue