Returned multi user list in tenant created modal (#718)
Signed-off-by: Benjamin Perez <benjamin@bexsoft.net>
This commit is contained in:
@@ -767,6 +767,7 @@ func getTenantCreatedResponse(session *models.Principal, params admin_api.Create
|
||||
// optionals are set below
|
||||
var tenantUserAccessKey string
|
||||
var tenantUserSecretKey string
|
||||
keyElementEmpty := len(tenantReq.Idp.Keys) == 1 && (*tenantReq.Idp.Keys[0].AccessKey == "" && *tenantReq.Idp.Keys[0].SecretKey == "")
|
||||
|
||||
enableConsole := true
|
||||
if tenantReq.EnableConsole != nil && *tenantReq.EnableConsole {
|
||||
@@ -775,7 +776,7 @@ func getTenantCreatedResponse(session *models.Principal, params admin_api.Create
|
||||
|
||||
if enableConsole {
|
||||
// provision initial user for tenant
|
||||
if !(len(tenantReq.Idp.Keys) > 0) {
|
||||
if len(tenantReq.Idp.Keys) == 0 || keyElementEmpty {
|
||||
tenantUserAccessKey = RandomCharString(16)
|
||||
tenantUserSecretKey = RandomCharString(32)
|
||||
consoleUserSecretName := fmt.Sprintf("%s-user-secret", tenantName)
|
||||
@@ -1055,10 +1056,17 @@ func getTenantCreatedResponse(session *models.Principal, params admin_api.Create
|
||||
response = &models.CreateTenantResponse{}
|
||||
// Attach Console Credentials
|
||||
if enableConsole {
|
||||
response.Console = &models.CreateTenantResponseConsole{
|
||||
AccessKey: tenantUserAccessKey,
|
||||
SecretKey: tenantUserSecretKey,
|
||||
var itemsToReturn []*models.TenantResponseItem
|
||||
|
||||
if len(tenantReq.Idp.Keys) == 0 || keyElementEmpty {
|
||||
itemsToReturn = append(itemsToReturn, &models.TenantResponseItem{AccessKey: tenantUserAccessKey, SecretKey: tenantUserSecretKey})
|
||||
} else { // IDP Keys
|
||||
for _, item := range tenantReq.Idp.Keys {
|
||||
itemsToReturn = append(itemsToReturn, &models.TenantResponseItem{AccessKey: *item.AccessKey, SecretKey: *item.SecretKey})
|
||||
}
|
||||
}
|
||||
|
||||
response.Console = itemsToReturn
|
||||
}
|
||||
return response, nil
|
||||
}
|
||||
|
||||
@@ -4330,14 +4330,9 @@ func init() {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"console": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"access_key": {
|
||||
"type": "string"
|
||||
},
|
||||
"secret_key": {
|
||||
"type": "string"
|
||||
}
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "#/definitions/tenantResponseItem"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -6337,6 +6332,17 @@ func init() {
|
||||
}
|
||||
}
|
||||
},
|
||||
"tenantResponseItem": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"access_key": {
|
||||
"type": "string"
|
||||
},
|
||||
"secret_key": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"tenantUsage": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
@@ -10463,17 +10469,6 @@ func init() {
|
||||
}
|
||||
}
|
||||
},
|
||||
"CreateTenantResponseConsole": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"access_key": {
|
||||
"type": "string"
|
||||
},
|
||||
"secret_key": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"GcpConfigurationSecretmanager": {
|
||||
"type": "object",
|
||||
"required": [
|
||||
@@ -11668,14 +11663,9 @@ func init() {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"console": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"access_key": {
|
||||
"type": "string"
|
||||
},
|
||||
"secret_key": {
|
||||
"type": "string"
|
||||
}
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "#/definitions/tenantResponseItem"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -13528,6 +13518,17 @@ func init() {
|
||||
}
|
||||
}
|
||||
},
|
||||
"tenantResponseItem": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"access_key": {
|
||||
"type": "string"
|
||||
},
|
||||
"secret_key": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"tenantUsage": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
|
||||
Reference in New Issue
Block a user