@neohm/nestend 3.3.1 → 3.3.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +100 -3
- package/dist/admin/controllers/admin.system.user.controller.d.ts +24 -0
- package/dist/admin/controllers/admin.system.user.controller.d.ts.map +1 -0
- package/dist/admin/controllers/admin.system.user.controller.js +107 -0
- package/dist/admin/controllers/admin.system.user.controller.js.map +1 -0
- package/dist/admin/dtos/add.system.user.dto.d.ts +5 -0
- package/dist/admin/dtos/add.system.user.dto.d.ts.map +1 -0
- package/dist/admin/dtos/add.system.user.dto.js +28 -0
- package/dist/admin/dtos/add.system.user.dto.js.map +1 -0
- package/dist/admin/dtos/system.user.list.dto.d.ts +4 -0
- package/dist/admin/dtos/system.user.list.dto.d.ts.map +1 -0
- package/dist/admin/dtos/system.user.list.dto.js +8 -0
- package/dist/admin/dtos/system.user.list.dto.js.map +1 -0
- package/dist/admin/es6.classes.d.ts +7 -3
- package/dist/admin/es6.classes.d.ts.map +1 -1
- package/dist/admin/es6.classes.js +12 -1
- package/dist/admin/es6.classes.js.map +1 -1
- package/dist/admin/libraries/system.user.data.processor.d.ts +12 -0
- package/dist/admin/libraries/system.user.data.processor.d.ts.map +1 -0
- package/dist/admin/libraries/system.user.data.processor.js +69 -0
- package/dist/admin/libraries/system.user.data.processor.js.map +1 -0
- package/dist/admin/libraries/system.user.list.processor.d.ts +15 -0
- package/dist/admin/libraries/system.user.list.processor.d.ts.map +1 -0
- package/dist/admin/libraries/system.user.list.processor.js +50 -0
- package/dist/admin/libraries/system.user.list.processor.js.map +1 -0
- package/dist/admin/services/system.user.service.d.ts +6 -0
- package/dist/admin/services/system.user.service.d.ts.map +1 -0
- package/dist/admin/services/system.user.service.js +34 -0
- package/dist/admin/services/system.user.service.js.map +1 -0
- package/dist/auth/auth.module.d.ts.map +1 -1
- package/dist/auth/auth.module.js +12 -1
- package/dist/auth/auth.module.js.map +1 -1
- package/dist/auth/controllers/auth.controller.d.ts.map +1 -1
- package/dist/auth/controllers/auth.controller.js +2 -0
- package/dist/auth/controllers/auth.controller.js.map +1 -1
- package/dist/auth/controllers/impersonation.controller.d.ts +13 -0
- package/dist/auth/controllers/impersonation.controller.d.ts.map +1 -0
- package/dist/auth/controllers/impersonation.controller.js +66 -0
- package/dist/auth/controllers/impersonation.controller.js.map +1 -0
- package/dist/auth/dtos/impersonation.login.dto.d.ts +5 -0
- package/dist/auth/dtos/impersonation.login.dto.d.ts.map +1 -0
- package/dist/auth/dtos/impersonation.login.dto.js +25 -0
- package/dist/auth/dtos/impersonation.login.dto.js.map +1 -0
- package/dist/auth/entities/system.auth.session.entity.d.ts +1 -0
- package/dist/auth/entities/system.auth.session.entity.d.ts.map +1 -1
- package/dist/auth/entities/system.auth.session.entity.js +4 -0
- package/dist/auth/entities/system.auth.session.entity.js.map +1 -1
- package/dist/auth/entities/system.refresh.token.entity.d.ts +1 -0
- package/dist/auth/entities/system.refresh.token.entity.d.ts.map +1 -1
- package/dist/auth/entities/system.refresh.token.entity.js +4 -0
- package/dist/auth/entities/system.refresh.token.entity.js.map +1 -1
- package/dist/auth/entities/user.entity.d.ts +1 -0
- package/dist/auth/entities/user.entity.d.ts.map +1 -1
- package/dist/auth/entities/user.entity.js +4 -0
- package/dist/auth/entities/user.entity.js.map +1 -1
- package/dist/auth/es6.classes.d.ts +4 -2
- package/dist/auth/es6.classes.d.ts.map +1 -1
- package/dist/auth/es6.classes.js +6 -1
- package/dist/auth/es6.classes.js.map +1 -1
- package/dist/auth/helpers/auth.d.ts +3 -1
- package/dist/auth/helpers/auth.d.ts.map +1 -1
- package/dist/auth/helpers/auth.js +10 -2
- package/dist/auth/helpers/auth.js.map +1 -1
- package/dist/auth/middlewares/jwt.middleware.d.ts.map +1 -1
- package/dist/auth/middlewares/jwt.middleware.js +1 -1
- package/dist/auth/middlewares/jwt.middleware.js.map +1 -1
- package/dist/auth/services/auth.service.d.ts +2 -0
- package/dist/auth/services/auth.service.d.ts.map +1 -1
- package/dist/auth/services/auth.service.js +26 -4
- package/dist/auth/services/auth.service.js.map +1 -1
- package/dist/auth/services/impersonation.service.d.ts +20 -0
- package/dist/auth/services/impersonation.service.d.ts.map +1 -0
- package/dist/auth/services/impersonation.service.js +89 -0
- package/dist/auth/services/impersonation.service.js.map +1 -0
- package/dist/auth/types/auth.types.d.ts +7 -0
- package/dist/auth/types/auth.types.d.ts.map +1 -1
- package/dist/common/enums/audit.action.enum.d.ts +1 -0
- package/dist/common/enums/audit.action.enum.d.ts.map +1 -1
- package/dist/common/enums/audit.action.enum.js +1 -0
- package/dist/common/enums/audit.action.enum.js.map +1 -1
- package/dist/common/jobs/dispatch.scheduled.event.job.d.ts +2 -0
- package/dist/common/jobs/dispatch.scheduled.event.job.d.ts.map +1 -1
- package/dist/common/jobs/dispatch.scheduled.event.job.js +19 -6
- package/dist/common/jobs/dispatch.scheduled.event.job.js.map +1 -1
- package/dist/document/document.module.d.ts.map +1 -1
- package/dist/document/document.module.js +3 -1
- package/dist/document/document.module.js.map +1 -1
- package/dist/document/enums/pdf.default.enum.d.ts +10 -0
- package/dist/document/enums/pdf.default.enum.d.ts.map +1 -0
- package/dist/document/enums/pdf.default.enum.js +15 -0
- package/dist/document/enums/pdf.default.enum.js.map +1 -0
- package/dist/document/es6.classes.d.ts +2 -1
- package/dist/document/es6.classes.d.ts.map +1 -1
- package/dist/document/es6.classes.js +2 -0
- package/dist/document/es6.classes.js.map +1 -1
- package/dist/document/services/pdf.service.d.ts +21 -0
- package/dist/document/services/pdf.service.d.ts.map +1 -0
- package/dist/document/services/pdf.service.js +168 -0
- package/dist/document/services/pdf.service.js.map +1 -0
- package/dist/document/types/pdf.types.d.ts +41 -0
- package/dist/document/types/pdf.types.d.ts.map +1 -0
- package/dist/document/types/pdf.types.js +3 -0
- package/dist/document/types/pdf.types.js.map +1 -0
- package/dist/global/utilities/schedule.utility.d.ts +1 -0
- package/dist/global/utilities/schedule.utility.d.ts.map +1 -1
- package/dist/global/utilities/schedule.utility.js +3 -0
- package/dist/global/utilities/schedule.utility.js.map +1 -1
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +7 -2
- package/dist/index.js.map +1 -1
- package/dist/migrations/1749600000003.CreateSysUsersTable.d.ts.map +1 -1
- package/dist/migrations/1749600000003.CreateSysUsersTable.js +1 -0
- package/dist/migrations/1749600000003.CreateSysUsersTable.js.map +1 -1
- package/dist/migrations/1749600000014.CreateSysRefreshTokensTable.d.ts.map +1 -1
- package/dist/migrations/1749600000014.CreateSysRefreshTokensTable.js +7 -0
- package/dist/migrations/1749600000014.CreateSysRefreshTokensTable.js.map +1 -1
- package/dist/migrations/1749600000024.CreateSysAuthSessionsTable.d.ts.map +1 -1
- package/dist/migrations/1749600000024.CreateSysAuthSessionsTable.js +7 -0
- package/dist/migrations/1749600000024.CreateSysAuthSessionsTable.js.map +1 -1
- package/package.json +6 -2
package/README.md
CHANGED
|
@@ -91,7 +91,8 @@ the notification and document modules.
|
|
|
91
91
|
|
|
92
92
|
Internal by design: the controllers, DTOs and processors behind the built-in endpoints
|
|
93
93
|
(the whole `admin` module beyond `AdminModule` itself, `AuthController`,
|
|
94
|
-
`AdminAuthController`
|
|
94
|
+
`AdminAuthController`, `ImpersonationController` and `ImpersonationService`), the
|
|
95
|
+
passport strategies, `JobConsumer` and the framework
|
|
95
96
|
jobs/subscribers/schedule resolvers, the `FILTER_OPERATORS` registry, the internal
|
|
96
97
|
`*Default` enums, and the migration classes. Import the module and call the endpoints —
|
|
97
98
|
these are free to change without a breaking release.
|
|
@@ -104,12 +105,12 @@ these are free to change without a breaking release.
|
|
|
104
105
|
| Migrations | `MigrationUtility`, `SeederUtility` (the 26 table migrations ship in `dist/migrations` — glob them, they are not barrel exports) | fluent `this.string()`, `this.numeric()`, `addRecord()` seeding |
|
|
105
106
|
| Queue | `QueueModule`, `QueueService`, `CommonJob` | BullMQ `@Processor`/`WorkerHost` consumer; auto-discovered jobs, duplicate prevention, recurring schedulers, 1-day TTL, retries, failures persisted to `sys_failed_jobs` |
|
|
106
107
|
| Scheduled events | `SystemScheduledTaskEntity`, `ScheduledEventEntity`, `ScheduleKind`, `ScheduleSpec`, `IsCronExpression` | schedule definitions in `sys_scheduled_tasks` → events in `sys_scheduled_events`; interval / cron / once specs with timezones, drift-free slots, horizon materialisation, catch-up + overlap policies, fire-once dispatch with backoff, cadence via `SCHEDULED_EVENT_MIN` |
|
|
107
|
-
| Auth | `AuthModule`, `AuthService.validateRole()`, `Auth`, `JwtMiddleware` | imperative auth (open by default); JwtMiddleware resolves the user into `Auth`'s AsyncLocalStorage context per request; access + rotating refresh tokens; session-based logout invalidation (`sys_auth_sessions`); Google SSO via ID token at `POST /auth/google` |
|
|
108
|
+
| Auth | `AuthModule`, `AuthService.validateRole()`, `Auth`, `JwtMiddleware` | imperative auth (open by default); JwtMiddleware resolves the user into `Auth`'s AsyncLocalStorage context per request; access + rotating refresh tokens; session-based logout invalidation (`sys_auth_sessions`); Google SSO via ID token at `POST /auth/google`; impersonation — a tenantless `has_global_access` user signs into one organization at `POST /auth/impersonation/login` |
|
|
108
109
|
| Admin auth | `AdminAuthService.validateRole()`, `AdminAuth`, `AdminJwtMiddleware` (endpoints at `/admin/auth`) | fully separate stack for back-office admins — own users table (`sys_admin_users`), own roles (`sys_admin_roles`/`sys_auser_roles`), own sessions/refresh tokens (shared tables, `is_admin` flag) |
|
|
109
110
|
| API keys | `ApiKeyService`, `ApiKeyGuard` / `ApiKeyMiddleware`, `@ApiKeyScopes()`, `ApiKeyContext` | hashed keys in `sys_api_keys` (admin-owned), one tenant per key, expiry/revocation, `x-api-key` header; `validateAccess(scope)` returns the tenant the key acts for |
|
|
110
111
|
| Scopes | `ScopeService`, `AuthService.validateAccess()`, `ScopeEntity`, `TenantScopeEntity`, `ApiScopeEntity` | one feature named once in `sys_scopes`, then granted per organization (`sys_tenant_scopes`) or per API key (`sys_api_scopes`) — never an array on the principal |
|
|
111
112
|
| Multi-tenancy | `TenantModule`, `TenantEntity`, `CommonTenantEntity`, `TenantContextService`, `TenantContextMiddleware` | AsyncLocalStorage tenant context; resolve by header, slug, or domain; tenants are onboarded by admins (`TenantEntity.creator` → `AdminUserEntity`) |
|
|
112
|
-
| Admin | `AdminModule` (its controllers, DTOs and processors are internal — import the module and hit the endpoints), `GlobalAdminRoles` | back-office APIs: tenant onboarding, client/admin user registration (single + bulk,
|
|
113
|
+
| Admin | `AdminModule` (its controllers, DTOs and processors are internal — import the module and hit the endpoints), `GlobalAdminRoles` | back-office APIs: tenant onboarding, client/admin/system user registration (single + bulk), the `has_global_access` grant that enables impersonation, tenant + scheduled-task listing; 4-tier `GlobalAdminRoles` gate over `sys_admin_roles`; Swagger at `/docs` (hidden in production) |
|
|
113
114
|
| Notifications | `NotificationModule`, `NotificationService`, `FcmPushNotificationService` | in-app rows + FCM push (optional `firebase-admin`); device token registry |
|
|
114
115
|
| Email (SES) | `EmailNotificationService`, `ProcessEmailNotification`, `EmailTemplateEntity`, `EmailNotificationLogEntity` | templates in `sys_email_templates` rendered by a remote service, dispatched via SES per recipient (to/cc/bcc); logged to `sys_email_notification_logs` outside production; dispatch skipped when `AWS_SES_FROM_ADDRESS` unset |
|
|
115
116
|
| Audit | `AuditService` | `saveAuditLog(old, new)` with changed-value diffing into `sys_audit_logs` |
|
|
@@ -118,6 +119,7 @@ these are free to change without a breaking release.
|
|
|
118
119
|
| Encryption | `EncryptionService` | AES-256-GCM, scrypt-derived keys |
|
|
119
120
|
| System properties | `SystemPropertyModule`, `SystemPropertyService` | cached + optionally encrypted key/value settings in `sys_properties` |
|
|
120
121
|
| Documents | `DocumentModule`, `DocumentService`, `S3BucketDocumentService`, `MinioBucketDocumentService` | `uploadDocument(multerFiles) → links[]`; driver chosen via `DOCUMENT_STORAGE_DRIVER` |
|
|
122
|
+
| PDF generation | `PdfService`, `PdfRenderOptions` | `renderHtmlToPdf(html) → Buffer` via headless Chromium; honours the document's own `@page` rules and paginates to any length; optional peer dep `puppeteer` |
|
|
121
123
|
| HTTP | `CommonController`, `GlobalExceptionFilter`, common DTOs | health endpoint base controller, uniform error envelope |
|
|
122
124
|
| Raw SQL | `SqlService`, `SqlTarget` | named `:key` placeholders always bound as driver params, `:...key` array expansion; runs on the read replica (`DB_READ_*`) with transparent primary fallback; `fetchOne`/`fetchScalar`/`exists`/`count`/`paginate` helpers |
|
|
123
125
|
| List endpoints | `CommonListProcessor`, `CommonListFilterDto`, `FilterDto`, `CommonListFilterConfig` | allowlisted columns, parameterised operators (`eq`…`isNull`), typed value casting (`str`/`num`/`date`/`bool`/`null`), multi-sort + paginated on the read replica |
|
|
@@ -206,6 +208,25 @@ and embeds its identifier in the access token as `sid`; `logout()` revokes the
|
|
|
206
208
|
refresh token and invalidates that session, so a still-unexpired access token
|
|
207
209
|
stops working immediately.
|
|
208
210
|
|
|
211
|
+
**Impersonation** — support staff work inside a customer's organization without
|
|
212
|
+
borrowing anyone's identity. The principal is a `sys_users` row with
|
|
213
|
+
`user_type = system.user`, no `tenant_id` and `has_global_access = true`; it
|
|
214
|
+
cannot use `POST /auth/login` at all, and signs in through `POST
|
|
215
|
+
/auth/impersonation/login` with `{ email, password, tenant_id }`. The assumed
|
|
216
|
+
organization is stored on the session row (and its refresh-token row, so a
|
|
217
|
+
rotation keeps it) and stamped onto the context user's `tenant_id` by
|
|
218
|
+
`JwtMiddleware`, so `validateAccess()` and every processor reading
|
|
219
|
+
`user.tenant_id` work unchanged. Because the token belongs to the real actor,
|
|
220
|
+
`created_by` records who actually did the work. Role assertions yield to the
|
|
221
|
+
grant — the account holds no roles inside the tenant — but scope checks never
|
|
222
|
+
do, so impersonation cannot reach a feature the organization was not sold.
|
|
223
|
+
`GET /auth/impersonation/tenants` lists the organizations available (also from an
|
|
224
|
+
impersonated session, for an in-app switcher), each login writes an
|
|
225
|
+
`AuditAction.IMPERSONATE` entry, and withdrawing the flag through
|
|
226
|
+
`POST /admin/system-users` revokes the sessions it opened. Distinguish an assumed
|
|
227
|
+
tenant from real membership with `Auth.isImpersonating()` /
|
|
228
|
+
`Auth.impersonatedTenant()`.
|
|
229
|
+
|
|
209
230
|
**Google SSO** — the client posts a Google ID token as `{ id_token }` to
|
|
210
231
|
`POST /auth/google`. `GoogleAuthService` verifies it against Google's tokeninfo
|
|
211
232
|
endpoint (audience must match `GOOGLE_CLIENT_ID`, issuer `accounts.google.com`,
|
|
@@ -543,6 +564,16 @@ a subscriber only starts firing once something constructs it.
|
|
|
543
564
|
| `MINIO_BUCKET` | `documents` | Bucket name (auto-created if missing) |
|
|
544
565
|
| `MINIO_PUBLIC_URL` | _(empty)_ | CDN base URL when MinIO sits behind a proxy |
|
|
545
566
|
|
|
567
|
+
### PDF Generation
|
|
568
|
+
|
|
569
|
+
Requires the optional peer dependency `puppeteer`.
|
|
570
|
+
|
|
571
|
+
| Variable | Default | Description |
|
|
572
|
+
| ------------------------- | --------- | ---------------------------------------------------------------------------------- |
|
|
573
|
+
| `PDF_CHROMIUM_PATH` | _(empty)_ | Path to an existing Chromium/Chrome binary; falls back to puppeteer's bundled one |
|
|
574
|
+
| `PDF_CHROMIUM_NO_SANDBOX` | `false` | `true` passes `--no-sandbox`. Needed in most containers; only use with trusted HTML |
|
|
575
|
+
| `PDF_RENDER_TIMEOUT_MS` | `30000` | Per-render page load timeout in milliseconds |
|
|
576
|
+
|
|
546
577
|
### HTTP Logging
|
|
547
578
|
|
|
548
579
|
| Variable | Default | Description |
|
|
@@ -637,6 +668,72 @@ async upload(@UploadedFiles() files: Express.Multer.File[], @CurrentUser() user:
|
|
|
637
668
|
Set `DOCUMENT_STORAGE_DRIVER=minio` for a local MinIO bucket (auto-created) or
|
|
638
669
|
`DOCUMENT_STORAGE_DRIVER=s3` for Amazon S3. Switching drivers requires no code change.
|
|
639
670
|
|
|
671
|
+
## PDF Generation (PdfService)
|
|
672
|
+
|
|
673
|
+
`PdfService` (exported by `DocumentModule`) turns an HTML document into PDF
|
|
674
|
+
bytes using a headless Chromium.
|
|
675
|
+
|
|
676
|
+
It is the backend half of the document rendering service: that service serves
|
|
677
|
+
print-ready, A4-locked HTML at `POST /pdfs/<version>/<path>/<template>`, and
|
|
678
|
+
this service rasterizes it. The split keeps the template service free of a
|
|
679
|
+
browser binary and puts the PDF bytes next to the storage and delivery code
|
|
680
|
+
that needs them.
|
|
681
|
+
|
|
682
|
+
```ts
|
|
683
|
+
// 1. Fetch the rendered document from the template service.
|
|
684
|
+
const html = await this.remoteRequestService.getApiResponse<string>({
|
|
685
|
+
url: `${templateBaseUrl}/pdfs/v1/business/summary-report`,
|
|
686
|
+
requestType: ApiRequestTypeEnum.POST,
|
|
687
|
+
contentType: ApiContentTypeEnum.APPLICATION_JSON,
|
|
688
|
+
headers: { 'x-client-key': clientKey },
|
|
689
|
+
body: reportPayload,
|
|
690
|
+
});
|
|
691
|
+
|
|
692
|
+
// 2. Rasterize it.
|
|
693
|
+
const pdf: Buffer = await this.pdfService.renderHtmlToPdf(html);
|
|
694
|
+
|
|
695
|
+
// …or go straight to bucket storage.
|
|
696
|
+
const file = await this.pdfService.renderHtmlToUploadableFile(html, 'summary-report.pdf');
|
|
697
|
+
const [link] = await this.documentService.uploadDocument([file], {
|
|
698
|
+
pathPrefix: 'reports',
|
|
699
|
+
});
|
|
700
|
+
```
|
|
701
|
+
|
|
702
|
+
**Install puppeteer.** It is an *optional* peer dependency — nothing imports it
|
|
703
|
+
until a PDF is actually requested, so apps that never generate one skip the
|
|
704
|
+
~170MB Chromium download entirely:
|
|
705
|
+
|
|
706
|
+
```bash
|
|
707
|
+
yarn add puppeteer
|
|
708
|
+
```
|
|
709
|
+
|
|
710
|
+
`PdfService.isAvailable()` reports whether it is installed.
|
|
711
|
+
|
|
712
|
+
### Behaviour worth knowing
|
|
713
|
+
|
|
714
|
+
- **The template owns the page setup.** `preferCssPageSize` defaults to `true`,
|
|
715
|
+
so an `@page { size: A4; margin: … }` rule in the HTML wins over the `format`
|
|
716
|
+
option. Page *count* is never specified by anyone — Chromium paginates and
|
|
717
|
+
emits as many pages as the content needs, which is what lets an A4-width
|
|
718
|
+
template grow to any length.
|
|
719
|
+
- **Print media is emulated**, so `@media screen` blocks (the sheet shadow a
|
|
720
|
+
template uses for browser previews) are correctly ignored.
|
|
721
|
+
- **Backgrounds are kept** (`printBackground` defaults to `true`), since
|
|
722
|
+
Chromium otherwise drops the themed fills and borders when printing.
|
|
723
|
+
- **One browser, many renders.** Chromium costs hundreds of milliseconds to
|
|
724
|
+
start, so a single instance is launched lazily and reused for the process
|
|
725
|
+
lifetime; each render gets its own page and closes it. A browser that dies is
|
|
726
|
+
detected and relaunched on the next call, and the whole thing is torn down
|
|
727
|
+
with the module.
|
|
728
|
+
|
|
729
|
+
### Configuration
|
|
730
|
+
|
|
731
|
+
| Variable | Default | Description |
|
|
732
|
+
| ------------------------- | --------- | ------------------------------------------------------------------------------------ |
|
|
733
|
+
| `PDF_CHROMIUM_PATH` | _(empty)_ | Path to an existing Chromium/Chrome binary; falls back to puppeteer's bundled one |
|
|
734
|
+
| `PDF_CHROMIUM_NO_SANDBOX` | `false` | `true` passes `--no-sandbox`. Needed in most containers; only use with trusted HTML |
|
|
735
|
+
| `PDF_RENDER_TIMEOUT_MS` | `30000` | Per-render page load timeout |
|
|
736
|
+
|
|
640
737
|
## Raw SQL (SqlService)
|
|
641
738
|
|
|
642
739
|
`SqlService` (global via `CommonModule`) runs raw SQL with named `:key`
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { UserEntity } from '../../auth/entities/user.entity';
|
|
2
|
+
import { CommonParamsDto } from '../../common/dtos/common.params.dto';
|
|
3
|
+
import { SqlService } from '../../common/services/sql.service';
|
|
4
|
+
import { AddSystemUserDto } from '../dtos/add.system.user.dto';
|
|
5
|
+
import { SystemUserListDto } from '../dtos/system.user.list.dto';
|
|
6
|
+
import { AdminAccessService } from '../services/admin.access.service';
|
|
7
|
+
import { SystemUserService } from '../services/system.user.service';
|
|
8
|
+
export declare class AdminSystemUserController {
|
|
9
|
+
protected readonly adminAccessService: AdminAccessService;
|
|
10
|
+
protected readonly systemUserService: SystemUserService;
|
|
11
|
+
protected readonly sqlService: SqlService;
|
|
12
|
+
constructor(adminAccessService: AdminAccessService, systemUserService: SystemUserService, sqlService: SqlService);
|
|
13
|
+
systemUserDetail({ id }: CommonParamsDto): Promise<UserEntity>;
|
|
14
|
+
addSystemUser(dto: AddSystemUserDto): Promise<UserEntity>;
|
|
15
|
+
listSystemUsers(dto: SystemUserListDto): Promise<{
|
|
16
|
+
records: import("../..").SqlRow[];
|
|
17
|
+
total: number;
|
|
18
|
+
page: number;
|
|
19
|
+
limit: number;
|
|
20
|
+
total_pages: number;
|
|
21
|
+
}>;
|
|
22
|
+
removeSystemUser(id: string): Promise<import("../..").DeleteResult>;
|
|
23
|
+
}
|
|
24
|
+
//# sourceMappingURL=admin.system.user.controller.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"admin.system.user.controller.d.ts","sourceRoot":"","sources":["../../../src/admin/controllers/admin.system.user.controller.ts"],"names":[],"mappings":"AAUA,OAAO,EAAE,UAAU,EAAE,MAAM,iCAAiC,CAAC;AAE7D,OAAO,EAAE,eAAe,EAAE,MAAM,qCAAqC,CAAC;AACtE,OAAO,EAAE,UAAU,EAAE,MAAM,mCAAmC,CAAC;AAC/D,OAAO,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAC;AAC/D,OAAO,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AAGjE,OAAO,EAAE,kBAAkB,EAAE,MAAM,kCAAkC,CAAC;AACtE,OAAO,EAAE,iBAAiB,EAAE,MAAM,iCAAiC,CAAC;AAEpE,qBACa,yBAAyB;IAElC,SAAS,CAAC,QAAQ,CAAC,kBAAkB,EAAE,kBAAkB;IACzD,SAAS,CAAC,QAAQ,CAAC,iBAAiB,EAAE,iBAAiB;IACvD,SAAS,CAAC,QAAQ,CAAC,UAAU,EAAE,UAAU;gBAFtB,kBAAkB,EAAE,kBAAkB,EACtC,iBAAiB,EAAE,iBAAiB,EACpC,UAAU,EAAE,UAAU;IAQrC,gBAAgB,CAAU,EAAE,EAAE,EAAE,EAAE,eAAe;IAiBjD,aAAa,CAAS,GAAG,EAAE,gBAAgB;IAW3C,eAAe,CAAS,GAAG,EAAE,iBAAiB;;;;;;;IAW9C,gBAAgB,CAA6B,EAAE,EAAE,MAAM;CAI9D"}
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
12
|
+
return function (target, key) { decorator(target, key, paramIndex); }
|
|
13
|
+
};
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
exports.AdminSystemUserController = void 0;
|
|
16
|
+
const common_1 = require("@nestjs/common");
|
|
17
|
+
const swagger_1 = require("@nestjs/swagger");
|
|
18
|
+
const user_entity_1 = require("../../auth/entities/user.entity");
|
|
19
|
+
const user_type_enum_1 = require("../../auth/enums/user.type.enum");
|
|
20
|
+
const common_params_dto_1 = require("../../common/dtos/common.params.dto");
|
|
21
|
+
const sql_service_1 = require("../../common/services/sql.service");
|
|
22
|
+
const add_system_user_dto_1 = require("../dtos/add.system.user.dto");
|
|
23
|
+
const system_user_list_dto_1 = require("../dtos/system.user.list.dto");
|
|
24
|
+
const system_user_data_processor_1 = require("../libraries/system.user.data.processor");
|
|
25
|
+
const system_user_list_processor_1 = require("../libraries/system.user.list.processor");
|
|
26
|
+
const admin_access_service_1 = require("../services/admin.access.service");
|
|
27
|
+
const system_user_service_1 = require("../services/system.user.service");
|
|
28
|
+
let AdminSystemUserController = class AdminSystemUserController {
|
|
29
|
+
constructor(adminAccessService, systemUserService, sqlService) {
|
|
30
|
+
this.adminAccessService = adminAccessService;
|
|
31
|
+
this.systemUserService = systemUserService;
|
|
32
|
+
this.sqlService = sqlService;
|
|
33
|
+
}
|
|
34
|
+
async systemUserDetail({ id }) {
|
|
35
|
+
await this.adminAccessService.validateContentReader();
|
|
36
|
+
const user = await user_entity_1.UserEntity.findOne({
|
|
37
|
+
where: { id, user_type: user_type_enum_1.UserType.SYSTEM_USER },
|
|
38
|
+
});
|
|
39
|
+
if (!user)
|
|
40
|
+
throw new common_1.NotFoundException('No system user exists for this id');
|
|
41
|
+
return user;
|
|
42
|
+
}
|
|
43
|
+
async addSystemUser(dto) {
|
|
44
|
+
await this.adminAccessService.validateSuperAdmin();
|
|
45
|
+
return new system_user_data_processor_1.SystemUserDataProcessor().process(dto);
|
|
46
|
+
}
|
|
47
|
+
async listSystemUsers(dto) {
|
|
48
|
+
await this.adminAccessService.validateContentReader();
|
|
49
|
+
return new system_user_list_processor_1.SystemUserListProcessor(this.sqlService).process(dto);
|
|
50
|
+
}
|
|
51
|
+
async removeSystemUser(id) {
|
|
52
|
+
const { user } = await this.adminAccessService.validateSuperAdmin();
|
|
53
|
+
return this.systemUserService.delete(id, user);
|
|
54
|
+
}
|
|
55
|
+
};
|
|
56
|
+
exports.AdminSystemUserController = AdminSystemUserController;
|
|
57
|
+
__decorate([
|
|
58
|
+
(0, common_1.Get)(':id'),
|
|
59
|
+
(0, swagger_1.ApiOperation)({
|
|
60
|
+
summary: 'One tenantless system user, in full.',
|
|
61
|
+
description: 'Requires at least the global content reader role.',
|
|
62
|
+
}),
|
|
63
|
+
__param(0, (0, common_1.Param)()),
|
|
64
|
+
__metadata("design:type", Function),
|
|
65
|
+
__metadata("design:paramtypes", [common_params_dto_1.CommonParamsDto]),
|
|
66
|
+
__metadata("design:returntype", Promise)
|
|
67
|
+
], AdminSystemUserController.prototype, "systemUserDetail", null);
|
|
68
|
+
__decorate([
|
|
69
|
+
(0, common_1.Post)(),
|
|
70
|
+
(0, swagger_1.ApiOperation)({
|
|
71
|
+
summary: 'Register a tenantless system user, or update one.',
|
|
72
|
+
description: 'Send an `id` to edit that user; omit it to register a new one. `password` is required only when creating. `has_global_access` is what lets the account sign in to an organization through `POST /auth/impersonation/login`; withdrawing it revokes the sessions it opened. Requires the global super admin role.',
|
|
73
|
+
}),
|
|
74
|
+
__param(0, (0, common_1.Body)()),
|
|
75
|
+
__metadata("design:type", Function),
|
|
76
|
+
__metadata("design:paramtypes", [add_system_user_dto_1.AddSystemUserDto]),
|
|
77
|
+
__metadata("design:returntype", Promise)
|
|
78
|
+
], AdminSystemUserController.prototype, "addSystemUser", null);
|
|
79
|
+
__decorate([
|
|
80
|
+
(0, common_1.Post)('list'),
|
|
81
|
+
(0, swagger_1.ApiOperation)({
|
|
82
|
+
summary: 'List, search and filter tenantless system users.',
|
|
83
|
+
description: 'Scoped to system users, so a request cannot reach client users through it. Requires at least the global content reader role.',
|
|
84
|
+
}),
|
|
85
|
+
__param(0, (0, common_1.Body)()),
|
|
86
|
+
__metadata("design:type", Function),
|
|
87
|
+
__metadata("design:paramtypes", [system_user_list_dto_1.SystemUserListDto]),
|
|
88
|
+
__metadata("design:returntype", Promise)
|
|
89
|
+
], AdminSystemUserController.prototype, "listSystemUsers", null);
|
|
90
|
+
__decorate([
|
|
91
|
+
(0, common_1.Post)(':id/delete'),
|
|
92
|
+
(0, swagger_1.ApiOperation)({
|
|
93
|
+
summary: 'Delete a system user.',
|
|
94
|
+
description: "Soft delete, with the user's sessions and refresh tokens revoked in the same transaction. Requires the global super admin role.",
|
|
95
|
+
}),
|
|
96
|
+
__param(0, (0, common_1.Param)('id', common_1.ParseUUIDPipe)),
|
|
97
|
+
__metadata("design:type", Function),
|
|
98
|
+
__metadata("design:paramtypes", [String]),
|
|
99
|
+
__metadata("design:returntype", Promise)
|
|
100
|
+
], AdminSystemUserController.prototype, "removeSystemUser", null);
|
|
101
|
+
exports.AdminSystemUserController = AdminSystemUserController = __decorate([
|
|
102
|
+
(0, common_1.Controller)('api/admin/system-users'),
|
|
103
|
+
__metadata("design:paramtypes", [admin_access_service_1.AdminAccessService,
|
|
104
|
+
system_user_service_1.SystemUserService,
|
|
105
|
+
sql_service_1.SqlService])
|
|
106
|
+
], AdminSystemUserController);
|
|
107
|
+
//# sourceMappingURL=admin.system.user.controller.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"admin.system.user.controller.js","sourceRoot":"","sources":["../../../src/admin/controllers/admin.system.user.controller.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,2CAQwB;AACxB,6CAA+C;AAC/C,iEAA6D;AAC7D,oEAA2D;AAC3D,2EAAsE;AACtE,mEAA+D;AAC/D,qEAA+D;AAC/D,uEAAiE;AACjE,wFAAkF;AAClF,wFAAkF;AAClF,2EAAsE;AACtE,yEAAoE;AAG7D,IAAM,yBAAyB,GAA/B,MAAM,yBAAyB;IACpC,YACqB,kBAAsC,EACtC,iBAAoC,EACpC,UAAsB;QAFtB,uBAAkB,GAAlB,kBAAkB,CAAoB;QACtC,sBAAiB,GAAjB,iBAAiB,CAAmB;QACpC,eAAU,GAAV,UAAU,CAAY;IACxC,CAAC;IAOE,AAAN,KAAK,CAAC,gBAAgB,CAAU,EAAE,EAAE,EAAmB;QACrD,MAAM,IAAI,CAAC,kBAAkB,CAAC,qBAAqB,EAAE,CAAC;QAEtD,MAAM,IAAI,GAAG,MAAM,wBAAU,CAAC,OAAO,CAAC;YACpC,KAAK,EAAE,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AC,MAAM,CAAC;IACZ,IAAA,sBAAY,EAAC;QACZ,OAAO,EAAE,kDAAkD;QAC3D,WAAW,EACT,8HAA8H;KACjI,CAAC;IACqB,WAAA,IAAA,aAAI,GAAE,CAAA;;qCAAM,wCAAiB;;gEAGnD;AAQK;IANL,IAAA,aAAI,EAAC,YAAY,CAAC;IAClB,IAAA,sBAAY,EAAC;QACZ,OAAO,EAAE,uBAAuB;QAChC,WAAW,EACT,iIAAiI;KACpI,CAAC;IACsB,WAAA,IAAA,cAAK,EAAC,IAAI,EAAE,sBAAa,CAAC,CAAA;;;;iEAGjD;oCAtDU,yBAAyB;IADrC,IAAA,mBAAU,EAAC,wBAAwB,CAAC;qCAGM,yCAAkB;QACnB,uCAAiB;QACxB,wBAAU;GAJhC,yBAAyB,CAuDrC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"add.system.user.dto.d.ts","sourceRoot":"","sources":["../../../src/admin/dtos/add.system.user.dto.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAG9C,qBAAa,gBAAiB,SAAQ,WAAW;IAO/C,iBAAiB,CAAC,EAAE,OAAO,CAAC;CAC7B"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.AddSystemUserDto = void 0;
|
|
13
|
+
const class_validator_1 = require("class-validator");
|
|
14
|
+
const swagger_1 = require("@nestjs/swagger");
|
|
15
|
+
const base_user_dto_1 = require("./base.user.dto");
|
|
16
|
+
class AddSystemUserDto extends base_user_dto_1.BaseUserDto {
|
|
17
|
+
}
|
|
18
|
+
exports.AddSystemUserDto = AddSystemUserDto;
|
|
19
|
+
__decorate([
|
|
20
|
+
(0, swagger_1.ApiPropertyOptional)({
|
|
21
|
+
default: false,
|
|
22
|
+
description: 'Lets this user sign in to any organization.',
|
|
23
|
+
}),
|
|
24
|
+
(0, class_validator_1.IsOptional)(),
|
|
25
|
+
(0, class_validator_1.IsBoolean)(),
|
|
26
|
+
__metadata("design:type", Boolean)
|
|
27
|
+
], AddSystemUserDto.prototype, "has_global_access", void 0);
|
|
28
|
+
//# sourceMappingURL=add.system.user.dto.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"add.system.user.dto.js","sourceRoot":"","sources":["../../../src/admin/dtos/add.system.user.dto.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,qDAAwD;AACxD,6CAAsD;AACtD,mDAA8C;AAG9C,MAAa,gBAAiB,SAAQ,2BAAW;CAQhD;AARD,4CAQC;AADC;IANC,IAAA,6BAAmB,EAAC;QACnB,OAAO,EAAE,KAAK;QACd,WAAW,EAAE,6CAA6C;KAC3D,CAAC;IACD,IAAA,4BAAU,GAAE;IACZ,IAAA,2BAAS,GAAE;;2DACgB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"system.user.list.dto.d.ts","sourceRoot":"","sources":["../../../src/admin/dtos/system.user.list.dto.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,0CAA0C,CAAC;AAO/E,qBAAa,iBAAkB,SAAQ,mBAAmB;CAAG"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SystemUserListDto = void 0;
|
|
4
|
+
const common_list_filter_dto_1 = require("../../common/dtos/common.list.filter.dto");
|
|
5
|
+
class SystemUserListDto extends common_list_filter_dto_1.CommonListFilterDto {
|
|
6
|
+
}
|
|
7
|
+
exports.SystemUserListDto = SystemUserListDto;
|
|
8
|
+
//# sourceMappingURL=system.user.list.dto.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"system.user.list.dto.js","sourceRoot":"","sources":["../../../src/admin/dtos/system.user.list.dto.ts"],"names":[],"mappings":";;;AAAA,qFAA+E;AAO/E,MAAa,iBAAkB,SAAQ,4CAAmB;CAAG;AAA7D,8CAA6D"}
|
|
@@ -3,10 +3,12 @@ import { AdminRoleController } from './controllers/admin.role.controller';
|
|
|
3
3
|
import { AdminScheduledTaskController } from './controllers/admin.scheduled.task.controller';
|
|
4
4
|
import { AdminScopeController } from './controllers/admin.scope.controller';
|
|
5
5
|
import { AdminTenantController } from './controllers/admin.tenant.controller';
|
|
6
|
+
import { AdminSystemUserController } from './controllers/admin.system.user.controller';
|
|
6
7
|
import { AdminTenantUserController } from './controllers/admin.tenant.user.controller';
|
|
7
8
|
import { AdminUserController } from './controllers/admin.user.controller';
|
|
8
9
|
import { SystemRoleController } from './controllers/system.role.controller';
|
|
9
10
|
import { AdminAccessService } from './services/admin.access.service';
|
|
11
|
+
import { SystemUserService } from './services/system.user.service';
|
|
10
12
|
import { AdminUserDataProcessor } from './libraries/admin.user.data.processor';
|
|
11
13
|
import { AdminUserDeleteProcessor } from './libraries/admin.user.delete.processor';
|
|
12
14
|
import { AdminUserListProcessor } from './libraries/admin.user.list.processor';
|
|
@@ -23,6 +25,8 @@ import { ScheduledTaskListProcessor } from './libraries/scheduled.task.list.proc
|
|
|
23
25
|
import { ScopeDataProcessor } from './libraries/scope.data.processor';
|
|
24
26
|
import { ScopeListProcessor } from './libraries/scope.list.processor';
|
|
25
27
|
import { SystemRoleDataProcessor } from './libraries/system.role.data.processor';
|
|
28
|
+
import { SystemUserDataProcessor } from './libraries/system.user.data.processor';
|
|
29
|
+
import { SystemUserListProcessor } from './libraries/system.user.list.processor';
|
|
26
30
|
import { TenantDataProcessor } from './libraries/tenant.data.processor';
|
|
27
31
|
import { TenantDeleteProcessor } from './libraries/tenant.delete.processor';
|
|
28
32
|
import { TenantListProcessor } from './libraries/tenant.list.processor';
|
|
@@ -34,9 +38,9 @@ import { AddTenantDto } from './dtos/add.tenant.dto';
|
|
|
34
38
|
import { ApiKeyListDto } from './dtos/api.key.list.dto';
|
|
35
39
|
import { BaseUserDto } from './dtos/base.user.dto';
|
|
36
40
|
export declare const es6Classes: {
|
|
37
|
-
controllers: (typeof AdminApiKeyController | typeof AdminRoleController | typeof AdminScheduledTaskController | typeof AdminScopeController | typeof AdminTenantController | typeof AdminTenantUserController | typeof AdminUserController | typeof SystemRoleController)[];
|
|
38
|
-
services: readonly [typeof AdminAccessService];
|
|
39
|
-
libraries: (typeof ApiKeyDataProcessor | typeof ApiKeyListProcessor | typeof RoleListProcessor | typeof AdminRoleListProcessor | typeof ScheduledTaskDataProcessor | typeof ScheduledTaskDeleteProcessor | typeof ScheduledTaskListProcessor | typeof ScopeDataProcessor | typeof ScopeListProcessor | typeof TenantDataProcessor | typeof TenantDeleteProcessor | typeof TenantListProcessor | typeof BulkUserDataProcessor | typeof ClientUserDataProcessor | typeof ClientUserDeleteProcessor | typeof ClientUserListProcessor | typeof AdminUserDataProcessor | typeof AdminUserDeleteProcessor | typeof AdminUserListProcessor | typeof SystemRoleDataProcessor)[];
|
|
41
|
+
controllers: (typeof AdminApiKeyController | typeof AdminRoleController | typeof AdminScheduledTaskController | typeof AdminScopeController | typeof AdminTenantController | typeof AdminSystemUserController | typeof AdminTenantUserController | typeof AdminUserController | typeof SystemRoleController)[];
|
|
42
|
+
services: readonly [typeof AdminAccessService, typeof SystemUserService];
|
|
43
|
+
libraries: (typeof ApiKeyDataProcessor | typeof ApiKeyListProcessor | typeof RoleListProcessor | typeof AdminRoleListProcessor | typeof ScheduledTaskDataProcessor | typeof ScheduledTaskDeleteProcessor | typeof ScheduledTaskListProcessor | typeof ScopeDataProcessor | typeof ScopeListProcessor | typeof TenantDataProcessor | typeof TenantDeleteProcessor | typeof TenantListProcessor | typeof SystemUserDataProcessor | typeof SystemUserListProcessor | typeof BulkUserDataProcessor | typeof ClientUserDataProcessor | typeof ClientUserDeleteProcessor | typeof ClientUserListProcessor | typeof AdminUserDataProcessor | typeof AdminUserDeleteProcessor | typeof AdminUserListProcessor | typeof SystemRoleDataProcessor)[];
|
|
40
44
|
dtos: (typeof AddApiKeyDto | typeof ApiKeyListDto | typeof ScheduleDto | typeof AddScopeDto | typeof AddTenantDto | typeof BaseUserDto | typeof AddAdminUserDto)[];
|
|
41
45
|
jobs: any[];
|
|
42
46
|
subscribers: any[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"es6.classes.d.ts","sourceRoot":"","sources":["../../src/admin/es6.classes.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,wCAAwC,CAAC;AAC/E,OAAO,EAAE,mBAAmB,EAAE,MAAM,qCAAqC,CAAC;AAC1E,OAAO,EAAE,4BAA4B,EAAE,MAAM,+CAA+C,CAAC;AAC7F,OAAO,EAAE,oBAAoB,EAAE,MAAM,sCAAsC,CAAC;AAC5E,OAAO,EAAE,qBAAqB,EAAE,MAAM,uCAAuC,CAAC;AAC9E,OAAO,EAAE,yBAAyB,EAAE,MAAM,4CAA4C,CAAC;AACvF,OAAO,EAAE,mBAAmB,EAAE,MAAM,qCAAqC,CAAC;AAC1E,OAAO,EAAE,oBAAoB,EAAE,MAAM,sCAAsC,CAAC;AAC5E,OAAO,EAAE,kBAAkB,EAAE,MAAM,iCAAiC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ACzC,OAAO,EAAE,0BAA0B,EAAE,MAAM,2CAA2C,CAAC;AACvF,OAAO,EAAE,4BAA4B,EAAE,MAAM,6CAA6C,CAAC;AAC3F,OAAO,EAAE,0BAA0B,EAAE,MAAM,2CAA2C,CAAC;AACvF,OAAO,EAAE,kBAAkB,EAAE,MAAM,kCAAkC,CAAC;AACtE,OAAO,EAAE,kBAAkB,EAAE,MAAM,kCAAkC,CAAC;AACtE,OAAO,EAAE,uBAAuB,EAAE,MAAM,wCAAwC,CAAC;AACjF,OAAO,EAAE,uBAAuB,EAAE,MAAM,wCAAwC,CAAC;AACjF,OAAO,EAAE,uBAAuB,EAAE,MAAM,wCAAwC,CAAC;AACjF,OAAO,EAAE,mBAAmB,EAAE,MAAM,mCAAmC,CAAC;AACxE,OAAO,EAAE,qBAAqB,EAAE,MAAM,qCAAqC,CAAC;AAC5E,OAAO,EAAE,mBAAmB,EAAE,MAAM,mCAAmC,CAAC;AACxE,OAAO,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAC5D,OAAO,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAGtD,OAAO,EAAE,WAAW,EAAE,MAAM,+BAA+B,CAAC;AAC5D,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAGnD,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAErD,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAExD,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAOnD,eAAO,MAAM,UAAU;;;;;;;CA2DtB,CAAC"}
|
|
@@ -6,10 +6,12 @@ const admin_role_controller_1 = require("./controllers/admin.role.controller");
|
|
|
6
6
|
const admin_scheduled_task_controller_1 = require("./controllers/admin.scheduled.task.controller");
|
|
7
7
|
const admin_scope_controller_1 = require("./controllers/admin.scope.controller");
|
|
8
8
|
const admin_tenant_controller_1 = require("./controllers/admin.tenant.controller");
|
|
9
|
+
const admin_system_user_controller_1 = require("./controllers/admin.system.user.controller");
|
|
9
10
|
const admin_tenant_user_controller_1 = require("./controllers/admin.tenant.user.controller");
|
|
10
11
|
const admin_user_controller_1 = require("./controllers/admin.user.controller");
|
|
11
12
|
const system_role_controller_1 = require("./controllers/system.role.controller");
|
|
12
13
|
const admin_access_service_1 = require("./services/admin.access.service");
|
|
14
|
+
const system_user_service_1 = require("./services/system.user.service");
|
|
13
15
|
const admin_user_data_processor_1 = require("./libraries/admin.user.data.processor");
|
|
14
16
|
const admin_user_delete_processor_1 = require("./libraries/admin.user.delete.processor");
|
|
15
17
|
const admin_user_list_processor_1 = require("./libraries/admin.user.list.processor");
|
|
@@ -26,6 +28,8 @@ const scheduled_task_list_processor_1 = require("./libraries/scheduled.task.list
|
|
|
26
28
|
const scope_data_processor_1 = require("./libraries/scope.data.processor");
|
|
27
29
|
const scope_list_processor_1 = require("./libraries/scope.list.processor");
|
|
28
30
|
const system_role_data_processor_1 = require("./libraries/system.role.data.processor");
|
|
31
|
+
const system_user_data_processor_1 = require("./libraries/system.user.data.processor");
|
|
32
|
+
const system_user_list_processor_1 = require("./libraries/system.user.list.processor");
|
|
29
33
|
const tenant_data_processor_1 = require("./libraries/tenant.data.processor");
|
|
30
34
|
const tenant_delete_processor_1 = require("./libraries/tenant.delete.processor");
|
|
31
35
|
const tenant_list_processor_1 = require("./libraries/tenant.list.processor");
|
|
@@ -36,6 +40,7 @@ const add_client_user_dto_1 = require("./dtos/add.client.user.dto");
|
|
|
36
40
|
const add_scheduled_task_dto_1 = require("./dtos/add.scheduled.task.dto");
|
|
37
41
|
const add_scope_dto_1 = require("./dtos/add.scope.dto");
|
|
38
42
|
const add_system_role_dto_1 = require("./dtos/add.system.role.dto");
|
|
43
|
+
const add_system_user_dto_1 = require("./dtos/add.system.user.dto");
|
|
39
44
|
const add_tenant_dto_1 = require("./dtos/add.tenant.dto");
|
|
40
45
|
const admin_user_list_dto_1 = require("./dtos/admin.user.list.dto");
|
|
41
46
|
const api_key_list_dto_1 = require("./dtos/api.key.list.dto");
|
|
@@ -44,6 +49,7 @@ const base_user_dto_1 = require("./dtos/base.user.dto");
|
|
|
44
49
|
const role_list_dto_1 = require("./dtos/role.list.dto");
|
|
45
50
|
const scheduled_task_list_dto_1 = require("./dtos/scheduled.task.list.dto");
|
|
46
51
|
const scope_list_dto_1 = require("./dtos/scope.list.dto");
|
|
52
|
+
const system_user_list_dto_1 = require("./dtos/system.user.list.dto");
|
|
47
53
|
const tenant_list_dto_1 = require("./dtos/tenant.list.dto");
|
|
48
54
|
exports.es6Classes = {
|
|
49
55
|
controllers: [
|
|
@@ -54,9 +60,10 @@ exports.es6Classes = {
|
|
|
54
60
|
admin_tenant_controller_1.AdminTenantController,
|
|
55
61
|
admin_user_controller_1.AdminUserController,
|
|
56
62
|
admin_tenant_user_controller_1.AdminTenantUserController,
|
|
63
|
+
admin_system_user_controller_1.AdminSystemUserController,
|
|
57
64
|
system_role_controller_1.SystemRoleController,
|
|
58
65
|
],
|
|
59
|
-
services: [admin_access_service_1.AdminAccessService],
|
|
66
|
+
services: [admin_access_service_1.AdminAccessService, system_user_service_1.SystemUserService],
|
|
60
67
|
libraries: [
|
|
61
68
|
admin_user_data_processor_1.AdminUserDataProcessor,
|
|
62
69
|
admin_user_delete_processor_1.AdminUserDeleteProcessor,
|
|
@@ -75,6 +82,8 @@ exports.es6Classes = {
|
|
|
75
82
|
scope_data_processor_1.ScopeDataProcessor,
|
|
76
83
|
scope_list_processor_1.ScopeListProcessor,
|
|
77
84
|
system_role_data_processor_1.SystemRoleDataProcessor,
|
|
85
|
+
system_user_data_processor_1.SystemUserDataProcessor,
|
|
86
|
+
system_user_list_processor_1.SystemUserListProcessor,
|
|
78
87
|
tenant_data_processor_1.TenantDataProcessor,
|
|
79
88
|
tenant_delete_processor_1.TenantDeleteProcessor,
|
|
80
89
|
tenant_list_processor_1.TenantListProcessor,
|
|
@@ -87,6 +96,7 @@ exports.es6Classes = {
|
|
|
87
96
|
add_scheduled_task_dto_1.ScheduleDto,
|
|
88
97
|
add_scope_dto_1.AddScopeDto,
|
|
89
98
|
add_system_role_dto_1.AddSystemRoleDto,
|
|
99
|
+
add_system_user_dto_1.AddSystemUserDto,
|
|
90
100
|
add_tenant_dto_1.AddTenantDto,
|
|
91
101
|
admin_user_list_dto_1.AdminUserListDto,
|
|
92
102
|
api_key_list_dto_1.ApiKeyListDto,
|
|
@@ -95,6 +105,7 @@ exports.es6Classes = {
|
|
|
95
105
|
role_list_dto_1.RoleListDto,
|
|
96
106
|
scheduled_task_list_dto_1.ScheduledTaskListDto,
|
|
97
107
|
scope_list_dto_1.ScopeListDto,
|
|
108
|
+
system_user_list_dto_1.SystemUserListDto,
|
|
98
109
|
tenant_list_dto_1.TenantListDto,
|
|
99
110
|
],
|
|
100
111
|
jobs: [],
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"es6.classes.js","sourceRoot":"","sources":["../../src/admin/es6.classes.ts"],"names":[],"mappings":";;;AAAA,qFAA+E;AAC/E,+EAA0E;AAC1E,mGAA6F;AAC7F,iFAA4E;AAC5E,mFAA8E;AAC9E,6FAAuF;AACvF,+EAA0E;AAC1E,iFAA4E;AAC5E,0EAAqE;AACrE,qFAA+E;AAC/E,yFAAmF;AACnF,qFAA+E;AAC/E,+EAAyE;AACzE,+EAAyE;AACzE,mFAA6E;AAC7E,uFAAiF;AACjF,2FAAqF;AACrF,uFAAiF;AACjF,yEAGyC;AACzC,6FAAuF;AACvF,iGAA2F;AAC3F,6FAAuF;AACvF,2EAAsE;AACtE,2EAAsE;AACtE,uFAAiF;AACjF,6EAAwE;AACxE,iFAA4E;AAC5E,6EAAwE;AACxE,kEAA4D;AAC5D,4DAAsD;AACtD,kEAA4D;AAC5D,oEAA8D;AAC9D,0EAA4D;AAC5D,wDAAmD;AACnD,oEAA8D;AAC9D,0DAAqD;AACrD,oEAA8D;AAC9D,8DAAwD;AACxD,sEAAgE;AAChE,wDAAmD;AACnD,wDAAmD;AACnD,4EAAsE;AACtE,0DAAqD;AACrD,4DAAuD;AAE1C,QAAA,UAAU,GAAG;IACxB,WAAW,EAAE;QACX,gDAAqB;QACrB,2CAAmB;QACnB,8DAA4B;QAC5B,6CAAoB;QACpB,+CAAqB;QACrB,2CAAmB;QACnB,wDAAyB;QACzB,6CAAoB;KACrB;IACD,QAAQ,EAAE,CAAC,yCAAkB,CAAU;
|
|
1
|
+
{"version":3,"file":"es6.classes.js","sourceRoot":"","sources":["../../src/admin/es6.classes.ts"],"names":[],"mappings":";;;AAAA,qFAA+E;AAC/E,+EAA0E;AAC1E,mGAA6F;AAC7F,iFAA4E;AAC5E,mFAA8E;AAC9E,6FAAuF;AACvF,6FAAuF;AACvF,+EAA0E;AAC1E,iFAA4E;AAC5E,0EAAqE;AACrE,wEAAmE;AACnE,qFAA+E;AAC/E,yFAAmF;AACnF,qFAA+E;AAC/E,+EAAyE;AACzE,+EAAyE;AACzE,mFAA6E;AAC7E,uFAAiF;AACjF,2FAAqF;AACrF,uFAAiF;AACjF,yEAGyC;AACzC,6FAAuF;AACvF,iGAA2F;AAC3F,6FAAuF;AACvF,2EAAsE;AACtE,2EAAsE;AACtE,uFAAiF;AACjF,uFAAiF;AACjF,uFAAiF;AACjF,6EAAwE;AACxE,iFAA4E;AAC5E,6EAAwE;AACxE,kEAA4D;AAC5D,4DAAsD;AACtD,kEAA4D;AAC5D,oEAA8D;AAC9D,0EAA4D;AAC5D,wDAAmD;AACnD,oEAA8D;AAC9D,oEAA8D;AAC9D,0DAAqD;AACrD,oEAA8D;AAC9D,8DAAwD;AACxD,sEAAgE;AAChE,wDAAmD;AACnD,wDAAmD;AACnD,4EAAsE;AACtE,0DAAqD;AACrD,sEAAgE;AAChE,4DAAuD;AAE1C,QAAA,UAAU,GAAG;IACxB,WAAW,EAAE;QACX,gDAAqB;QACrB,2CAAmB;QACnB,8DAA4B;QAC5B,6CAAoB;QACpB,+CAAqB;QACrB,2CAAmB;QACnB,wDAAyB;QACzB,wDAAyB;QACzB,6CAAoB;KACrB;IACD,QAAQ,EAAE,CAAC,yCAAkB,EAAE,uCAAiB,CAAU;IAC1D,SAAS,EAAE;QACT,kDAAsB;QACtB,sDAAwB;QACxB,kDAAsB;QACtB,4CAAsB;QACtB,4CAAmB;QACnB,4CAAmB;QACnB,gDAAqB;QACrB,oDAAuB;QACvB,wDAAyB;QACzB,oDAAuB;QACvB,uCAAiB;QACjB,0DAA0B;QAC1B,8DAA4B;QAC5B,0DAA0B;QAC1B,yCAAkB;QAClB,yCAAkB;QAClB,oDAAuB;QACvB,oDAAuB;QACvB,oDAAuB;QACvB,2CAAmB;QACnB,+CAAqB;QACrB,2CAAmB;KACpB;IACD,IAAI,EAAE;QACJ,oCAAe;QACf,8BAAY;QACZ,oCAAe;QACf,sCAAgB;QAChB,oCAAW;QACX,2BAAW;QACX,sCAAgB;QAChB,sCAAgB;QAChB,6BAAY;QACZ,sCAAgB;QAChB,gCAAa;QACb,2BAAW;QACX,wCAAiB;QACjB,2BAAW;QACX,8CAAoB;QACpB,6BAAY;QACZ,wCAAiB;QACjB,+BAAa;KACd;IACD,IAAI,EAAE,EAAE;IACR,WAAW,EAAE,EAAE;CAChB,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { UserDataProcessor } from './user.data.processor';
|
|
2
|
+
import { UserEntity } from '../../auth/entities/user.entity';
|
|
3
|
+
import { AddSystemUserDto } from '../dtos/add.system.user.dto';
|
|
4
|
+
export declare class SystemUserDataProcessor extends UserDataProcessor {
|
|
5
|
+
protected payload: AddSystemUserDto;
|
|
6
|
+
process(payload: AddSystemUserDto): Promise<UserEntity>;
|
|
7
|
+
private validate;
|
|
8
|
+
private save;
|
|
9
|
+
private create;
|
|
10
|
+
private update;
|
|
11
|
+
}
|
|
12
|
+
//# sourceMappingURL=system.user.data.processor.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"system.user.data.processor.d.ts","sourceRoot":"","sources":["../../../src/admin/libraries/system.user.data.processor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAC1D,OAAO,EAAE,UAAU,EAAE,MAAM,iCAAiC,CAAC;AAI7D,OAAO,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAC;AAQ/D,qBAAa,uBAAwB,SAAQ,iBAAiB;IAC5D,SAAS,CAAC,OAAO,EAAE,gBAAgB,CAAC;IAE9B,OAAO,CAAC,OAAO,EAAE,gBAAgB,GAAG,OAAO,CAAC,UAAU,CAAC;YAM/C,QAAQ;YAkBR,IAAI;YAKJ,MAAM;YAoBN,MAAM;CA2BrB"}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SystemUserDataProcessor = void 0;
|
|
4
|
+
const user_data_processor_1 = require("./user.data.processor");
|
|
5
|
+
const user_entity_1 = require("../../auth/entities/user.entity");
|
|
6
|
+
const user_type_enum_1 = require("../../auth/enums/user.type.enum");
|
|
7
|
+
const auth_utilities_1 = require("../../auth/utilities/auth.utilities");
|
|
8
|
+
const access_revocation_1 = require("../../auth/utilities/access.revocation");
|
|
9
|
+
const access_exception_1 = require("../../global/exceptions/access.exception");
|
|
10
|
+
class SystemUserDataProcessor extends user_data_processor_1.UserDataProcessor {
|
|
11
|
+
async process(payload) {
|
|
12
|
+
this.payload = payload;
|
|
13
|
+
await this.validate();
|
|
14
|
+
return this.save();
|
|
15
|
+
}
|
|
16
|
+
async validate() {
|
|
17
|
+
const editId = this.payload.id;
|
|
18
|
+
if (editId &&
|
|
19
|
+
!(await user_entity_1.UserEntity.existsBy({
|
|
20
|
+
id: editId,
|
|
21
|
+
user_type: user_type_enum_1.UserType.SYSTEM_USER,
|
|
22
|
+
})))
|
|
23
|
+
this.setColumnError('id', 'No system user exists for this id');
|
|
24
|
+
await this.assertEmailAvailable(this.payload.email, 'email', editId);
|
|
25
|
+
this.assertPasswordOnCreate(this.payload.password, !!editId);
|
|
26
|
+
this.throwExceptionOnError();
|
|
27
|
+
}
|
|
28
|
+
async save() {
|
|
29
|
+
if (this.payload?.id)
|
|
30
|
+
return this.update();
|
|
31
|
+
return this.create();
|
|
32
|
+
}
|
|
33
|
+
async create() {
|
|
34
|
+
const body = this.payload;
|
|
35
|
+
const user = user_entity_1.UserEntity.create({
|
|
36
|
+
user_type: user_type_enum_1.UserType.SYSTEM_USER,
|
|
37
|
+
has_global_access: body.has_global_access ?? false,
|
|
38
|
+
full_name: body.full_name,
|
|
39
|
+
email: body.email,
|
|
40
|
+
password: await auth_utilities_1.AuthUtility.hashPassword(body.password),
|
|
41
|
+
country: body.country,
|
|
42
|
+
contact_code: body.contact_code,
|
|
43
|
+
contact: body.contact,
|
|
44
|
+
active: body.active ?? true,
|
|
45
|
+
});
|
|
46
|
+
await user.save();
|
|
47
|
+
return this.stripSecrets(user);
|
|
48
|
+
}
|
|
49
|
+
async update() {
|
|
50
|
+
const body = this.payload;
|
|
51
|
+
const user = await user_entity_1.UserEntity.findOne({ where: { id: body.id } });
|
|
52
|
+
if (!user)
|
|
53
|
+
throw new access_exception_1.AccessException('Invalid user id provided');
|
|
54
|
+
const hadAccess = user.has_global_access && user.active;
|
|
55
|
+
user.full_name = body.full_name;
|
|
56
|
+
user.email = body.email;
|
|
57
|
+
user.country = body.country;
|
|
58
|
+
user.contact_code = body.contact_code;
|
|
59
|
+
user.contact = body.contact;
|
|
60
|
+
user.active = body.active ?? true;
|
|
61
|
+
user.has_global_access = body.has_global_access ?? false;
|
|
62
|
+
await user.save();
|
|
63
|
+
if (hadAccess && !(user.has_global_access && user.active))
|
|
64
|
+
await user_entity_1.UserEntity.getRepository().manager.transaction((trx) => access_revocation_1.AccessRevocation.revokeAll(trx, user.id, false));
|
|
65
|
+
return this.stripSecrets(user);
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
exports.SystemUserDataProcessor = SystemUserDataProcessor;
|
|
69
|
+
//# sourceMappingURL=system.user.data.processor.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"system.user.data.processor.js","sourceRoot":"","sources":["../../../src/admin/libraries/system.user.data.processor.ts"],"names":[],"mappings":";;;AAAA,+DAA0D;AAC1D,iEAA6D;AAC7D,oEAA2D;AAC3D,wEAAkE;AAClE,8EAA0E;AAE1E,+EAA2E;AAO3E,MAAa,uBAAwB,SAAQ,uCAAiB;IAG5D,KAAK,CAAC,OAAO,CAAC,OAAyB;QACrC,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,MAAM,IAAI,CAAC,QAAQ,EAAE,CAAC;QACtB,OAAO,IAAI,CAAC,IAAI,EAAE,CAAC;IACrB,CAAC;IAEO,KAAK,CAAC,QAAQ;QACpB,MAAM,MAAM,GAAG,IAAI,CAAC,OAAO,CAAC,EAAE,CAAC;QAE/B,IACE,MAAM;YACN,CAAC,CAAC,MAAM,wBAAU,CAAC,QAAQ,CAAC;gBAC1B,EAAE,EAAE,MAAM;gBACV,SAAS,EAAE,yBAAQ,CAAC,WAAW;aAChC,CAAC,CAAC;YAEH,IAAI,CAAC,cAAc,CAAC,IAAI,EAAE,mCAAmC,CAAC,CAAC;QAEjE,MAAM,IAAI,CAAC,oBAAoB,CAAC,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE,OAAO,EAAE,MAAM,CAAC,CAAC;QACrE,IAAI,CAAC,sBAAsB,CAAC,IAAI,CAAC,OAAO,CAAC,QAAQ,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC;QAE7D,IAAI,CAAC,qBAAqB,EAAE,CAAC;IAC/B,CAAC;IAEO,KAAK,CAAC,IAAI;QAChB,IAAI,IAAI,CAAC,OAAO,EAAE,EAAE;YAAE,OAAO,IAAI,CAAC,MAAM,EAAE,CAAC;QAC3C,OAAO,IAAI,CAAC,MAAM,EAAE,CAAC;IACvB,CAAC;IAEO,KAAK,CAAC,MAAM;QAClB,MAAM,IAAI,GAAG,IAAI,CAAC,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,CAAC,MAAM,GAAG,IAAI,CAAC,MAAM,IAAI,IAAI,CAAC;QAClC,IAAI,CAAC,iBAAiB,GAAG,IAAI,CAAC,iBAAiB,IAAI,KAAK,CAAC;QAEzD,MAAM,IAAI,CAAC,IAAI,EAAE,CAAC;QAIlB,IAAI,SAAS,IAAI,CAAC,CAAC,IAAI,CAAC,iBAAiB,IAAI,IAAI,CAAC,MAAM,CAAC;YACvD,MAAM,wBAAU,CAAC,aAAa,EAAE,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC,GAAG,EAAE,EAAE,CAC3D,oCAAgB,CAAC,SAAS,CAAC,GAAG,EAAE,IAAI,CAAC,EAAE,EAAE,KAAK,CAAC,CAChD,CAAC;QAEJ,OAAO,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC;IACjC,CAAC;CACF;AA/ED,0DA+EC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { CommonListProcessor } from '../../common/libraries/common.list.processor';
|
|
2
|
+
import { SqlService } from '../../common/services/sql.service';
|
|
3
|
+
import { SystemUserListDto } from '../dtos/system.user.list.dto';
|
|
4
|
+
export declare class SystemUserListProcessor extends CommonListProcessor {
|
|
5
|
+
protected readonly sqlService: SqlService;
|
|
6
|
+
constructor(sqlService: SqlService);
|
|
7
|
+
process(payload: SystemUserListDto): Promise<{
|
|
8
|
+
records: import("../..").SqlRow[];
|
|
9
|
+
total: number;
|
|
10
|
+
page: number;
|
|
11
|
+
limit: number;
|
|
12
|
+
total_pages: number;
|
|
13
|
+
}>;
|
|
14
|
+
}
|
|
15
|
+
//# sourceMappingURL=system.user.list.processor.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"system.user.list.processor.d.ts","sourceRoot":"","sources":["../../../src/admin/libraries/system.user.list.processor.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,mBAAmB,EAAE,MAAM,8CAA8C,CAAC;AACnF,OAAO,EAAE,UAAU,EAAE,MAAM,mCAAmC,CAAC;AAE/D,OAAO,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AASjE,qBAAa,uBAAwB,SAAQ,mBAAmB;IAClD,SAAS,CAAC,QAAQ,CAAC,UAAU,EAAE,UAAU;gBAAtB,UAAU,EAAE,UAAU;IAI/C,OAAO,CAAC,OAAO,EAAE,iBAAiB;;;;;;;CAoCzC"}
|