mirror of
https://github.com/yunionio/cloudpods.git
synced 2026-09-21 14:19:49 +08:00
Merge pull request #3657 from tb365/bugfix/tb-bugfix-1114
user-project create api bugfix
This commit is contained in:
@@ -104,6 +104,10 @@ func (lbcert *SLoadbalancerCertificate) ValidateUpdateData(ctx context.Context,
|
||||
updateData.Set("name", jsonutils.NewString(name))
|
||||
}
|
||||
|
||||
if desc, err := data.GetString("description"); err == nil {
|
||||
updateData.Set("description", jsonutils.NewString(desc))
|
||||
}
|
||||
|
||||
if _, err := lbcert.SVirtualResourceBase.ValidateUpdateData(ctx, userCred, query, updateData); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
@@ -67,6 +67,7 @@ func (self *EipAssociateTask) OnInit(ctx context.Context, obj db.IStandaloneMode
|
||||
|
||||
if err := driver.RequestAssociateEip(ctx, self.UserCred, server, eip, self); err != nil {
|
||||
self.TaskFail(ctx, eip, err.Error(), server)
|
||||
return
|
||||
}
|
||||
|
||||
server.StartSyncstatus(ctx, self.UserCred, "")
|
||||
|
||||
@@ -317,8 +317,20 @@ func (this *ProjectManagerV3) DoCreateProject(s *mcclient.ClientSession, p jsonu
|
||||
}
|
||||
|
||||
// assgin users to project
|
||||
users := _user.(*jsonutils.JSONArray).GetStringArray()
|
||||
roles := _role.(*jsonutils.JSONArray).GetStringArray()
|
||||
users := []string{}
|
||||
roles := []string{}
|
||||
if _user != nil {
|
||||
if _u, ok := _user.(*jsonutils.JSONArray); ok {
|
||||
users = _u.GetStringArray()
|
||||
}
|
||||
}
|
||||
|
||||
if _role != nil {
|
||||
if _r, ok := _role.(*jsonutils.JSONArray); ok {
|
||||
roles = _r.GetStringArray()
|
||||
}
|
||||
}
|
||||
|
||||
if len(users) > 0 && len(roles) > 0 {
|
||||
var projectG errgroup.Group
|
||||
|
||||
|
||||
@@ -186,8 +186,20 @@ func (this *UserManagerV3) DoCreateUser(s *mcclient.ClientSession, p jsonutils.J
|
||||
}
|
||||
|
||||
// assgin project & role
|
||||
projects := _project.(*jsonutils.JSONArray).GetStringArray()
|
||||
roles := _role.(*jsonutils.JSONArray).GetStringArray()
|
||||
projects := []string{}
|
||||
roles := []string{}
|
||||
if _project != nil {
|
||||
if _p, ok := _project.(*jsonutils.JSONArray); ok {
|
||||
projects = _p.GetStringArray()
|
||||
}
|
||||
}
|
||||
|
||||
if _role != nil {
|
||||
if _r, ok := _role.(*jsonutils.JSONArray); ok {
|
||||
roles = _r.GetStringArray()
|
||||
}
|
||||
}
|
||||
|
||||
if len(projects) > 0 && len(roles) > 0 {
|
||||
var projectG errgroup.Group
|
||||
|
||||
|
||||
Reference in New Issue
Block a user