#616 added modal on icon click (#747)

* Added refresh tenant functionality

add icon to Users page to change password

commit work to date to github for ongoing use

add modal with fields for current and new password on icon click

missing swagger files

remove unneeded files

move changeUserPassword to admin_api, remove field for current password,
include selected user

Please enter the commit message for your changes. Lines starting

added missing js files

asset and function signature

formatting changes

* fixed lint

* removed Current Password field, returned Groups label, added
selectedUser to modal text

* disabled save button if newPasssword and reNewPassword don't match, removed commented out code

* Added refresh tenant functionality

add icon to Users page to change password

commit work to date to github for ongoing use

add modal with fields for current and new password on icon click

missing swagger files

remove unneeded files

move changeUserPassword to admin_api, remove field for current password,
include selected user

Please enter the commit message for your changes. Lines starting

added missing js files

asset and function signature

formatting changes

* removed Current Password field, returned Groups label, added
selectedUser to modal text

* changed Swagger parameters to camel case

Co-authored-by: Jill <jill@minio.io>
This commit is contained in:
jinapurapu
2021-06-03 15:32:22 -07:00
committed by GitHub
parent f18360416b
commit a9e82eb909
18 changed files with 1163 additions and 31 deletions

View File

@@ -107,6 +107,14 @@ func registerUsersHandlers(api *operations.ConsoleAPI) {
}
return admin_api.NewListUsersWithAccessToBucketOK().WithPayload(response)
})
// Change User Password
api.AdminAPIChangeUserPasswordHandler = admin_api.ChangeUserPasswordHandlerFunc(func(params admin_api.ChangeUserPasswordParams, session *models.Principal) middleware.Responder {
err := getChangeUserPasswordResponse(session, params)
if err != nil {
return admin_api.NewChangeUserPasswordDefault(int(err.Code)).WithPayload(err)
}
return admin_api.NewChangeUserPasswordCreated()
})
}
func listUsers(ctx context.Context, client MinioAdmin) ([]*models.User, error) {
@@ -584,3 +592,33 @@ func listUsersWithAccessToBucket(ctx context.Context, adminClient MinioAdmin, bu
sort.Strings(retval)
return retval, nil
}
// changeUserPassword changes password of selectedUser to newSecretKey
func changeUserPassword(ctx context.Context, client MinioAdmin, selectedUser string, newSecretKey string) error {
if err := client.changePassword(ctx, selectedUser, newSecretKey); err != nil {
return err
}
return nil
}
// getChangeUserPasswordResponse will change the password of selctedUser to newSecretKey
func getChangeUserPasswordResponse(session *models.Principal, params admin_api.ChangeUserPasswordParams) *models.Error {
ctx := context.Background()
mAdmin, err := newMAdminClient(session)
if err != nil {
return prepareError(err)
}
// create a minioClient interface implementation
// defining the client to be used
adminClient := adminClient{client: mAdmin}
// params will contain selectedUser and newSecretKey credentials for the user
user := *params.Body.SelectedUser
newSecretKey := *params.Body.NewSecretKey
// changes password of user to newSecretKey
if err := changeUserPassword(ctx, adminClient, user, newSecretKey); err != nil {
return prepareError(err)
}
return nil
}