|
|
|
|
@ -57,7 +57,7 @@ import {
|
|
|
|
|
import { DeviceDetectorService } from 'ngx-device-detector';
|
|
|
|
|
import { NgxSkeletonLoaderModule } from 'ngx-skeleton-loader';
|
|
|
|
|
import { Subject } from 'rxjs';
|
|
|
|
|
import { takeUntil } from 'rxjs/operators';
|
|
|
|
|
import { switchMap, takeUntil, tap } from 'rxjs/operators';
|
|
|
|
|
|
|
|
|
|
@Component({
|
|
|
|
|
imports: [
|
|
|
|
|
@ -139,8 +139,25 @@ export class GfAdminUsersComponent implements OnDestroy, OnInit {
|
|
|
|
|
];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
this.route.paramMap
|
|
|
|
|
.pipe(takeUntil(this.unsubscribeSubject))
|
|
|
|
|
this.userService.stateChanged
|
|
|
|
|
.pipe(
|
|
|
|
|
takeUntil(this.unsubscribeSubject),
|
|
|
|
|
tap((state) => {
|
|
|
|
|
if (state?.user) {
|
|
|
|
|
this.user = state.user;
|
|
|
|
|
|
|
|
|
|
this.defaultDateFormat = getDateFormatString(
|
|
|
|
|
this.user.settings.locale
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
this.hasPermissionToImpersonateAllUsers = hasPermission(
|
|
|
|
|
this.user.permissions,
|
|
|
|
|
permissions.impersonateAllUsers
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
}),
|
|
|
|
|
switchMap(() => this.route.paramMap)
|
|
|
|
|
)
|
|
|
|
|
.subscribe((params) => {
|
|
|
|
|
const userId = params.get('userId');
|
|
|
|
|
|
|
|
|
|
@ -149,23 +166,6 @@ export class GfAdminUsersComponent implements OnDestroy, OnInit {
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
this.userService.stateChanged
|
|
|
|
|
.pipe(takeUntil(this.unsubscribeSubject))
|
|
|
|
|
.subscribe((state) => {
|
|
|
|
|
if (state?.user) {
|
|
|
|
|
this.user = state.user;
|
|
|
|
|
|
|
|
|
|
this.defaultDateFormat = getDateFormatString(
|
|
|
|
|
this.user.settings.locale
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
this.hasPermissionToImpersonateAllUsers = hasPermission(
|
|
|
|
|
this.user.permissions,
|
|
|
|
|
permissions.impersonateAllUsers
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
addIcons({
|
|
|
|
|
contractOutline,
|
|
|
|
|
ellipsisHorizontal,
|
|
|
|
|
@ -208,10 +208,13 @@ export class GfAdminUsersComponent implements OnDestroy, OnInit {
|
|
|
|
|
.deleteUser(aId)
|
|
|
|
|
.pipe(takeUntil(this.unsubscribeSubject))
|
|
|
|
|
.subscribe(() => {
|
|
|
|
|
this.fetchUsers();
|
|
|
|
|
this.router.navigate(['..'], { relativeTo: this.route });
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
confirmType: ConfirmationDialogType.Warn,
|
|
|
|
|
discardFn: () => {
|
|
|
|
|
this.router.navigate(['..'], { relativeTo: this.route });
|
|
|
|
|
},
|
|
|
|
|
title: $localize`Do you really want to delete this user?`
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
@ -293,6 +296,7 @@ export class GfAdminUsersComponent implements OnDestroy, OnInit {
|
|
|
|
|
>(GfUserDetailDialogComponent, {
|
|
|
|
|
autoFocus: false,
|
|
|
|
|
data: {
|
|
|
|
|
currentUserId: this.user?.id,
|
|
|
|
|
deviceType: this.deviceType,
|
|
|
|
|
hasPermissionForSubscription: this.hasPermissionForSubscription,
|
|
|
|
|
locale: this.user?.settings?.locale,
|
|
|
|
|
@ -305,10 +309,14 @@ export class GfAdminUsersComponent implements OnDestroy, OnInit {
|
|
|
|
|
dialogRef
|
|
|
|
|
.afterClosed()
|
|
|
|
|
.pipe(takeUntil(this.unsubscribeSubject))
|
|
|
|
|
.subscribe(() => {
|
|
|
|
|
this.router.navigate(
|
|
|
|
|
internalRoutes.adminControl.subRoutes.users.routerLink
|
|
|
|
|
);
|
|
|
|
|
.subscribe((data) => {
|
|
|
|
|
if (data?.action === 'delete' && data?.userId) {
|
|
|
|
|
this.onDeleteUser(data.userId);
|
|
|
|
|
} else {
|
|
|
|
|
this.router.navigate(
|
|
|
|
|
internalRoutes.adminControl.subRoutes.users.routerLink
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|