@acorex-platform/module-security-management-client 0.0.59 → 0.0.60

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.
Files changed (63) hide show
  1. package/fesm2022/{acorex-platform-module-security-management-client-acorex-platform-module-security-management-client-CNHPwr3d.mjs → acorex-platform-module-security-management-client-acorex-platform-module-security-management-client-B61j_cJF.mjs} +206 -15
  2. package/fesm2022/acorex-platform-module-security-management-client-acorex-platform-module-security-management-client-B61j_cJF.mjs.map +1 -0
  3. package/fesm2022/acorex-platform-module-security-management-client-approve-join-request.command-BSvK59LV.mjs +322 -0
  4. package/fesm2022/acorex-platform-module-security-management-client-approve-join-request.command-BSvK59LV.mjs.map +1 -0
  5. package/fesm2022/acorex-platform-module-security-management-client-contracts-entities-device-sessions.mjs +21 -2
  6. package/fesm2022/acorex-platform-module-security-management-client-contracts-entities-device-sessions.mjs.map +1 -1
  7. package/fesm2022/acorex-platform-module-security-management-client-contracts-entities-users.mjs +170 -39
  8. package/fesm2022/acorex-platform-module-security-management-client-contracts-entities-users.mjs.map +1 -1
  9. package/fesm2022/{acorex-platform-module-security-management-client-contracts-entity-catalog-acorex-platform-module-security-management-client-contracts-entity-catalog-DAZZcjkf.mjs → acorex-platform-module-security-management-client-contracts-entity-catalog-acorex-platform-module-security-management-client-contracts-entity-catalog-JP3zTrun.mjs} +10 -10
  10. package/fesm2022/{acorex-platform-module-security-management-client-contracts-entity-catalog-acorex-platform-module-security-management-client-contracts-entity-catalog-DAZZcjkf.mjs.map → acorex-platform-module-security-management-client-contracts-entity-catalog-acorex-platform-module-security-management-client-contracts-entity-catalog-JP3zTrun.mjs.map} +1 -1
  11. package/fesm2022/{acorex-platform-module-security-management-client-contracts-entity-catalog-device-sessions.entity-DXhQ1_3K.mjs → acorex-platform-module-security-management-client-contracts-entity-catalog-device-sessions.entity-lwQtCJoy.mjs} +23 -4
  12. package/fesm2022/acorex-platform-module-security-management-client-contracts-entity-catalog-device-sessions.entity-lwQtCJoy.mjs.map +1 -0
  13. package/fesm2022/{acorex-platform-module-security-management-client-contracts-entity-catalog-identity-provider.entity-D6g5wMQu.mjs → acorex-platform-module-security-management-client-contracts-entity-catalog-identity-provider.entity-DZfizo-n.mjs} +2 -2
  14. package/fesm2022/{acorex-platform-module-security-management-client-contracts-entity-catalog-identity-provider.entity-D6g5wMQu.mjs.map → acorex-platform-module-security-management-client-contracts-entity-catalog-identity-provider.entity-DZfizo-n.mjs.map} +1 -1
  15. package/fesm2022/{acorex-platform-module-security-management-client-contracts-entity-catalog-policy.entity-DI30j3q8.mjs → acorex-platform-module-security-management-client-contracts-entity-catalog-policy.entity-Dkl_6Iio.mjs} +2 -2
  16. package/fesm2022/{acorex-platform-module-security-management-client-contracts-entity-catalog-policy.entity-DI30j3q8.mjs.map → acorex-platform-module-security-management-client-contracts-entity-catalog-policy.entity-Dkl_6Iio.mjs.map} +1 -1
  17. package/fesm2022/{acorex-platform-module-security-management-client-contracts-entity-catalog-profile.entity-zl0xsn2K.mjs → acorex-platform-module-security-management-client-contracts-entity-catalog-profile.entity-Ddbd-rAG.mjs} +2 -2
  18. package/fesm2022/{acorex-platform-module-security-management-client-contracts-entity-catalog-profile.entity-zl0xsn2K.mjs.map → acorex-platform-module-security-management-client-contracts-entity-catalog-profile.entity-Ddbd-rAG.mjs.map} +1 -1
  19. package/fesm2022/{acorex-platform-module-security-management-client-contracts-entity-catalog-role-permission.entity-Dv93TmJN.mjs → acorex-platform-module-security-management-client-contracts-entity-catalog-role-permission.entity-WCgik8MV.mjs} +2 -2
  20. package/fesm2022/{acorex-platform-module-security-management-client-contracts-entity-catalog-role-permission.entity-Dv93TmJN.mjs.map → acorex-platform-module-security-management-client-contracts-entity-catalog-role-permission.entity-WCgik8MV.mjs.map} +1 -1
  21. package/fesm2022/{acorex-platform-module-security-management-client-contracts-entity-catalog-roles.entity-H53Y7i9P.mjs → acorex-platform-module-security-management-client-contracts-entity-catalog-roles.entity-CRZftClq.mjs} +2 -2
  22. package/fesm2022/{acorex-platform-module-security-management-client-contracts-entity-catalog-roles.entity-H53Y7i9P.mjs.map → acorex-platform-module-security-management-client-contracts-entity-catalog-roles.entity-CRZftClq.mjs.map} +1 -1
  23. package/fesm2022/{acorex-platform-module-security-management-client-contracts-entity-catalog-user-role.entity-i8zSXdbv.mjs → acorex-platform-module-security-management-client-contracts-entity-catalog-user-role.entity-9QpoRCOF.mjs} +2 -2
  24. package/fesm2022/{acorex-platform-module-security-management-client-contracts-entity-catalog-user-role.entity-i8zSXdbv.mjs.map → acorex-platform-module-security-management-client-contracts-entity-catalog-user-role.entity-9QpoRCOF.mjs.map} +1 -1
  25. package/fesm2022/{acorex-platform-module-security-management-client-contracts-entity-catalog-user-two-factor.entity-Bt710bWo.mjs → acorex-platform-module-security-management-client-contracts-entity-catalog-user-two-factor.entity-C34VzcYk.mjs} +2 -2
  26. package/fesm2022/{acorex-platform-module-security-management-client-contracts-entity-catalog-user-two-factor.entity-Bt710bWo.mjs.map → acorex-platform-module-security-management-client-contracts-entity-catalog-user-two-factor.entity-C34VzcYk.mjs.map} +1 -1
  27. package/fesm2022/{acorex-platform-module-security-management-client-contracts-entity-catalog-users.entity-LSatoTXa.mjs → acorex-platform-module-security-management-client-contracts-entity-catalog-users.entity-DuC5cfIb.mjs} +172 -41
  28. package/fesm2022/acorex-platform-module-security-management-client-contracts-entity-catalog-users.entity-DuC5cfIb.mjs.map +1 -0
  29. package/fesm2022/acorex-platform-module-security-management-client-contracts-entity-catalog.mjs +1 -1
  30. package/fesm2022/acorex-platform-module-security-management-client-contracts.mjs +339 -3
  31. package/fesm2022/acorex-platform-module-security-management-client-contracts.mjs.map +1 -1
  32. package/fesm2022/acorex-platform-module-security-management-client-create-user-in-tenant.command-BFnZRmh9.mjs +376 -0
  33. package/fesm2022/acorex-platform-module-security-management-client-create-user-in-tenant.command-BFnZRmh9.mjs.map +1 -0
  34. package/fesm2022/{acorex-platform-module-security-management-client-index-DpAVeAIc.mjs → acorex-platform-module-security-management-client-index-B6qo6qLT.mjs} +5 -156
  35. package/fesm2022/acorex-platform-module-security-management-client-index-B6qo6qLT.mjs.map +1 -0
  36. package/fesm2022/acorex-platform-module-security-management-client-invite-user.command-ClQ6WxxN.mjs +370 -0
  37. package/fesm2022/acorex-platform-module-security-management-client-invite-user.command-ClQ6WxxN.mjs.map +1 -0
  38. package/fesm2022/acorex-platform-module-security-management-client-reject-join-request.command-B3kiok6b.mjs +76 -0
  39. package/fesm2022/acorex-platform-module-security-management-client-reject-join-request.command-B3kiok6b.mjs.map +1 -0
  40. package/fesm2022/{acorex-platform-module-security-management-client-reset-two-factor.command-psTDKoNf.mjs → acorex-platform-module-security-management-client-reset-two-factor.command-C27mUZ1-.mjs} +7 -2
  41. package/fesm2022/acorex-platform-module-security-management-client-reset-two-factor.command-C27mUZ1-.mjs.map +1 -0
  42. package/fesm2022/{acorex-platform-module-security-management-client-send-password-reset-email.command-CoQgWdya.mjs → acorex-platform-module-security-management-client-send-password-reset-email.command-DFxm2T_x.mjs} +7 -2
  43. package/fesm2022/acorex-platform-module-security-management-client-send-password-reset-email.command-DFxm2T_x.mjs.map +1 -0
  44. package/fesm2022/acorex-platform-module-security-management-client-settings.provider-CwDiU-C8.mjs +54 -0
  45. package/fesm2022/acorex-platform-module-security-management-client-settings.provider-CwDiU-C8.mjs.map +1 -0
  46. package/fesm2022/acorex-platform-module-security-management-client-user-role-grant.service-6U17jzjq.mjs +231 -0
  47. package/fesm2022/acorex-platform-module-security-management-client-user-role-grant.service-6U17jzjq.mjs.map +1 -0
  48. package/fesm2022/acorex-platform-module-security-management-client.mjs +1 -1
  49. package/i18n/en-AU/security-management.json +91 -4
  50. package/i18n/en-US/security-management.json +91 -4
  51. package/i18n/fa-IR/security-management.json +91 -4
  52. package/package.json +1 -1
  53. package/types/acorex-platform-module-security-management-client-contracts.d.ts +274 -7
  54. package/fesm2022/acorex-platform-module-security-management-client-acorex-platform-module-security-management-client-CNHPwr3d.mjs.map +0 -1
  55. package/fesm2022/acorex-platform-module-security-management-client-contracts-entity-catalog-device-sessions.entity-DXhQ1_3K.mjs.map +0 -1
  56. package/fesm2022/acorex-platform-module-security-management-client-contracts-entity-catalog-users.entity-LSatoTXa.mjs.map +0 -1
  57. package/fesm2022/acorex-platform-module-security-management-client-create-user-in-tenant.command-CDtT9Ux_.mjs +0 -142
  58. package/fesm2022/acorex-platform-module-security-management-client-create-user-in-tenant.command-CDtT9Ux_.mjs.map +0 -1
  59. package/fesm2022/acorex-platform-module-security-management-client-index-DpAVeAIc.mjs.map +0 -1
  60. package/fesm2022/acorex-platform-module-security-management-client-invite-user.command-kFXjLdxy.mjs +0 -143
  61. package/fesm2022/acorex-platform-module-security-management-client-invite-user.command-kFXjLdxy.mjs.map +0 -1
  62. package/fesm2022/acorex-platform-module-security-management-client-reset-two-factor.command-psTDKoNf.mjs.map +0 -1
  63. package/fesm2022/acorex-platform-module-security-management-client-send-password-reset-email.command-CoQgWdya.mjs.map +0 -1
@@ -0,0 +1,376 @@
1
+ import { AXToastService } from '@acorex/components/toast';
2
+ import { AXTranslationService, resolveMultiLanguageString } from '@acorex/core/translation';
3
+ import { AXPSessionService } from '@acorex-platform/framework-client/auth';
4
+ import { AXPLayoutBuilderService, resolveLayoutBuilderDialogResult } from '@acorex-platform/framework-client/layout/builder';
5
+ import { AXPCommandService } from '@acorex-platform/framework-client/runtime';
6
+ import { AXPWidgetsList } from '@acorex-platform/framework-shared/core';
7
+ import { resolveEntityActionCommandInput } from '@acorex-platform/framework-shared/runtime';
8
+ import { AXMSecurityManagementServerCommands, normalizeCreateApplicationRoleAssignments, flattenCreateApplicationRoleAssignments } from '@acorex-platform/module-security-management-client/contracts';
9
+ export { AXM_USER_CREATE_IN_TENANT_COMMAND } from '@acorex-platform/module-security-management-client/contracts';
10
+ import * as i0 from '@angular/core';
11
+ import { inject, Injectable } from '@angular/core';
12
+ import { A as AXMUserRoleGrantService } from './acorex-platform-module-security-management-client-user-role-grant.service-6U17jzjq.mjs';
13
+
14
+ /** TM edition feature — multi-app create (same gate as TM invite surface). */
15
+ const CREATE_MULTI_APPLICATION_FEATURE = 'TenantManagement:Feature:InviteMultiApplication';
16
+ /** Tenant-wide create surface only — Application Users stay app-scoped. */
17
+ const TENANT_USER_ENTITY = 'TenantManagement.TenantUser';
18
+ const TENANT_USER_ENTITY_NAME = 'TenantUser';
19
+ //#endregion
20
+ //#region ----- Create user in tenant command -----
21
+ class AXPCreateUserInTenantCommand {
22
+ constructor() {
23
+ this.layoutBuilder = inject(AXPLayoutBuilderService);
24
+ this.commandService = inject(AXPCommandService);
25
+ this.toastService = inject(AXToastService);
26
+ this.translationService = inject(AXTranslationService);
27
+ this.sessionService = inject(AXPSessionService);
28
+ this.userRoleGrantService = inject(AXMUserRoleGrantService);
29
+ }
30
+ async execute(input) {
31
+ const actionInput = resolveEntityActionCommandInput(input);
32
+ const form = await this.openCreateDialog(actionInput);
33
+ if (!form) {
34
+ return { success: true, kind: 'object', data: { outcome: 'cancelled' } };
35
+ }
36
+ const tenantMembershipCreate = this.allowsMultiApplicationCreate(actionInput);
37
+ const remotePayload = this.toCreateRemotePayload(form, tenantMembershipCreate);
38
+ // Nested server call must skip toast middleware — this command owns UX toasts.
39
+ const result = await this.commandService.executeRemote(AXMSecurityManagementServerCommands.CreateUserInTenant, remotePayload);
40
+ if (result?.success) {
41
+ const [toastTitle, toastContent] = await Promise.all([
42
+ this.translationService
43
+ .translateAsync('@security-management:users.entities.user.actions.create-in-tenant.success.title')
44
+ .catch(() => 'User Created'),
45
+ this.translationService
46
+ .translateAsync('@security-management:users.entities.user.actions.create-in-tenant.success.description')
47
+ .catch(() => 'The user was created and is ready to sign in.'),
48
+ ]);
49
+ this.toastService.show({ color: 'success', title: toastTitle, content: toastContent, timeOut: 3000 });
50
+ return { success: true, kind: 'object', data: result.data };
51
+ }
52
+ const [toastTitle, fallback] = await Promise.all([
53
+ this.translationService
54
+ .translateAsync('@security-management:users.entities.user.actions.create-in-tenant.error.title')
55
+ .catch(() => 'Create Failed'),
56
+ this.translationService
57
+ .translateAsync('@security-management:users.entities.user.actions.create-in-tenant.error.description')
58
+ .catch(() => 'Failed to create user.'),
59
+ ]);
60
+ const toastContent = (typeof result?.message?.text === 'string' && result.message.text) || fallback;
61
+ this.toastService.show({ color: 'danger', title: toastTitle, content: toastContent, timeOut: 4000 });
62
+ return { success: false, message: { text: toastContent } };
63
+ }
64
+ /**
65
+ * Multi-app repeater only for TM → Tenant Users create (ADR D-05 surface).
66
+ * Security → Users stays current-application only.
67
+ */
68
+ allowsMultiApplicationCreate(actionInput) {
69
+ if (!this.sessionService.isFeatureEnabled(CREATE_MULTI_APPLICATION_FEATURE)) {
70
+ return false;
71
+ }
72
+ const entity = actionInput.entity ?? '';
73
+ const name = actionInput.entityInfo?.name ?? '';
74
+ return entity === TENANT_USER_ENTITY || name === TENANT_USER_ENTITY_NAME;
75
+ }
76
+ toCreateRemotePayload(form, tenantMembershipCreate) {
77
+ const base = {
78
+ email: form.email,
79
+ username: form.username,
80
+ displayName: form.displayName,
81
+ password: form.password,
82
+ tenantMembershipCreate,
83
+ };
84
+ if (!tenantMembershipCreate) {
85
+ const current = this.sessionService.application?.id?.trim();
86
+ return {
87
+ ...base,
88
+ applicationIds: current ? [current] : undefined,
89
+ roleIds: form.roleIds,
90
+ };
91
+ }
92
+ const assignments = normalizeCreateApplicationRoleAssignments(form.applicationRoleRows);
93
+ const flat = flattenCreateApplicationRoleAssignments(assignments);
94
+ return {
95
+ ...base,
96
+ applicationIds: flat.applicationIds,
97
+ roleIds: flat.roleIds.length > 0 ? flat.roleIds : undefined,
98
+ applicationRoleAssignments: assignments,
99
+ };
100
+ }
101
+ async loadCreateEntitledApplicationOptions() {
102
+ const result = await this.commandService.executeRemote(AXMSecurityManagementServerCommands.ListTenantEntitledApplications, {});
103
+ if (!result?.success) {
104
+ return [];
105
+ }
106
+ const payload = result?.data;
107
+ const items = Array.isArray(payload?.items) ? payload.items : [];
108
+ const locale = this.translationService.getActiveLang?.() ?? 'en-US';
109
+ return items
110
+ .map((item) => {
111
+ const id = String(item?.id ?? '').trim();
112
+ if (!id) {
113
+ return null;
114
+ }
115
+ const title = resolveMultiLanguageString(item.title, locale).trim() || id;
116
+ return { id, title };
117
+ })
118
+ .filter((row) => row != null);
119
+ }
120
+ async loadCreateAssignableRoleOptions(applicationId) {
121
+ const result = await this.commandService.executeRemote(AXMSecurityManagementServerCommands.ListInviteAssignableRoles, applicationId ? { applicationId } : {});
122
+ if (!result?.success) {
123
+ return [];
124
+ }
125
+ const payload = result?.data;
126
+ const items = Array.isArray(payload?.items) ? payload.items : [];
127
+ const locale = this.translationService.getActiveLang?.() ?? 'en-US';
128
+ return items
129
+ .map((item) => {
130
+ const id = String(item?.id ?? '').trim();
131
+ const appId = String(item?.applicationId ?? '').trim();
132
+ if (!id || !appId) {
133
+ return null;
134
+ }
135
+ const title = resolveMultiLanguageString(item.title, locale).trim() || id;
136
+ return { id, title, applicationId: appId };
137
+ })
138
+ .filter((row) => row != null);
139
+ }
140
+ /**
141
+ * Per-row Application + Roles for create-in-tenant. Duplicate apps allowed in UI;
142
+ * submit merges via `normalizeCreateApplicationRoleAssignments`.
143
+ */
144
+ buildCreateApplicationRoleRepeaterChildren(entitledApps, roleOptions) {
145
+ return [
146
+ {
147
+ type: AXPWidgetsList.Layouts.FlexLayout,
148
+ mode: 'edit',
149
+ options: {
150
+ flexDirection: 'row',
151
+ gap: '12px',
152
+ alignItems: 'flex-end',
153
+ wrap: 'nowrap',
154
+ },
155
+ children: [
156
+ {
157
+ type: AXPWidgetsList.Layouts.FlexItemLayout,
158
+ mode: 'edit',
159
+ options: { grow: '1', shrink: '1', basis: '0' },
160
+ children: [
161
+ {
162
+ type: AXPWidgetsList.Layouts.FormField,
163
+ mode: 'edit',
164
+ options: {
165
+ label: '@security-management:users.entities.user.actions.create-in-tenant.fields.application',
166
+ showLabel: true,
167
+ },
168
+ children: [
169
+ {
170
+ type: AXPWidgetsList.Editors.SelectBox,
171
+ mode: 'edit',
172
+ path: 'applicationId',
173
+ name: 'applicationId',
174
+ options: {
175
+ dataSource: entitledApps,
176
+ valueField: 'id',
177
+ textField: 'title',
178
+ allowSearch: true,
179
+ validations: [{ rule: 'required' }],
180
+ },
181
+ },
182
+ ],
183
+ },
184
+ ],
185
+ },
186
+ {
187
+ type: AXPWidgetsList.Layouts.FlexItemLayout,
188
+ mode: 'edit',
189
+ options: { grow: '1', shrink: '1', basis: '0' },
190
+ children: [
191
+ {
192
+ type: AXPWidgetsList.Layouts.FormField,
193
+ mode: 'edit',
194
+ options: {
195
+ label: '@security-management:users.entities.user.actions.create-in-tenant.fields.roles',
196
+ showLabel: true,
197
+ },
198
+ children: [
199
+ {
200
+ type: AXPWidgetsList.Editors.SelectBox,
201
+ mode: 'edit',
202
+ path: 'roleIds',
203
+ name: 'roleIds',
204
+ options: {
205
+ dataSource: roleOptions,
206
+ valueField: 'id',
207
+ textField: 'title',
208
+ multiple: true,
209
+ allowSearch: true,
210
+ disabled: "{{ !context.eval('>applicationId') }}",
211
+ filter: {
212
+ field: 'applicationId',
213
+ operator: { type: 'equal' },
214
+ value: "{{ context.eval('>applicationId') }}",
215
+ },
216
+ },
217
+ triggers: [
218
+ {
219
+ event: "{{ events.context('>applicationId') }}",
220
+ action: '{{ widget.setValue([]); widget.refresh(); }}',
221
+ },
222
+ ],
223
+ },
224
+ ],
225
+ },
226
+ ],
227
+ },
228
+ ],
229
+ },
230
+ ];
231
+ }
232
+ async openCreateDialog(actionInput) {
233
+ const multiApp = this.allowsMultiApplicationCreate(actionInput);
234
+ const [entitledApps, createRoleOptions, productRoleOptions] = await Promise.all([
235
+ multiApp
236
+ ? this.loadCreateEntitledApplicationOptions()
237
+ : Promise.resolve([]),
238
+ multiApp
239
+ ? this.loadCreateAssignableRoleOptions()
240
+ : Promise.resolve([]),
241
+ multiApp
242
+ ? Promise.resolve([])
243
+ : this.userRoleGrantService.listInviteRoleOptions('application'),
244
+ ]);
245
+ const appsWithRoles = new Set(createRoleOptions.map((row) => row.applicationId));
246
+ const selectableApps = appsWithRoles.size > 0
247
+ ? entitledApps.filter((app) => appsWithRoles.has(app.id))
248
+ : entitledApps;
249
+ const result = await this.layoutBuilder
250
+ .create()
251
+ .dialog((dialog) => {
252
+ dialog
253
+ .setTitle('@security-management:users.entities.user.actions.create-in-tenant.dialog.title')
254
+ .setSize(multiApp ? 'lg' : 'md')
255
+ .setCloseButton(true)
256
+ .setContext(multiApp
257
+ ? {
258
+ email: '',
259
+ username: '',
260
+ displayName: '',
261
+ password: '',
262
+ applicationRoleRows: [{ applicationId: '', roleIds: [] }],
263
+ }
264
+ : {
265
+ email: '',
266
+ username: '',
267
+ displayName: '',
268
+ password: '',
269
+ roleIds: [],
270
+ })
271
+ .content((flex) => {
272
+ flex
273
+ .setDirection('column')
274
+ .setGap('12px')
275
+ .formField('@security-management:users.entities.user.actions.create-in-tenant.fields.email', (field) => {
276
+ field.path('email');
277
+ field.textBox({ validations: [{ rule: 'email' }] });
278
+ })
279
+ .formField('@security-management:users.entities.user.actions.create-in-tenant.fields.username', (field) => {
280
+ field.path('username');
281
+ field.textBox({});
282
+ })
283
+ .formField('@security-management:users.entities.user.actions.create-in-tenant.fields.display-name', (field) => {
284
+ field.path('displayName');
285
+ field.textBox({});
286
+ })
287
+ .formField('@security-management:users.entities.user.actions.create-in-tenant.fields.password', (field) => {
288
+ field.path('password');
289
+ field.passwordBox({
290
+ revealToggle: true,
291
+ validations: [{ rule: 'required' }, { rule: 'minLength', options: { value: 6 } }],
292
+ });
293
+ });
294
+ if (multiApp) {
295
+ flex.formField('@security-management:users.entities.user.actions.create-in-tenant.fields.application-roles', (field) => {
296
+ field.path('applicationRoleRows');
297
+ field.setShowLabel(true);
298
+ field.customWidget(AXPWidgetsList.Layouts.RepeaterLayout, {
299
+ hasControls: true,
300
+ inlineAddControl: true,
301
+ defaultItem: { applicationId: '', roleIds: [] },
302
+ children: this.buildCreateApplicationRoleRepeaterChildren(selectableApps, createRoleOptions),
303
+ });
304
+ });
305
+ }
306
+ else {
307
+ flex.formField('@security-management:users.entities.user.actions.create-in-tenant.fields.roles', (field) => {
308
+ field.path('roleIds');
309
+ field.selectBox({
310
+ dataSource: productRoleOptions,
311
+ valueField: 'id',
312
+ textField: 'title',
313
+ multiple: true,
314
+ validations: [{ rule: 'required' }],
315
+ });
316
+ });
317
+ }
318
+ })
319
+ .setActions((actions) => {
320
+ actions.cancel('@general:actions.cancel.title');
321
+ actions.submit('@security-management:users.entities.user.actions.create-in-tenant.dialog.submit');
322
+ })
323
+ .onAction(async (dialogRef) => {
324
+ if (dialogRef.action() === 'cancel') {
325
+ return null;
326
+ }
327
+ const ctx = dialogRef.context();
328
+ const email = (ctx.email ?? '').trim() || undefined;
329
+ const username = (ctx.username ?? '').trim() || undefined;
330
+ if (!email && !username) {
331
+ throw new Error('@security-management:users.entities.user.actions.create-in-tenant.errors.identity-required');
332
+ }
333
+ if (multiApp) {
334
+ const assignments = normalizeCreateApplicationRoleAssignments(ctx.applicationRoleRows);
335
+ if (assignments.length === 0) {
336
+ throw new Error('@security-management:users.entities.user.actions.create-in-tenant.errors.application-required');
337
+ }
338
+ if (assignments.some((row) => row.roleIds.length === 0)) {
339
+ throw new Error('@security-management:users.entities.user.actions.create-in-tenant.errors.roles-required');
340
+ }
341
+ return {
342
+ email,
343
+ username,
344
+ displayName: (ctx.displayName ?? '').trim() || undefined,
345
+ password: (ctx.password ?? '').trim() || undefined,
346
+ applicationRoleRows: assignments,
347
+ };
348
+ }
349
+ const roleIds = Array.isArray(ctx.roleIds)
350
+ ? [...new Set(ctx.roleIds.map((id) => String(id).trim()).filter(Boolean))]
351
+ : [];
352
+ if (roleIds.length === 0) {
353
+ throw new Error('@security-management:users.entities.user.actions.create-in-tenant.errors.roles-required');
354
+ }
355
+ return {
356
+ email,
357
+ username,
358
+ displayName: (ctx.displayName ?? '').trim() || undefined,
359
+ password: (ctx.password ?? '').trim() || undefined,
360
+ roleIds,
361
+ };
362
+ });
363
+ })
364
+ .show();
365
+ return resolveLayoutBuilderDialogResult(result);
366
+ }
367
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: AXPCreateUserInTenantCommand, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
368
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: AXPCreateUserInTenantCommand, providedIn: 'root' }); }
369
+ }
370
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: AXPCreateUserInTenantCommand, decorators: [{
371
+ type: Injectable,
372
+ args: [{ providedIn: 'root' }]
373
+ }] });
374
+
375
+ export { AXPCreateUserInTenantCommand };
376
+ //# sourceMappingURL=acorex-platform-module-security-management-client-create-user-in-tenant.command-BFnZRmh9.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"acorex-platform-module-security-management-client-create-user-in-tenant.command-BFnZRmh9.mjs","sources":["../../../../libs/modules/security-management/client/src/lib/commands/create-user-in-tenant.command.ts"],"sourcesContent":["import { AXToastService } from '@acorex/components/toast';\nimport { AXTranslationService, resolveMultiLanguageString } from '@acorex/core/translation';\nimport { AXPSessionService } from '@acorex-platform/framework-client/auth';\nimport {\n AXPLayoutBuilderService,\n resolveLayoutBuilderDialogResult,\n} from '@acorex-platform/framework-client/layout/builder';\nimport { AXPCommandService } from '@acorex-platform/framework-client/runtime';\nimport { AXPWidgetsList } from '@acorex-platform/framework-shared/core';\nimport type {\n AXPCommand,\n AXPCommandExecuteResultPromise,\n AXPEntityActionCommandInput,\n} from '@acorex-platform/framework-shared/runtime';\nimport { resolveEntityActionCommandInput } from '@acorex-platform/framework-shared/runtime';\nimport {\n AXM_USER_CREATE_IN_TENANT_COMMAND,\n AXMSecurityManagementServerCommands,\n flattenCreateApplicationRoleAssignments,\n normalizeCreateApplicationRoleAssignments,\n type AXMListInviteAssignableRolesResult,\n type AXMListTenantEntitledApplicationsResult,\n} from '@acorex-platform/module-security-management-client/contracts';\nimport { inject, Injectable } from '@angular/core';\nimport { AXMUserRoleGrantService } from '../features/user-roles/user-role-grant.service';\nimport type { UserRoleOption } from '../features/user-roles/user-role-grant.types';\n\n//#region ----- Types -----\n\ninterface CreateApplicationRoleRow {\n id?: string;\n applicationId?: string;\n roleIds?: string[];\n}\n\ninterface CreateInTenantFormResult {\n email?: string;\n username?: string;\n displayName?: string;\n password?: string;\n roleIds?: string[];\n applicationRoleRows?: CreateApplicationRoleRow[];\n}\n\ninterface EntitledApplicationOption {\n id: string;\n title: string;\n}\n\ninterface CreateRoleOption {\n id: string;\n title: string;\n applicationId: string;\n}\n\ninterface CreateRemotePayload {\n email?: string;\n username?: string;\n displayName?: string;\n password?: string;\n applicationIds?: string[];\n roleIds?: string[];\n applicationRoleAssignments?: Array<{ applicationId: string; roleIds: string[] }>;\n tenantMembershipCreate: boolean;\n}\n\n/** TM edition feature — multi-app create (same gate as TM invite surface). */\nconst CREATE_MULTI_APPLICATION_FEATURE = 'TenantManagement:Feature:InviteMultiApplication';\n\n/** Tenant-wide create surface only — Application Users stay app-scoped. */\nconst TENANT_USER_ENTITY = 'TenantManagement.TenantUser';\nconst TENANT_USER_ENTITY_NAME = 'TenantUser';\n\n//#endregion\n\n//#region ----- Create user in tenant command -----\n\n@Injectable({ providedIn: 'root' })\nexport class AXPCreateUserInTenantCommand implements AXPCommand {\n private readonly layoutBuilder = inject(AXPLayoutBuilderService);\n private readonly commandService = inject(AXPCommandService);\n private readonly toastService = inject(AXToastService);\n private readonly translationService = inject(AXTranslationService);\n private readonly sessionService = inject(AXPSessionService);\n private readonly userRoleGrantService = inject(AXMUserRoleGrantService);\n\n async execute(input?: unknown): AXPCommandExecuteResultPromise {\n const actionInput = resolveEntityActionCommandInput(input);\n const form = await this.openCreateDialog(actionInput);\n if (!form) {\n return { success: true, kind: 'object', data: { outcome: 'cancelled' } };\n }\n\n const tenantMembershipCreate = this.allowsMultiApplicationCreate(actionInput);\n const remotePayload = this.toCreateRemotePayload(form, tenantMembershipCreate);\n\n // Nested server call must skip toast middleware — this command owns UX toasts.\n const result = await this.commandService.executeRemote(\n AXMSecurityManagementServerCommands.CreateUserInTenant,\n remotePayload,\n );\n\n if (result?.success) {\n const [toastTitle, toastContent] = await Promise.all([\n this.translationService\n .translateAsync('@security-management:users.entities.user.actions.create-in-tenant.success.title')\n .catch(() => 'User Created'),\n this.translationService\n .translateAsync(\n '@security-management:users.entities.user.actions.create-in-tenant.success.description',\n )\n .catch(() => 'The user was created and is ready to sign in.'),\n ]);\n this.toastService.show({ color: 'success', title: toastTitle, content: toastContent, timeOut: 3000 });\n return { success: true, kind: 'object', data: result.data };\n }\n\n const [toastTitle, fallback] = await Promise.all([\n this.translationService\n .translateAsync('@security-management:users.entities.user.actions.create-in-tenant.error.title')\n .catch(() => 'Create Failed'),\n this.translationService\n .translateAsync(\n '@security-management:users.entities.user.actions.create-in-tenant.error.description',\n )\n .catch(() => 'Failed to create user.'),\n ]);\n const toastContent =\n (typeof result?.message?.text === 'string' && result.message.text) || fallback;\n this.toastService.show({ color: 'danger', title: toastTitle, content: toastContent, timeOut: 4000 });\n return { success: false, message: { text: toastContent } };\n }\n\n /**\n * Multi-app repeater only for TM → Tenant Users create (ADR D-05 surface).\n * Security → Users stays current-application only.\n */\n private allowsMultiApplicationCreate(actionInput: AXPEntityActionCommandInput): boolean {\n if (!this.sessionService.isFeatureEnabled(CREATE_MULTI_APPLICATION_FEATURE)) {\n return false;\n }\n const entity = actionInput.entity ?? '';\n const name = actionInput.entityInfo?.name ?? '';\n return entity === TENANT_USER_ENTITY || name === TENANT_USER_ENTITY_NAME;\n }\n\n private toCreateRemotePayload(\n form: CreateInTenantFormResult,\n tenantMembershipCreate: boolean,\n ): CreateRemotePayload {\n const base: CreateRemotePayload = {\n email: form.email,\n username: form.username,\n displayName: form.displayName,\n password: form.password,\n tenantMembershipCreate,\n };\n\n if (!tenantMembershipCreate) {\n const current = this.sessionService.application?.id?.trim();\n return {\n ...base,\n applicationIds: current ? [current] : undefined,\n roleIds: form.roleIds,\n };\n }\n\n const assignments = normalizeCreateApplicationRoleAssignments(form.applicationRoleRows);\n const flat = flattenCreateApplicationRoleAssignments(assignments);\n return {\n ...base,\n applicationIds: flat.applicationIds,\n roleIds: flat.roleIds.length > 0 ? flat.roleIds : undefined,\n applicationRoleAssignments: assignments,\n };\n }\n\n private async loadCreateEntitledApplicationOptions(): Promise<EntitledApplicationOption[]> {\n const result = await this.commandService.executeRemote(\n AXMSecurityManagementServerCommands.ListTenantEntitledApplications,\n {},\n );\n if (!result?.success) {\n return [];\n }\n const payload = (result as { data?: AXMListTenantEntitledApplicationsResult })?.data;\n const items = Array.isArray(payload?.items) ? payload.items : [];\n const locale = this.translationService.getActiveLang?.() ?? 'en-US';\n return items\n .map((item) => {\n const id = String(item?.id ?? '').trim();\n if (!id) {\n return null;\n }\n const title =\n resolveMultiLanguageString(item.title as never, locale).trim() || id;\n return { id, title };\n })\n .filter((row): row is EntitledApplicationOption => row != null);\n }\n\n private async loadCreateAssignableRoleOptions(applicationId?: string): Promise<CreateRoleOption[]> {\n const result = await this.commandService.executeRemote(\n AXMSecurityManagementServerCommands.ListInviteAssignableRoles,\n applicationId ? { applicationId } : {},\n );\n if (!result?.success) {\n return [];\n }\n const payload = (result as { data?: AXMListInviteAssignableRolesResult })?.data;\n const items = Array.isArray(payload?.items) ? payload.items : [];\n const locale = this.translationService.getActiveLang?.() ?? 'en-US';\n return items\n .map((item) => {\n const id = String(item?.id ?? '').trim();\n const appId = String(item?.applicationId ?? '').trim();\n if (!id || !appId) {\n return null;\n }\n const title =\n resolveMultiLanguageString(item.title as never, locale).trim() || id;\n return { id, title, applicationId: appId };\n })\n .filter((row): row is CreateRoleOption => row != null);\n }\n\n /**\n * Per-row Application + Roles for create-in-tenant. Duplicate apps allowed in UI;\n * submit merges via `normalizeCreateApplicationRoleAssignments`.\n */\n private buildCreateApplicationRoleRepeaterChildren(\n entitledApps: EntitledApplicationOption[],\n roleOptions: CreateRoleOption[],\n ): Record<string, unknown>[] {\n return [\n {\n type: AXPWidgetsList.Layouts.FlexLayout,\n mode: 'edit' as const,\n options: {\n flexDirection: 'row',\n gap: '12px',\n alignItems: 'flex-end',\n wrap: 'nowrap',\n },\n children: [\n {\n type: AXPWidgetsList.Layouts.FlexItemLayout,\n mode: 'edit' as const,\n options: { grow: '1', shrink: '1', basis: '0' },\n children: [\n {\n type: AXPWidgetsList.Layouts.FormField,\n mode: 'edit' as const,\n options: {\n label:\n '@security-management:users.entities.user.actions.create-in-tenant.fields.application',\n showLabel: true,\n },\n children: [\n {\n type: AXPWidgetsList.Editors.SelectBox,\n mode: 'edit' as const,\n path: 'applicationId',\n name: 'applicationId',\n options: {\n dataSource: entitledApps,\n valueField: 'id',\n textField: 'title',\n allowSearch: true,\n validations: [{ rule: 'required' }],\n },\n },\n ],\n },\n ],\n },\n {\n type: AXPWidgetsList.Layouts.FlexItemLayout,\n mode: 'edit' as const,\n options: { grow: '1', shrink: '1', basis: '0' },\n children: [\n {\n type: AXPWidgetsList.Layouts.FormField,\n mode: 'edit' as const,\n options: {\n label:\n '@security-management:users.entities.user.actions.create-in-tenant.fields.roles',\n showLabel: true,\n },\n children: [\n {\n type: AXPWidgetsList.Editors.SelectBox,\n mode: 'edit' as const,\n path: 'roleIds',\n name: 'roleIds',\n options: {\n dataSource: roleOptions,\n valueField: 'id',\n textField: 'title',\n multiple: true,\n allowSearch: true,\n disabled: \"{{ !context.eval('>applicationId') }}\",\n filter: {\n field: 'applicationId',\n operator: { type: 'equal' },\n value: \"{{ context.eval('>applicationId') }}\",\n },\n },\n triggers: [\n {\n event: \"{{ events.context('>applicationId') }}\",\n action: '{{ widget.setValue([]); widget.refresh(); }}',\n },\n ],\n },\n ],\n },\n ],\n },\n ],\n },\n ];\n }\n\n private async openCreateDialog(\n actionInput: AXPEntityActionCommandInput,\n ): Promise<CreateInTenantFormResult | null> {\n const multiApp = this.allowsMultiApplicationCreate(actionInput);\n const [entitledApps, createRoleOptions, productRoleOptions] = await Promise.all([\n multiApp\n ? this.loadCreateEntitledApplicationOptions()\n : Promise.resolve([] as EntitledApplicationOption[]),\n multiApp\n ? this.loadCreateAssignableRoleOptions()\n : Promise.resolve([] as CreateRoleOption[]),\n multiApp\n ? Promise.resolve([] as UserRoleOption[])\n : this.userRoleGrantService.listInviteRoleOptions('application'),\n ]);\n const appsWithRoles = new Set(createRoleOptions.map((row) => row.applicationId));\n const selectableApps =\n appsWithRoles.size > 0\n ? entitledApps.filter((app) => appsWithRoles.has(app.id))\n : entitledApps;\n\n const result = await this.layoutBuilder\n .create()\n .dialog<CreateInTenantFormResult | null>((dialog) => {\n dialog\n .setTitle('@security-management:users.entities.user.actions.create-in-tenant.dialog.title')\n .setSize(multiApp ? 'lg' : 'md')\n .setCloseButton(true)\n .setContext(\n multiApp\n ? {\n email: '',\n username: '',\n displayName: '',\n password: '',\n applicationRoleRows: [{ applicationId: '', roleIds: [] }],\n }\n : {\n email: '',\n username: '',\n displayName: '',\n password: '',\n roleIds: [],\n },\n )\n .content((flex) => {\n flex\n .setDirection('column')\n .setGap('12px')\n .formField(\n '@security-management:users.entities.user.actions.create-in-tenant.fields.email',\n (field) => {\n field.path('email');\n field.textBox({ validations: [{ rule: 'email' }] });\n },\n )\n .formField(\n '@security-management:users.entities.user.actions.create-in-tenant.fields.username',\n (field) => {\n field.path('username');\n field.textBox({});\n },\n )\n .formField(\n '@security-management:users.entities.user.actions.create-in-tenant.fields.display-name',\n (field) => {\n field.path('displayName');\n field.textBox({});\n },\n )\n .formField(\n '@security-management:users.entities.user.actions.create-in-tenant.fields.password',\n (field) => {\n field.path('password');\n field.passwordBox({\n revealToggle: true,\n validations: [{ rule: 'required' }, { rule: 'minLength', options: { value: 6 } }],\n });\n },\n );\n\n if (multiApp) {\n flex.formField(\n '@security-management:users.entities.user.actions.create-in-tenant.fields.application-roles',\n (field) => {\n field.path('applicationRoleRows');\n field.setShowLabel(true);\n field.customWidget(AXPWidgetsList.Layouts.RepeaterLayout, {\n hasControls: true,\n inlineAddControl: true,\n defaultItem: { applicationId: '', roleIds: [] },\n children: this.buildCreateApplicationRoleRepeaterChildren(\n selectableApps,\n createRoleOptions,\n ),\n });\n },\n );\n } else {\n flex.formField(\n '@security-management:users.entities.user.actions.create-in-tenant.fields.roles',\n (field) => {\n field.path('roleIds');\n field.selectBox({\n dataSource: productRoleOptions as UserRoleOption[],\n valueField: 'id',\n textField: 'title',\n multiple: true,\n validations: [{ rule: 'required' }],\n });\n },\n );\n }\n })\n .setActions((actions) => {\n actions.cancel('@general:actions.cancel.title');\n actions.submit(\n '@security-management:users.entities.user.actions.create-in-tenant.dialog.submit',\n );\n })\n .onAction(async (dialogRef) => {\n if (dialogRef.action() === 'cancel') {\n return null;\n }\n const ctx = dialogRef.context() as CreateInTenantFormResult;\n const email = (ctx.email ?? '').trim() || undefined;\n const username = (ctx.username ?? '').trim() || undefined;\n if (!email && !username) {\n throw new Error(\n '@security-management:users.entities.user.actions.create-in-tenant.errors.identity-required',\n );\n }\n\n if (multiApp) {\n const assignments = normalizeCreateApplicationRoleAssignments(ctx.applicationRoleRows);\n if (assignments.length === 0) {\n throw new Error(\n '@security-management:users.entities.user.actions.create-in-tenant.errors.application-required',\n );\n }\n if (assignments.some((row) => row.roleIds.length === 0)) {\n throw new Error(\n '@security-management:users.entities.user.actions.create-in-tenant.errors.roles-required',\n );\n }\n return {\n email,\n username,\n displayName: (ctx.displayName ?? '').trim() || undefined,\n password: (ctx.password ?? '').trim() || undefined,\n applicationRoleRows: assignments,\n };\n }\n\n const roleIds = Array.isArray(ctx.roleIds)\n ? [...new Set(ctx.roleIds.map((id) => String(id).trim()).filter(Boolean))]\n : [];\n if (roleIds.length === 0) {\n throw new Error(\n '@security-management:users.entities.user.actions.create-in-tenant.errors.roles-required',\n );\n }\n return {\n email,\n username,\n displayName: (ctx.displayName ?? '').trim() || undefined,\n password: (ctx.password ?? '').trim() || undefined,\n roleIds,\n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AC,QAAQ,IAAI,EAAE,EAAE,IAAI,EAAE,IAAI,SAAS;oBAClD,OAAO;iBACR;AACH,YAAA,CAAC,CAAC;AACN,QAAA,CAAC;AACA,aAAA,IAAI,EAAE;AAET,QAAA,OAAO,gCAAgC,CAA2B,MAAM,CAAC;IAC3E;8GApaW,4BAA4B,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,UAAA,EAAA,CAAA,CAAA;AAA5B,IAAA,SAAA,IAAA,CAAA,KAAA,GAAA,EAAA,CAAA,qBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,4BAA4B,cADf,MAAM,EAAA,CAAA,CAAA;;2FACnB,4BAA4B,EAAA,UAAA,EAAA,CAAA;kBADxC,UAAU;mBAAC,EAAE,UAAU,EAAE,MAAM,EAAE;;;"}
@@ -8,164 +8,13 @@ import * as i12 from '@acorex/core/translation';
8
8
  import { AXTranslationModule } from '@acorex/core/translation';
9
9
  import { AsyncPipe } from '@angular/common';
10
10
  import * as i0 from '@angular/core';
11
- import { inject, Injectable, input, signal, computed, effect, untracked, ChangeDetectionStrategy, Component } from '@angular/core';
11
+ import { input, inject, signal, computed, effect, untracked, ChangeDetectionStrategy, Component, Injectable } from '@angular/core';
12
12
  import * as i2 from '@angular/forms';
13
13
  import { FormsModule } from '@angular/forms';
14
14
  import { isEqual } from 'lodash-es';
15
- import { r as resolvePersistedEntityId } from './acorex-platform-module-security-management-client-acorex-platform-module-security-management-client-CNHPwr3d.mjs';
16
- import { AXPSessionService } from '@acorex-platform/framework-client/auth';
17
- import { AXPEntityBroadcastService } from '@acorex-platform/framework-client/core';
18
- import { AXPEntityDefinitionRegistryService, AXPEntityService, dispatchEntityModifiedSideEffects } from '@acorex-platform/framework-client/layout/entity';
19
- import { RootConfig, USER_ROLES_PAGE_COMPONENT_KEY } from '@acorex-platform/module-security-management-client/contracts';
20
-
21
- //#region ----- Imports -----
22
- //#endregion
23
- //#region ----- Service -----
24
- /**
25
- * Loads and persists scoped UserRole assignments for a user.
26
- * Shared by the User roles detail page.
27
- */
28
- class AXMUserRoleGrantService {
29
- constructor() {
30
- //#region ----- Services & Dependencies -----
31
- this.entityRegistry = inject(AXPEntityDefinitionRegistryService);
32
- this.entityService = inject(AXPEntityService);
33
- this.sessionService = inject(AXPSessionService);
34
- this.entityEvents = inject(AXPEntityBroadcastService);
35
- }
36
- //#endregion
37
- //#region ----- Scope -----
38
- resolveSessionScope() {
39
- const tenantId = this.sessionService.tenant?.id;
40
- if (!tenantId) {
41
- return null;
42
- }
43
- return {
44
- tenantId,
45
- applicationId: this.sessionService.application?.id,
46
- };
47
- }
48
- //#endregion
49
- //#region ----- Query -----
50
- userRoleData() {
51
- return this.entityService
52
- .withEntity(RootConfig.module.name, RootConfig.entities.userRole.name)
53
- .data();
54
- }
55
- /**
56
- * Roles available to assign in the current workspace.
57
- * Also loads any already-assigned role ids that list queries hide (`stateInfo.isHidden`).
58
- */
59
- async listRoleOptions(includeRoleIds = []) {
60
- const roleData = this.entityService
61
- .withEntity(RootConfig.module.name, RootConfig.entities.roles.name)
62
- .data();
63
- const result = await roleData.query({
64
- skip: 0,
65
- take: 500,
66
- });
67
- const byId = new Map();
68
- const items = (result?.items ?? []);
69
- for (const item of items) {
70
- const id = String(item['id'] ?? '');
71
- if (!id) {
72
- continue;
73
- }
74
- byId.set(id, {
75
- id,
76
- title: String(item['title'] ?? item['name'] ?? ''),
77
- name: typeof item['name'] === 'string' ? item['name'] : undefined,
78
- });
79
- }
80
- const missingIds = includeRoleIds.filter((id) => id && !byId.has(id));
81
- await Promise.all(missingIds.map(async (id) => {
82
- try {
83
- const row = (await roleData.byKey(id));
84
- if (!row?.['id']) {
85
- return;
86
- }
87
- byId.set(String(row['id']), {
88
- id: String(row['id']),
89
- title: String(row['title'] ?? row['name'] ?? row['id']),
90
- name: typeof row['name'] === 'string' ? row['name'] : undefined,
91
- });
92
- }
93
- catch {
94
- /* role missing or inaccessible */
95
- }
96
- }));
97
- return [...byId.values()].sort((a, b) => a.title.localeCompare(b.title));
98
- }
99
- async findGrant(userId, tenantId, applicationId) {
100
- const result = await this.userRoleData().query({
101
- skip: 0,
102
- take: 50,
103
- filter: {
104
- logic: 'and',
105
- filters: [
106
- { field: 'userId', operator: { type: 'equal' }, value: userId },
107
- { field: 'scopeInfo.tenantId', operator: { type: 'equal' }, value: tenantId },
108
- ],
109
- },
110
- });
111
- const items = (result?.items ?? []);
112
- if (items.length === 0) {
113
- return null;
114
- }
115
- if (applicationId) {
116
- const appMatch = items.find((item) => item.scopeInfo?.applicationId === applicationId);
117
- if (appMatch) {
118
- return appMatch;
119
- }
120
- }
121
- const tenantWide = items.find((item) => !item.scopeInfo?.applicationId);
122
- return tenantWide ?? items[0] ?? null;
123
- }
124
- //#endregion
125
- //#region ----- Persist -----
126
- async saveGrant(options) {
127
- const existingState = options.existing?.stateInfo;
128
- if (existingState?.isSystem === true || existingState?.isImmutable === true) {
129
- throw new Error('System user role grants are readonly.');
130
- }
131
- const entityKey = `${RootConfig.module.name}.${RootConfig.entities.userRole.name}`;
132
- const [moduleName, entityName] = entityKey.split('.');
133
- const entityRef = await this.entityRegistry.resolve(moduleName, entityName);
134
- const scopeInfo = {
135
- tenantId: options.tenantId,
136
- ...(options.existing?.scopeInfo?.applicationId
137
- ? { applicationId: options.existing.scopeInfo.applicationId }
138
- : options.applicationId
139
- ? { applicationId: options.applicationId }
140
- : {}),
141
- };
142
- if (options.existing?.id) {
143
- const updatePayload = {
144
- ...options.existing,
145
- userId: options.userId,
146
- roleIds: options.roleIds,
147
- scopeInfo,
148
- };
149
- return (entityRef.commands?.update?.execute)(updatePayload);
150
- }
151
- const createPayload = {
152
- userId: options.userId,
153
- roleIds: options.roleIds,
154
- scopeInfo,
155
- };
156
- return (entityRef.commands?.create?.execute)(createPayload);
157
- }
158
- notifyGrantModified(saved) {
159
- const entityKey = `${RootConfig.module.name}.${RootConfig.entities.userRole.name}`;
160
- dispatchEntityModifiedSideEffects(this.entityEvents, entityKey, saved);
161
- }
162
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: AXMUserRoleGrantService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
163
- static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: AXMUserRoleGrantService, providedIn: 'root' }); }
164
- }
165
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: AXMUserRoleGrantService, decorators: [{
166
- type: Injectable,
167
- args: [{ providedIn: 'root' }]
168
- }] });
15
+ import { r as resolvePersistedEntityId } from './acorex-platform-module-security-management-client-acorex-platform-module-security-management-client-B61j_cJF.mjs';
16
+ import { A as AXMUserRoleGrantService } from './acorex-platform-module-security-management-client-user-role-grant.service-6U17jzjq.mjs';
17
+ import { USER_ROLES_PAGE_COMPONENT_KEY } from '@acorex-platform/module-security-management-client/contracts';
169
18
 
170
19
  //#endregion
171
20
  //#region ----- Constants -----
@@ -459,4 +308,4 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.8", ngImpor
459
308
  }] });
460
309
 
461
310
  export { AXMUserRolesPageComponent, AXMUserRolesPageComponentProvider };
462
- //# sourceMappingURL=acorex-platform-module-security-management-client-index-DpAVeAIc.mjs.map
311
+ //# sourceMappingURL=acorex-platform-module-security-management-client-index-B6qo6qLT.mjs.map