RED-4963 - called new endpoint to enable/disable user
This commit is contained in:
parent
19b4e93195
commit
93182a1706
@ -52,7 +52,7 @@
|
|||||||
<div class="center cell">
|
<div class="center cell">
|
||||||
<mat-slide-toggle
|
<mat-slide-toggle
|
||||||
(toggleChange)="toggleActive(user)"
|
(toggleChange)="toggleActive(user)"
|
||||||
[checked]="user.hasAnyRole"
|
[checked]="user.active"
|
||||||
[disabled]="!canDeactivate(user)"
|
[disabled]="!canDeactivate(user)"
|
||||||
color="primary"
|
color="primary"
|
||||||
></mat-slide-toggle>
|
></mat-slide-toggle>
|
||||||
|
|||||||
@ -109,8 +109,7 @@ export class UserListingScreenComponent extends ListingComponent<User> implement
|
|||||||
|
|
||||||
async toggleActive(user: User) {
|
async toggleActive(user: User) {
|
||||||
this._loadingService.start();
|
this._loadingService.start();
|
||||||
const requestBody = { ...user, roles: user.hasAnyRole ? [] : ['RED_USER'] };
|
await firstValueFrom(this._userService.toggleStatus(user));
|
||||||
await firstValueFrom(this._userService.updateProfile(requestBody, user.id));
|
|
||||||
await this.#loadData();
|
await this.#loadData();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
import { inject, Injectable } from '@angular/core';
|
import { inject, Injectable } from '@angular/core';
|
||||||
import { User } from '@red/domain';
|
import { User } from '@red/domain';
|
||||||
import { IIqserUser, IqserUserService } from '@iqser/common-ui';
|
import { IIqserUser, IqserUserService, List, QueryParam } from '@iqser/common-ui';
|
||||||
|
|
||||||
@Injectable({
|
@Injectable({
|
||||||
providedIn: 'root',
|
providedIn: 'root',
|
||||||
@ -28,6 +28,11 @@ export class UserService extends IqserUserService<IIqserUser, User> {
|
|||||||
return super.getAll(url);
|
return super.getAll(url);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
toggleStatus(user: User) {
|
||||||
|
const queryParams: List<QueryParam> = [{ key: 'isActive', value: !user.active }];
|
||||||
|
return this._post(null, `${this._defaultModelPath}/profile/activate/${user.userId}`, queryParams);
|
||||||
|
}
|
||||||
|
|
||||||
protected readonly _rolesFilter = (role: string) => role.startsWith('RED_');
|
protected readonly _rolesFilter = (role: string) => role.startsWith('RED_');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -1 +1 @@
|
|||||||
Subproject commit 7d55373093eeb3301487998fd6a34487d8fc5101
|
Subproject commit 2698e62e41a75d0515d6e17ce16dc0a519ee7e3b
|
||||||
Loading…
x
Reference in New Issue
Block a user