SUPPORT-9123:fix remove-roles
This commit is contained in:
parent
555898da68
commit
204464bde2
2 changed files with 21 additions and 13 deletions
|
|
@ -38,8 +38,8 @@ public class RoleServiceImpl extends AbstractUserDataService {
|
|||
public List<String> fetchRemovedRoleIds(String accountId, Set<String> newRoleIds) {
|
||||
try {
|
||||
return fetchRolesByAccountId(accountId).stream()
|
||||
.filter(role -> role.isErvuRole() && !newRoleIds.contains(role.getId()))
|
||||
.map(Role::getId)
|
||||
.filter(id -> !newRoleIds.contains(id))
|
||||
.toList();
|
||||
}
|
||||
catch (Exception e) {
|
||||
|
|
|
|||
|
|
@ -48,15 +48,16 @@ export class UserManagementService extends Behavior {
|
|||
private onClickFunction: Function;
|
||||
private sendToErvu: boolean = false;
|
||||
private rpc: UserApplicationListRpcService;
|
||||
private authService: AuthorizationService;
|
||||
|
||||
initialize() {
|
||||
super.initialize();
|
||||
this.button = this.getScript(SaveButton);
|
||||
this.httpClient = this.injector.get(HttpClient);
|
||||
this.rpc = this.getScript(UserApplicationListRpcService);
|
||||
let authService = this.injector.get(AuthorizationService);
|
||||
this.authService = this.injector.get(AuthorizationService);
|
||||
this.onClickFunction = () => {
|
||||
if (!authService.hasRole('security_administrator') || !this.sendToErvu) {
|
||||
if (!this.authService.hasRole('security_administrator') || !this.sendToErvu) {
|
||||
return;
|
||||
}
|
||||
let kind = this.applicationKind.getValue();
|
||||
|
|
@ -79,6 +80,7 @@ export class UserManagementService extends Behavior {
|
|||
request = new CreateAccountRequest();
|
||||
request.data = createData;
|
||||
request.processKey = ProcessKey.CREATE;
|
||||
this.doRequest(request, formJson['appNumber']);
|
||||
break;
|
||||
case ApplicationKind.EDIT_USER_MAIN:
|
||||
let editPersonData = new EditPersonData();
|
||||
|
|
@ -87,6 +89,7 @@ export class UserManagementService extends Behavior {
|
|||
request = new EditPersonRequest();
|
||||
request.data = editPersonData;
|
||||
request.processKey = ProcessKey.EDIT_PERSON;
|
||||
this.doRequest(request, formJson['appNumber']);
|
||||
break;
|
||||
case ApplicationKind.EDIT_USER_ACCOUNT:
|
||||
let editAccountData = new EditAccountData();
|
||||
|
|
@ -96,6 +99,7 @@ export class UserManagementService extends Behavior {
|
|||
request = new EditAccountRequest();
|
||||
request.data = editAccountData;
|
||||
request.processKey = ProcessKey.EDIT_ACCOUNT;
|
||||
this.doRequest(request, formJson['appNumber']);
|
||||
break;
|
||||
case ApplicationKind.EDIT_USER_ROLES:
|
||||
let editRolesAccount = new EditRolesAccount();
|
||||
|
|
@ -108,12 +112,15 @@ export class UserManagementService extends Behavior {
|
|||
return role;
|
||||
});
|
||||
this.rpc.getRemovedRoleIds(accountId, rolesList)
|
||||
.then(list => editRolesAccount.removeRoles = list);
|
||||
.then(list => {
|
||||
editRolesAccount.removeRoles = list;
|
||||
let editRolesData = new EditRolesData();
|
||||
editRolesData.account = editRolesAccount;
|
||||
request = new EditRolesRequest();
|
||||
request.data = editRolesData;
|
||||
request.processKey = ProcessKey.EDIT_ROLES;
|
||||
this.doRequest(request, formJson['appNumber']);
|
||||
});
|
||||
break;
|
||||
case ApplicationKind.BLOCK_USER:
|
||||
let deactivationData = new ChangeActivationData();
|
||||
|
|
@ -121,6 +128,7 @@ export class UserManagementService extends Behavior {
|
|||
request = new ChangeActivationRequest();
|
||||
request.data = deactivationData;
|
||||
request.processKey = ProcessKey.DEACTIVATE;
|
||||
this.doRequest(request, formJson['appNumber']);
|
||||
break;
|
||||
case ApplicationKind.UNBLOCK_USER:
|
||||
let activationData = new ChangeActivationData();
|
||||
|
|
@ -128,6 +136,7 @@ export class UserManagementService extends Behavior {
|
|||
request = new ChangeActivationRequest();
|
||||
request.data = activationData;
|
||||
request.processKey = ProcessKey.ACTIVATE;
|
||||
this.doRequest(request, formJson['appNumber']);
|
||||
break;
|
||||
case ApplicationKind.RESET_PASSWORD:
|
||||
let resetPasswordAccount = new ResetPasswordAccount();
|
||||
|
|
@ -137,12 +146,10 @@ export class UserManagementService extends Behavior {
|
|||
request = new ResetPasswordRequest();
|
||||
request.data = resetPasswordData;
|
||||
request.processKey = ProcessKey.RESET_PASSWORD;
|
||||
this.doRequest(request, formJson['appNumber']);
|
||||
break;
|
||||
}
|
||||
|
||||
request.userId = authService.getUserId();
|
||||
this.doRequest(request, formJson['appNumber']);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@Visible()
|
||||
|
|
@ -171,6 +178,7 @@ export class UserManagementService extends Behavior {
|
|||
|
||||
private doRequest(request: any, appNumber: number): void {
|
||||
const url = window.location.origin + UserManagementService.PROCESS_START_PATH;
|
||||
request.userId = this.authService.getUserId();
|
||||
this.httpClient.post(url, request).toPromise()
|
||||
.then((response: ProcessResponse) => {
|
||||
let code = response.code;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue