@fiado/type-kit 3.124.0 → 3.125.0
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/_test_/unit/platformRbac/enums/__snapshots__/permissionBits.test.ts.snap +37 -1
- package/bin/platformRbac/dtos/CreateTenantResponse.d.ts +14 -3
- package/bin/platformRbac/enums/Permission.d.ts +37 -1
- package/bin/platformRbac/enums/Permission.js +79 -0
- package/bin/platformRbac/enums/PermissionCategory.d.ts +4 -1
- package/bin/platformRbac/enums/PermissionCategory.js +5 -0
- package/bin/platformRbac/index.d.ts +3 -0
- package/package.json +1 -1
- package/src/platformRbac/dtos/CreateTenantResponse.ts +15 -3
- package/src/platformRbac/dtos/TenantDetailResponse.ts +20 -0
- package/src/platformRbac/dtos/TenantStatus.ts +12 -0
- package/src/platformRbac/dtos/VerifyTenantInfraResponse.ts +16 -0
- package/src/platformRbac/enums/Permission.ts +80 -0
- package/src/platformRbac/enums/PermissionCategory.ts +5 -0
- package/src/platformRbac/index.ts +4 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// Jest Snapshot v1, https://jestjs.io/docs/snapshot-testing
|
|
2
2
|
|
|
3
|
-
exports[`PERMISSION_BIT_ORDER PERMS_VERSION es número estable 1`] = `
|
|
3
|
+
exports[`PERMISSION_BIT_ORDER PERMS_VERSION es número estable 1`] = `1703336986`;
|
|
4
4
|
|
|
5
5
|
exports[`PERMISSION_BIT_ORDER append-only: snapshot del ORDEN COMPLETO (rompe ante cualquier reorden/inserción) 1`] = `
|
|
6
6
|
[
|
|
@@ -126,5 +126,41 @@ exports[`PERMISSION_BIT_ORDER append-only: snapshot del ORDEN COMPLETO (rompe an
|
|
|
126
126
|
"platform.application.manage",
|
|
127
127
|
"tenant.level.manage",
|
|
128
128
|
"platform.tenant.autoregister.manage",
|
|
129
|
+
"level1.user.create",
|
|
130
|
+
"level1.user.read",
|
|
131
|
+
"level1.user.update",
|
|
132
|
+
"level1.user.delete",
|
|
133
|
+
"level1.role.create",
|
|
134
|
+
"level1.role.list",
|
|
135
|
+
"level1.role.view",
|
|
136
|
+
"level1.role.update",
|
|
137
|
+
"level1.role.delete",
|
|
138
|
+
"level1.role.assign",
|
|
139
|
+
"level1.role.revoke",
|
|
140
|
+
"level1.audit.view",
|
|
141
|
+
"level2.user.create",
|
|
142
|
+
"level2.user.read",
|
|
143
|
+
"level2.user.update",
|
|
144
|
+
"level2.user.delete",
|
|
145
|
+
"level2.role.create",
|
|
146
|
+
"level2.role.list",
|
|
147
|
+
"level2.role.view",
|
|
148
|
+
"level2.role.update",
|
|
149
|
+
"level2.role.delete",
|
|
150
|
+
"level2.role.assign",
|
|
151
|
+
"level2.role.revoke",
|
|
152
|
+
"level2.audit.view",
|
|
153
|
+
"level3.user.create",
|
|
154
|
+
"level3.user.read",
|
|
155
|
+
"level3.user.update",
|
|
156
|
+
"level3.user.delete",
|
|
157
|
+
"level3.role.create",
|
|
158
|
+
"level3.role.list",
|
|
159
|
+
"level3.role.view",
|
|
160
|
+
"level3.role.update",
|
|
161
|
+
"level3.role.delete",
|
|
162
|
+
"level3.role.assign",
|
|
163
|
+
"level3.role.revoke",
|
|
164
|
+
"level3.audit.view",
|
|
129
165
|
]
|
|
130
166
|
`;
|
|
@@ -1,12 +1,23 @@
|
|
|
1
|
+
import { TenantStatus } from './TenantStatus';
|
|
1
2
|
/**
|
|
2
3
|
* Output del POST backoffice de creación de tenant (F-11). Response plain sin validators
|
|
3
4
|
* (no validamos lo que mandamos al cliente — fiado-validation-and-dtos § 7).
|
|
5
|
+
*
|
|
6
|
+
* DEC-RBAC-058 (aditivo): el response expone el `status` resultante; si quedó `pending-infra`,
|
|
7
|
+
* viaja `infraRequirements` con las tablas del silo faltantes. `adminCognitoSub`/`temporaryPassword`
|
|
8
|
+
* pasan a OPCIONALES (no se quitan): el alta clásica con admin los setea; el alta sin admin
|
|
9
|
+
* (DEC-RBAC-057) no. `status`/`infraRequirements` son opcionales para back-compat con el alta clásica.
|
|
4
10
|
*/
|
|
5
11
|
export interface CreateTenantResponse {
|
|
6
12
|
tenantId: string;
|
|
7
13
|
userPoolId: string;
|
|
8
14
|
appClientId: string;
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
15
|
+
/** Presente en el alta CON admin (flujo clásico F-11). Opcional: el alta sin admin (DEC-RBAC-057) no lo setea. */
|
|
16
|
+
adminCognitoSub?: string;
|
|
17
|
+
/** Fallback out-of-band mientras el correo de invitación no entrega (F-11). Opcional (ver adminCognitoSub). */
|
|
18
|
+
temporaryPassword?: string;
|
|
19
|
+
/** Estado resultante del onboarding (DEC-RBAC-058). Opcional para back-compat; `active` o `pending-infra` en el happy path. */
|
|
20
|
+
status?: TenantStatus;
|
|
21
|
+
/** Nombres de tablas del silo faltantes. Presente solo cuando `status === 'pending-infra'` (DEC-RBAC-058). */
|
|
22
|
+
infraRequirements?: string[];
|
|
12
23
|
}
|
|
@@ -155,7 +155,43 @@ export declare enum Permission {
|
|
|
155
155
|
AGENTS_EXPORT_RUN = "agents.export.run",
|
|
156
156
|
AGENTS_CATALOG_VIEW = "agents.catalog.view",
|
|
157
157
|
AGENTS_GROUP_MANAGE = "agents.group.manage",
|
|
158
|
-
AGENTS_GROUP_USER_MANAGE = "agents.group.user.manage"
|
|
158
|
+
AGENTS_GROUP_USER_MANAGE = "agents.group.user.manage",
|
|
159
|
+
LEVEL1_USER_CREATE = "level1.user.create",
|
|
160
|
+
LEVEL1_USER_READ = "level1.user.read",
|
|
161
|
+
LEVEL1_USER_UPDATE = "level1.user.update",
|
|
162
|
+
LEVEL1_USER_DELETE = "level1.user.delete",
|
|
163
|
+
LEVEL1_ROLE_CREATE = "level1.role.create",
|
|
164
|
+
LEVEL1_ROLE_LIST = "level1.role.list",
|
|
165
|
+
LEVEL1_ROLE_VIEW = "level1.role.view",
|
|
166
|
+
LEVEL1_ROLE_UPDATE = "level1.role.update",
|
|
167
|
+
LEVEL1_ROLE_DELETE = "level1.role.delete",
|
|
168
|
+
LEVEL1_ROLE_ASSIGN = "level1.role.assign",
|
|
169
|
+
LEVEL1_ROLE_REVOKE = "level1.role.revoke",
|
|
170
|
+
LEVEL1_AUDIT_VIEW = "level1.audit.view",
|
|
171
|
+
LEVEL2_USER_CREATE = "level2.user.create",
|
|
172
|
+
LEVEL2_USER_READ = "level2.user.read",
|
|
173
|
+
LEVEL2_USER_UPDATE = "level2.user.update",
|
|
174
|
+
LEVEL2_USER_DELETE = "level2.user.delete",
|
|
175
|
+
LEVEL2_ROLE_CREATE = "level2.role.create",
|
|
176
|
+
LEVEL2_ROLE_LIST = "level2.role.list",
|
|
177
|
+
LEVEL2_ROLE_VIEW = "level2.role.view",
|
|
178
|
+
LEVEL2_ROLE_UPDATE = "level2.role.update",
|
|
179
|
+
LEVEL2_ROLE_DELETE = "level2.role.delete",
|
|
180
|
+
LEVEL2_ROLE_ASSIGN = "level2.role.assign",
|
|
181
|
+
LEVEL2_ROLE_REVOKE = "level2.role.revoke",
|
|
182
|
+
LEVEL2_AUDIT_VIEW = "level2.audit.view",
|
|
183
|
+
LEVEL3_USER_CREATE = "level3.user.create",
|
|
184
|
+
LEVEL3_USER_READ = "level3.user.read",
|
|
185
|
+
LEVEL3_USER_UPDATE = "level3.user.update",
|
|
186
|
+
LEVEL3_USER_DELETE = "level3.user.delete",
|
|
187
|
+
LEVEL3_ROLE_CREATE = "level3.role.create",
|
|
188
|
+
LEVEL3_ROLE_LIST = "level3.role.list",
|
|
189
|
+
LEVEL3_ROLE_VIEW = "level3.role.view",
|
|
190
|
+
LEVEL3_ROLE_UPDATE = "level3.role.update",
|
|
191
|
+
LEVEL3_ROLE_DELETE = "level3.role.delete",
|
|
192
|
+
LEVEL3_ROLE_ASSIGN = "level3.role.assign",
|
|
193
|
+
LEVEL3_ROLE_REVOKE = "level3.role.revoke",
|
|
194
|
+
LEVEL3_AUDIT_VIEW = "level3.audit.view"
|
|
159
195
|
}
|
|
160
196
|
/**
|
|
161
197
|
* Orden CANÓNICO y APPEND-ONLY de los permisos para el bitset del token.
|
|
@@ -209,6 +209,47 @@ var Permission;
|
|
|
209
209
|
// Gestión de usuarios DENTRO de un grupo (scope GROUP — el group_owner/admin sobre su grupo; el
|
|
210
210
|
// operador la cubre por TENANT). Crea usuarios + asigna roles group_* acotado al groupId. DEC-102.
|
|
211
211
|
Permission["AGENTS_GROUP_USER_MANAGE"] = "agents.group.user.manage";
|
|
212
|
+
// ====================================================
|
|
213
|
+
// LEVEL{1,2,3} — primitivas RBAC genéricas por nivel (DEC-RBAC-063, ADITIVO)
|
|
214
|
+
// Permisos básicos auto-sembrables por nivel genérico (data-driven). Coexisten con los
|
|
215
|
+
// legacy retail.*/agents.* (categorías @deprecated), NO los reemplazan en la línea 3.x.
|
|
216
|
+
// ====================================================
|
|
217
|
+
Permission["LEVEL1_USER_CREATE"] = "level1.user.create";
|
|
218
|
+
Permission["LEVEL1_USER_READ"] = "level1.user.read";
|
|
219
|
+
Permission["LEVEL1_USER_UPDATE"] = "level1.user.update";
|
|
220
|
+
Permission["LEVEL1_USER_DELETE"] = "level1.user.delete";
|
|
221
|
+
Permission["LEVEL1_ROLE_CREATE"] = "level1.role.create";
|
|
222
|
+
Permission["LEVEL1_ROLE_LIST"] = "level1.role.list";
|
|
223
|
+
Permission["LEVEL1_ROLE_VIEW"] = "level1.role.view";
|
|
224
|
+
Permission["LEVEL1_ROLE_UPDATE"] = "level1.role.update";
|
|
225
|
+
Permission["LEVEL1_ROLE_DELETE"] = "level1.role.delete";
|
|
226
|
+
Permission["LEVEL1_ROLE_ASSIGN"] = "level1.role.assign";
|
|
227
|
+
Permission["LEVEL1_ROLE_REVOKE"] = "level1.role.revoke";
|
|
228
|
+
Permission["LEVEL1_AUDIT_VIEW"] = "level1.audit.view";
|
|
229
|
+
Permission["LEVEL2_USER_CREATE"] = "level2.user.create";
|
|
230
|
+
Permission["LEVEL2_USER_READ"] = "level2.user.read";
|
|
231
|
+
Permission["LEVEL2_USER_UPDATE"] = "level2.user.update";
|
|
232
|
+
Permission["LEVEL2_USER_DELETE"] = "level2.user.delete";
|
|
233
|
+
Permission["LEVEL2_ROLE_CREATE"] = "level2.role.create";
|
|
234
|
+
Permission["LEVEL2_ROLE_LIST"] = "level2.role.list";
|
|
235
|
+
Permission["LEVEL2_ROLE_VIEW"] = "level2.role.view";
|
|
236
|
+
Permission["LEVEL2_ROLE_UPDATE"] = "level2.role.update";
|
|
237
|
+
Permission["LEVEL2_ROLE_DELETE"] = "level2.role.delete";
|
|
238
|
+
Permission["LEVEL2_ROLE_ASSIGN"] = "level2.role.assign";
|
|
239
|
+
Permission["LEVEL2_ROLE_REVOKE"] = "level2.role.revoke";
|
|
240
|
+
Permission["LEVEL2_AUDIT_VIEW"] = "level2.audit.view";
|
|
241
|
+
Permission["LEVEL3_USER_CREATE"] = "level3.user.create";
|
|
242
|
+
Permission["LEVEL3_USER_READ"] = "level3.user.read";
|
|
243
|
+
Permission["LEVEL3_USER_UPDATE"] = "level3.user.update";
|
|
244
|
+
Permission["LEVEL3_USER_DELETE"] = "level3.user.delete";
|
|
245
|
+
Permission["LEVEL3_ROLE_CREATE"] = "level3.role.create";
|
|
246
|
+
Permission["LEVEL3_ROLE_LIST"] = "level3.role.list";
|
|
247
|
+
Permission["LEVEL3_ROLE_VIEW"] = "level3.role.view";
|
|
248
|
+
Permission["LEVEL3_ROLE_UPDATE"] = "level3.role.update";
|
|
249
|
+
Permission["LEVEL3_ROLE_DELETE"] = "level3.role.delete";
|
|
250
|
+
Permission["LEVEL3_ROLE_ASSIGN"] = "level3.role.assign";
|
|
251
|
+
Permission["LEVEL3_ROLE_REVOKE"] = "level3.role.revoke";
|
|
252
|
+
Permission["LEVEL3_AUDIT_VIEW"] = "level3.audit.view";
|
|
212
253
|
})(Permission || (exports.Permission = Permission = {}));
|
|
213
254
|
/**
|
|
214
255
|
* Orden CANÓNICO y APPEND-ONLY de los permisos para el bitset del token.
|
|
@@ -360,6 +401,44 @@ exports.PERMISSION_BIT_ORDER = [
|
|
|
360
401
|
// Append-only 2026-06-25 (DEC-RBAC-050): edición del autoregistro self-service del tenant (allowlist
|
|
361
402
|
// anti-escalación). Al FINAL para no correr bits existentes (PERMS_VERSION cambia, índices previos se conservan).
|
|
362
403
|
Permission.PLATFORM_TENANT_AUTOREGISTER_MANAGE,
|
|
404
|
+
// Append-only 2026-06-28 (DEC-RBAC-063): 36 primitivas RBAC por nivel genérico. Al FINAL para no
|
|
405
|
+
// correr bits existentes (PERMS_VERSION cambia, índices previos se conservan).
|
|
406
|
+
Permission.LEVEL1_USER_CREATE,
|
|
407
|
+
Permission.LEVEL1_USER_READ,
|
|
408
|
+
Permission.LEVEL1_USER_UPDATE,
|
|
409
|
+
Permission.LEVEL1_USER_DELETE,
|
|
410
|
+
Permission.LEVEL1_ROLE_CREATE,
|
|
411
|
+
Permission.LEVEL1_ROLE_LIST,
|
|
412
|
+
Permission.LEVEL1_ROLE_VIEW,
|
|
413
|
+
Permission.LEVEL1_ROLE_UPDATE,
|
|
414
|
+
Permission.LEVEL1_ROLE_DELETE,
|
|
415
|
+
Permission.LEVEL1_ROLE_ASSIGN,
|
|
416
|
+
Permission.LEVEL1_ROLE_REVOKE,
|
|
417
|
+
Permission.LEVEL1_AUDIT_VIEW,
|
|
418
|
+
Permission.LEVEL2_USER_CREATE,
|
|
419
|
+
Permission.LEVEL2_USER_READ,
|
|
420
|
+
Permission.LEVEL2_USER_UPDATE,
|
|
421
|
+
Permission.LEVEL2_USER_DELETE,
|
|
422
|
+
Permission.LEVEL2_ROLE_CREATE,
|
|
423
|
+
Permission.LEVEL2_ROLE_LIST,
|
|
424
|
+
Permission.LEVEL2_ROLE_VIEW,
|
|
425
|
+
Permission.LEVEL2_ROLE_UPDATE,
|
|
426
|
+
Permission.LEVEL2_ROLE_DELETE,
|
|
427
|
+
Permission.LEVEL2_ROLE_ASSIGN,
|
|
428
|
+
Permission.LEVEL2_ROLE_REVOKE,
|
|
429
|
+
Permission.LEVEL2_AUDIT_VIEW,
|
|
430
|
+
Permission.LEVEL3_USER_CREATE,
|
|
431
|
+
Permission.LEVEL3_USER_READ,
|
|
432
|
+
Permission.LEVEL3_USER_UPDATE,
|
|
433
|
+
Permission.LEVEL3_USER_DELETE,
|
|
434
|
+
Permission.LEVEL3_ROLE_CREATE,
|
|
435
|
+
Permission.LEVEL3_ROLE_LIST,
|
|
436
|
+
Permission.LEVEL3_ROLE_VIEW,
|
|
437
|
+
Permission.LEVEL3_ROLE_UPDATE,
|
|
438
|
+
Permission.LEVEL3_ROLE_DELETE,
|
|
439
|
+
Permission.LEVEL3_ROLE_ASSIGN,
|
|
440
|
+
Permission.LEVEL3_ROLE_REVOKE,
|
|
441
|
+
Permission.LEVEL3_AUDIT_VIEW,
|
|
363
442
|
];
|
|
364
443
|
function djb2(input) {
|
|
365
444
|
let h = 5381;
|
|
@@ -13,5 +13,8 @@ export declare enum PermissionCategory {
|
|
|
13
13
|
AUDIT = "audit",
|
|
14
14
|
PAY = "pay",
|
|
15
15
|
/** @deprecated DEC-RBAC-062/063: se consolida en niveles genéricos (LEVEL_n) data-driven. Migración de tenants pendiente; no usar en código nuevo. */
|
|
16
|
-
AGENTS = "agents"
|
|
16
|
+
AGENTS = "agents",
|
|
17
|
+
LEVEL1 = "level1",
|
|
18
|
+
LEVEL2 = "level2",
|
|
19
|
+
LEVEL3 = "level3"
|
|
17
20
|
}
|
|
@@ -18,4 +18,9 @@ var PermissionCategory;
|
|
|
18
18
|
PermissionCategory["PAY"] = "pay";
|
|
19
19
|
/** @deprecated DEC-RBAC-062/063: se consolida en niveles genéricos (LEVEL_n) data-driven. Migración de tenants pendiente; no usar en código nuevo. */
|
|
20
20
|
PermissionCategory["AGENTS"] = "agents";
|
|
21
|
+
// DEC-RBAC-063 (aditivo): categorías de las primitivas RBAC por nivel genérico.
|
|
22
|
+
// Coexisten con RETAIL/AGENTS (@deprecated), no los reemplazan en la línea 3.x.
|
|
23
|
+
PermissionCategory["LEVEL1"] = "level1";
|
|
24
|
+
PermissionCategory["LEVEL2"] = "level2";
|
|
25
|
+
PermissionCategory["LEVEL3"] = "level3";
|
|
21
26
|
})(PermissionCategory || (exports.PermissionCategory = PermissionCategory = {}));
|
|
@@ -26,6 +26,9 @@ export * from './dtos/AuthorizeRequest';
|
|
|
26
26
|
export * from './dtos/AuthorizeResponse';
|
|
27
27
|
export * from './dtos/CreateTenantRequest';
|
|
28
28
|
export type { CreateTenantResponse } from './dtos/CreateTenantResponse';
|
|
29
|
+
export type { TenantStatus } from './dtos/TenantStatus';
|
|
30
|
+
export type { VerifyTenantInfraResponse } from './dtos/VerifyTenantInfraResponse';
|
|
31
|
+
export type { TenantDetailResponse } from './dtos/TenantDetailResponse';
|
|
29
32
|
export * from './dtos/UpdateTenantSecurityPolicyRequest';
|
|
30
33
|
export type { TenantSecurityPolicyResponse } from './dtos/TenantSecurityPolicyResponse';
|
|
31
34
|
export * from './dtos/UpdateTenantAutoregisterRequest';
|
package/package.json
CHANGED
|
@@ -1,12 +1,24 @@
|
|
|
1
|
+
import { TenantStatus } from './TenantStatus';
|
|
2
|
+
|
|
1
3
|
/**
|
|
2
4
|
* Output del POST backoffice de creación de tenant (F-11). Response plain sin validators
|
|
3
5
|
* (no validamos lo que mandamos al cliente — fiado-validation-and-dtos § 7).
|
|
6
|
+
*
|
|
7
|
+
* DEC-RBAC-058 (aditivo): el response expone el `status` resultante; si quedó `pending-infra`,
|
|
8
|
+
* viaja `infraRequirements` con las tablas del silo faltantes. `adminCognitoSub`/`temporaryPassword`
|
|
9
|
+
* pasan a OPCIONALES (no se quitan): el alta clásica con admin los setea; el alta sin admin
|
|
10
|
+
* (DEC-RBAC-057) no. `status`/`infraRequirements` son opcionales para back-compat con el alta clásica.
|
|
4
11
|
*/
|
|
5
12
|
export interface CreateTenantResponse {
|
|
6
13
|
tenantId: string;
|
|
7
14
|
userPoolId: string;
|
|
8
15
|
appClientId: string;
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
16
|
+
/** Presente en el alta CON admin (flujo clásico F-11). Opcional: el alta sin admin (DEC-RBAC-057) no lo setea. */
|
|
17
|
+
adminCognitoSub?: string;
|
|
18
|
+
/** Fallback out-of-band mientras el correo de invitación no entrega (F-11). Opcional (ver adminCognitoSub). */
|
|
19
|
+
temporaryPassword?: string;
|
|
20
|
+
/** Estado resultante del onboarding (DEC-RBAC-058). Opcional para back-compat; `active` o `pending-infra` en el happy path. */
|
|
21
|
+
status?: TenantStatus;
|
|
22
|
+
/** Nombres de tablas del silo faltantes. Presente solo cuando `status === 'pending-infra'` (DEC-RBAC-058). */
|
|
23
|
+
infraRequirements?: string[];
|
|
12
24
|
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { TenantStatus } from './TenantStatus';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Output del GET backoffice de detalle de tenant (F-11). Response plain sin validators
|
|
5
|
+
* (no validamos lo que mandamos al cliente — fiado-validation-and-dtos § 7).
|
|
6
|
+
*
|
|
7
|
+
* Superficie de contrato que el frontend consume para la feature de infra (DEC-RBAC-058/059):
|
|
8
|
+
* `status` (que ahora incluye `pending-infra`) e `infraRequirements` (tablas del silo faltantes,
|
|
9
|
+
* presente solo en `pending-infra`). El detalle completo del tenant (cognitoPool, branding,
|
|
10
|
+
* securityPolicy, etc.) lo arma el manager a partir del Row; este DTO declara los campos del
|
|
11
|
+
* contrato relevantes a la feature sin duplicar el shape interno del Row.
|
|
12
|
+
*/
|
|
13
|
+
export interface TenantDetailResponse {
|
|
14
|
+
tenantId: string;
|
|
15
|
+
displayName: string;
|
|
16
|
+
tablePrefix: string;
|
|
17
|
+
status: TenantStatus;
|
|
18
|
+
/** Nombres de tablas del silo faltantes. Presente solo cuando `status === 'pending-infra'`. */
|
|
19
|
+
infraRequirements?: string[];
|
|
20
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Estado de un tenant del platform-rbac-business (F-11 — onboarding de tenant).
|
|
3
|
+
*
|
|
4
|
+
* - `provisioning`: saga de onboarding en curso (estado transitorio).
|
|
5
|
+
* - `active`: tenant operativo (config + pool + roles sembrados).
|
|
6
|
+
* - `suspended`: tenant deshabilitado (saga abortada y compensada, o suspensión manual).
|
|
7
|
+
* - `pending-infra` (DEC-RBAC-058): el pre-check de infra encontró tablas del silo faltantes.
|
|
8
|
+
* El tenant quedó creado pero inutilizable hasta que infra cree las tablas; los nombres
|
|
9
|
+
* faltantes viajan en `infraRequirements`. No se sembraron roles. Re-verificable vía
|
|
10
|
+
* `POST /platform/tenants/{tenantId}/verify-infra` (DEC-RBAC-059).
|
|
11
|
+
*/
|
|
12
|
+
export type TenantStatus = 'provisioning' | 'active' | 'suspended' | 'pending-infra';
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { TenantStatus } from './TenantStatus';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Output del POST backoffice `verify-infra` (DEC-RBAC-059) — re-verificación de la infra del silo
|
|
5
|
+
* de un tenant `pending-infra`. Response plain sin validators (fiado-validation-and-dtos § 7).
|
|
6
|
+
* El `tenantId` viaja en el path, no hay request DTO.
|
|
7
|
+
*
|
|
8
|
+
* - Si ya están todas las tablas → siembra roles diferida → `status === 'active'` (sin `infraRequirements`).
|
|
9
|
+
* - Si aún faltan → `status === 'pending-infra'` + `infraRequirements` con los faltantes actuales.
|
|
10
|
+
* - Si el tenant no estaba `pending-infra` → no-op idempotente: devuelve el status actual.
|
|
11
|
+
*/
|
|
12
|
+
export interface VerifyTenantInfraResponse {
|
|
13
|
+
status: TenantStatus;
|
|
14
|
+
/** Nombres de tablas del silo aún faltantes. Presente solo cuando `status === 'pending-infra'`. */
|
|
15
|
+
infraRequirements?: string[];
|
|
16
|
+
}
|
|
@@ -210,6 +210,48 @@ export enum Permission {
|
|
|
210
210
|
// Gestión de usuarios DENTRO de un grupo (scope GROUP — el group_owner/admin sobre su grupo; el
|
|
211
211
|
// operador la cubre por TENANT). Crea usuarios + asigna roles group_* acotado al groupId. DEC-102.
|
|
212
212
|
AGENTS_GROUP_USER_MANAGE = 'agents.group.user.manage',
|
|
213
|
+
|
|
214
|
+
// ====================================================
|
|
215
|
+
// LEVEL{1,2,3} — primitivas RBAC genéricas por nivel (DEC-RBAC-063, ADITIVO)
|
|
216
|
+
// Permisos básicos auto-sembrables por nivel genérico (data-driven). Coexisten con los
|
|
217
|
+
// legacy retail.*/agents.* (categorías @deprecated), NO los reemplazan en la línea 3.x.
|
|
218
|
+
// ====================================================
|
|
219
|
+
LEVEL1_USER_CREATE = 'level1.user.create',
|
|
220
|
+
LEVEL1_USER_READ = 'level1.user.read',
|
|
221
|
+
LEVEL1_USER_UPDATE = 'level1.user.update',
|
|
222
|
+
LEVEL1_USER_DELETE = 'level1.user.delete',
|
|
223
|
+
LEVEL1_ROLE_CREATE = 'level1.role.create',
|
|
224
|
+
LEVEL1_ROLE_LIST = 'level1.role.list',
|
|
225
|
+
LEVEL1_ROLE_VIEW = 'level1.role.view',
|
|
226
|
+
LEVEL1_ROLE_UPDATE = 'level1.role.update',
|
|
227
|
+
LEVEL1_ROLE_DELETE = 'level1.role.delete',
|
|
228
|
+
LEVEL1_ROLE_ASSIGN = 'level1.role.assign',
|
|
229
|
+
LEVEL1_ROLE_REVOKE = 'level1.role.revoke',
|
|
230
|
+
LEVEL1_AUDIT_VIEW = 'level1.audit.view',
|
|
231
|
+
LEVEL2_USER_CREATE = 'level2.user.create',
|
|
232
|
+
LEVEL2_USER_READ = 'level2.user.read',
|
|
233
|
+
LEVEL2_USER_UPDATE = 'level2.user.update',
|
|
234
|
+
LEVEL2_USER_DELETE = 'level2.user.delete',
|
|
235
|
+
LEVEL2_ROLE_CREATE = 'level2.role.create',
|
|
236
|
+
LEVEL2_ROLE_LIST = 'level2.role.list',
|
|
237
|
+
LEVEL2_ROLE_VIEW = 'level2.role.view',
|
|
238
|
+
LEVEL2_ROLE_UPDATE = 'level2.role.update',
|
|
239
|
+
LEVEL2_ROLE_DELETE = 'level2.role.delete',
|
|
240
|
+
LEVEL2_ROLE_ASSIGN = 'level2.role.assign',
|
|
241
|
+
LEVEL2_ROLE_REVOKE = 'level2.role.revoke',
|
|
242
|
+
LEVEL2_AUDIT_VIEW = 'level2.audit.view',
|
|
243
|
+
LEVEL3_USER_CREATE = 'level3.user.create',
|
|
244
|
+
LEVEL3_USER_READ = 'level3.user.read',
|
|
245
|
+
LEVEL3_USER_UPDATE = 'level3.user.update',
|
|
246
|
+
LEVEL3_USER_DELETE = 'level3.user.delete',
|
|
247
|
+
LEVEL3_ROLE_CREATE = 'level3.role.create',
|
|
248
|
+
LEVEL3_ROLE_LIST = 'level3.role.list',
|
|
249
|
+
LEVEL3_ROLE_VIEW = 'level3.role.view',
|
|
250
|
+
LEVEL3_ROLE_UPDATE = 'level3.role.update',
|
|
251
|
+
LEVEL3_ROLE_DELETE = 'level3.role.delete',
|
|
252
|
+
LEVEL3_ROLE_ASSIGN = 'level3.role.assign',
|
|
253
|
+
LEVEL3_ROLE_REVOKE = 'level3.role.revoke',
|
|
254
|
+
LEVEL3_AUDIT_VIEW = 'level3.audit.view',
|
|
213
255
|
}
|
|
214
256
|
|
|
215
257
|
/**
|
|
@@ -362,6 +404,44 @@ export const PERMISSION_BIT_ORDER: readonly Permission[] = [
|
|
|
362
404
|
// Append-only 2026-06-25 (DEC-RBAC-050): edición del autoregistro self-service del tenant (allowlist
|
|
363
405
|
// anti-escalación). Al FINAL para no correr bits existentes (PERMS_VERSION cambia, índices previos se conservan).
|
|
364
406
|
Permission.PLATFORM_TENANT_AUTOREGISTER_MANAGE,
|
|
407
|
+
// Append-only 2026-06-28 (DEC-RBAC-063): 36 primitivas RBAC por nivel genérico. Al FINAL para no
|
|
408
|
+
// correr bits existentes (PERMS_VERSION cambia, índices previos se conservan).
|
|
409
|
+
Permission.LEVEL1_USER_CREATE,
|
|
410
|
+
Permission.LEVEL1_USER_READ,
|
|
411
|
+
Permission.LEVEL1_USER_UPDATE,
|
|
412
|
+
Permission.LEVEL1_USER_DELETE,
|
|
413
|
+
Permission.LEVEL1_ROLE_CREATE,
|
|
414
|
+
Permission.LEVEL1_ROLE_LIST,
|
|
415
|
+
Permission.LEVEL1_ROLE_VIEW,
|
|
416
|
+
Permission.LEVEL1_ROLE_UPDATE,
|
|
417
|
+
Permission.LEVEL1_ROLE_DELETE,
|
|
418
|
+
Permission.LEVEL1_ROLE_ASSIGN,
|
|
419
|
+
Permission.LEVEL1_ROLE_REVOKE,
|
|
420
|
+
Permission.LEVEL1_AUDIT_VIEW,
|
|
421
|
+
Permission.LEVEL2_USER_CREATE,
|
|
422
|
+
Permission.LEVEL2_USER_READ,
|
|
423
|
+
Permission.LEVEL2_USER_UPDATE,
|
|
424
|
+
Permission.LEVEL2_USER_DELETE,
|
|
425
|
+
Permission.LEVEL2_ROLE_CREATE,
|
|
426
|
+
Permission.LEVEL2_ROLE_LIST,
|
|
427
|
+
Permission.LEVEL2_ROLE_VIEW,
|
|
428
|
+
Permission.LEVEL2_ROLE_UPDATE,
|
|
429
|
+
Permission.LEVEL2_ROLE_DELETE,
|
|
430
|
+
Permission.LEVEL2_ROLE_ASSIGN,
|
|
431
|
+
Permission.LEVEL2_ROLE_REVOKE,
|
|
432
|
+
Permission.LEVEL2_AUDIT_VIEW,
|
|
433
|
+
Permission.LEVEL3_USER_CREATE,
|
|
434
|
+
Permission.LEVEL3_USER_READ,
|
|
435
|
+
Permission.LEVEL3_USER_UPDATE,
|
|
436
|
+
Permission.LEVEL3_USER_DELETE,
|
|
437
|
+
Permission.LEVEL3_ROLE_CREATE,
|
|
438
|
+
Permission.LEVEL3_ROLE_LIST,
|
|
439
|
+
Permission.LEVEL3_ROLE_VIEW,
|
|
440
|
+
Permission.LEVEL3_ROLE_UPDATE,
|
|
441
|
+
Permission.LEVEL3_ROLE_DELETE,
|
|
442
|
+
Permission.LEVEL3_ROLE_ASSIGN,
|
|
443
|
+
Permission.LEVEL3_ROLE_REVOKE,
|
|
444
|
+
Permission.LEVEL3_AUDIT_VIEW,
|
|
365
445
|
] as const;
|
|
366
446
|
|
|
367
447
|
function djb2(input: string): number {
|
|
@@ -14,4 +14,9 @@ export enum PermissionCategory {
|
|
|
14
14
|
PAY = 'pay',
|
|
15
15
|
/** @deprecated DEC-RBAC-062/063: se consolida en niveles genéricos (LEVEL_n) data-driven. Migración de tenants pendiente; no usar en código nuevo. */
|
|
16
16
|
AGENTS = 'agents',
|
|
17
|
+
// DEC-RBAC-063 (aditivo): categorías de las primitivas RBAC por nivel genérico.
|
|
18
|
+
// Coexisten con RETAIL/AGENTS (@deprecated), no los reemplazan en la línea 3.x.
|
|
19
|
+
LEVEL1 = 'level1',
|
|
20
|
+
LEVEL2 = 'level2',
|
|
21
|
+
LEVEL3 = 'level3',
|
|
17
22
|
}
|
|
@@ -51,6 +51,10 @@ export * from './dtos/AuthorizeResponse';
|
|
|
51
51
|
// decoradores class-validator → export de valor; CreateTenantResponse es interface → type-only.
|
|
52
52
|
export * from './dtos/CreateTenantRequest';
|
|
53
53
|
export type { CreateTenantResponse } from './dtos/CreateTenantResponse';
|
|
54
|
+
// DEC-RBAC-058/059 (aditivo) — tenant pending-infra + verify-infra
|
|
55
|
+
export type { TenantStatus } from './dtos/TenantStatus';
|
|
56
|
+
export type { VerifyTenantInfraResponse } from './dtos/VerifyTenantInfraResponse';
|
|
57
|
+
export type { TenantDetailResponse } from './dtos/TenantDetailResponse';
|
|
54
58
|
|
|
55
59
|
// MFA por tenant — methodsAllowed (value-set 'EMAIL'|'TOTP', TD-RBAC-071, DEC-095).
|
|
56
60
|
// UpdateTenantSecurityPolicyRequest lleva decoradores class-validator → export de valor;
|