Skip to content

Commit

Permalink
Merge pull request #252 from zilliztech/fix-role-update
Browse files Browse the repository at this point in the history
this fix #251
  • Loading branch information
shanghaikid authored Aug 28, 2023
2 parents c17b44b + 273b4d9 commit 93b62fa
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
6 changes: 5 additions & 1 deletion client/src/pages/user/Roles.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,11 @@ const Roles = () => {

const onUpdate = async (data: { isEditing: boolean }) => {
fetchRoles();
openSnackBar(successTrans('create', { name: userTrans('role') }));
openSnackBar(
successTrans(data.isEditing ? 'update' : 'create', {
name: userTrans('role'),
})
);
handleCloseDialog();
};

Expand Down
4 changes: 3 additions & 1 deletion client/src/pages/user/UpdateRoleDialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,9 @@ const UpdateRoleDialog: FC<CreateRoleProps> = ({
};

const onChange = (newSelection: any) => {
setForm(v => ({ ...v, privileges: [...newSelection] }));
setForm(v => {
return { ...v, privileges: [...newSelection] };
});
};

const optionGroups: PrivilegeOptionsProps[] = [
Expand Down
2 changes: 1 addition & 1 deletion server/src/users/users.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ export class UserController {

try {
// revoke all
this.userService.revokeAllRolePrivileges({ roleName });
await this.userService.revokeAllRolePrivileges({ roleName });

// assign new user roles
for (let i = 0; i < privileges.length; i++) {
Expand Down

0 comments on commit 93b62fa

Please sign in to comment.