forked from Trustie/forgeplus
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|
|
||||
|redirect_url |string|认证地址|
|
||||
|
||||
|
@ -3132,6 +3133,7 @@ http://localhost:3000/api/users/ci/cloud_account | jq
|
|||
```json
|
||||
{
|
||||
"step": 0,
|
||||
"devops_certification": false,
|
||||
"cloud_account": {
|
||||
"ip": "xxx.xxx.xxx.x",
|
||||
"redirect_url": "http://localhost:3000/login",
|
||||
|
|
|
@ -125,15 +125,16 @@ class Ci::CloudAccountsController < Ci::BaseController
|
|||
|
||||
def unbind_account!(user)
|
||||
cloud_account = user.ci_cloud_account
|
||||
case user.devops_step
|
||||
when User::DEVOPS_UNINIT, cloud_account.blank?
|
||||
ci_user = cloud_account.ci_user
|
||||
|
||||
if user.devops_step == User::DEVOPS_UNINIT || cloud_account.blank?
|
||||
return render_error('你未绑定CI服务器')
|
||||
when User::DEVOPS_UNVERIFIED
|
||||
cloud_account.destroy!
|
||||
when User::DEVOPS_CERTIFICATION
|
||||
cloud_account.ci_user.destroy!
|
||||
elsif user.devops_step == User::DEVOPS_UNVERIFIED || user.ci_certification?
|
||||
ci_user.destroy! if ci_user
|
||||
Ci::Repo.where(repo_namespace: user.login).delete_all
|
||||
cloud_account.destroy!
|
||||
end
|
||||
|
||||
user.projects.update_all(open_devops: false)
|
||||
user.set_drone_step!(User::DEVOPS_UNINIT)
|
||||
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
json.step current_user.devops_step
|
||||
json.devops_certification current_user.ci_certification?
|
||||
json.cloud_account do
|
||||
if @cloud_account && !current_user.devops_uninit?
|
||||
json.ip @cloud_account.drone_ip
|
||||
|
|
Loading…
Reference in New Issue