You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
with the new interfaces in ./bmc, In order to update an existing user's name, the client would need to call a combination of CreateUser and DeleteUser. I propose we add a helper function in user.go to handle this for the client.
I think the code below will cover it. I just need to do and add some tests and then I'll open a PR. Also, trying to get better at creating an issue before a PR :)
// UpdateUserNameFromInterfaces is a helper function that will update a user's name by calling delete and createfuncUpdateUserNameFromInterfaces(ctx context.Context, currentUsername, newUsername, pass, rolestring, generic []interface{}) (okbool, errerror) {
ok, err=CreateUserFromInterfaces(ctx, newUsername, pass, role, generic)
iferr!=nil {
returnfalse, err
}
if!ok {
returnfalse, fmt.Errorf("updating username was NOT successful: creating user: %v, failed: reason unknown", newUsername)
}
ok, err=DeleteUserFromInterfaces(ctx, currentUsername, generic)
iferr!=nil {
ok, err=DeleteUserFromInterfaces(ctx, newUsername, generic)
iferr!=nil {
returnfalse, multierror.Append(err, err)
}
if!ok {
err=multierror.Append(err, fmt.Errorf("updating username was NOT successful: delete newly created user: %v, failed: reason unknown", newUsername))
}
returnfalse, err
}
if!ok {
returnfalse, fmt.Errorf("updating username was NOT successful: delete user: %v, failed: reason unknown", currentUsername)
}
returnok, nil
}
The text was updated successfully, but these errors were encountered:
with the new interfaces in ./bmc, In order to update an existing user's name, the client would need to call a combination of
CreateUser
andDeleteUser
. I propose we add a helper function in user.go to handle this for the client.I think the code below will cover it. I just need to do and add some tests and then I'll open a PR. Also, trying to get better at creating an issue before a PR :)
The text was updated successfully, but these errors were encountered: