feat:
* PR suggested changes
This commit is contained in:
parent
d8b9ffe9ce
commit
7bcd5a70c3
|
@ -328,13 +328,12 @@ func UpdateEnvResolver(ctx context.Context, params model.UpdateEnvInput) (*model
|
||||||
}
|
}
|
||||||
|
|
||||||
previousRoles := strings.Split(currentData[constants.EnvKeyRoles].(string), ",")
|
previousRoles := strings.Split(currentData[constants.EnvKeyRoles].(string), ",")
|
||||||
|
previousProtectedRoles := strings.Split(currentData[constants.EnvKeyProtectedRoles].(string), ",")
|
||||||
updatedRoles := strings.Split(updatedData[constants.EnvKeyRoles].(string), ",")
|
updatedRoles := strings.Split(updatedData[constants.EnvKeyRoles].(string), ",")
|
||||||
updatedDefaultRoles := strings.Split(updatedData[constants.EnvKeyDefaultRoles].(string), ",")
|
updatedDefaultRoles := strings.Split(updatedData[constants.EnvKeyDefaultRoles].(string), ",")
|
||||||
updatedProtectedRoles := strings.Split(updatedData[constants.EnvKeyProtectedRoles].(string), ",")
|
updatedProtectedRoles := strings.Split(updatedData[constants.EnvKeyProtectedRoles].(string), ",")
|
||||||
|
|
||||||
// check the roles change
|
// check the roles change
|
||||||
if len(updatedRoles) > 0 {
|
if len(updatedRoles) > 0 && len(updatedDefaultRoles) > 0 {
|
||||||
if len(updatedDefaultRoles) > 0 {
|
|
||||||
// should be subset of roles
|
// should be subset of roles
|
||||||
for _, role := range updatedDefaultRoles {
|
for _, role := range updatedDefaultRoles {
|
||||||
if !utils.StringSliceContains(updatedRoles, role) {
|
if !utils.StringSliceContains(updatedRoles, role) {
|
||||||
|
@ -343,7 +342,6 @@ func UpdateEnvResolver(ctx context.Context, params model.UpdateEnvInput) (*model
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if len(updatedProtectedRoles) > 0 {
|
if len(updatedProtectedRoles) > 0 {
|
||||||
for _, role := range updatedProtectedRoles {
|
for _, role := range updatedProtectedRoles {
|
||||||
|
@ -359,6 +357,11 @@ func UpdateEnvResolver(ctx context.Context, params model.UpdateEnvInput) (*model
|
||||||
go updateRoles(ctx, deletedRoles)
|
go updateRoles(ctx, deletedRoles)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
deletedProtectedRoles := utils.FindDeletedValues(previousProtectedRoles, updatedProtectedRoles)
|
||||||
|
if len(deletedProtectedRoles) > 0 {
|
||||||
|
go updateRoles(ctx, deletedProtectedRoles)
|
||||||
|
}
|
||||||
|
|
||||||
// Update local store
|
// Update local store
|
||||||
memorystore.Provider.UpdateEnvStore(updatedData)
|
memorystore.Provider.UpdateEnvStore(updatedData)
|
||||||
jwk, err := crypto.GenerateJWKBasedOnEnv()
|
jwk, err := crypto.GenerateJWKBasedOnEnv()
|
||||||
|
|
Loading…
Reference in New Issue
Block a user