valtech-components 4.0.154 → 4.0.155

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.
@@ -65,6 +65,42 @@ export declare const guestGuard: CanActivateFn;
65
65
  * ```
66
66
  */
67
67
  export declare function permissionGuard(permissions: string | string[]): CanActivateFn;
68
+ /**
69
+ * Factory de guard RBAC parametrizable — defense-in-depth a nivel de RUTA.
70
+ *
71
+ * Variante ergonómica de {@link permissionGuard} con firma variádica
72
+ * (`rbacGuard('a:read', 'b:manage')` en vez de `permissionGuard(['a:read', 'b:manage'])`),
73
+ * pensada para gatear vistas administrativas montadas vía los `provideValtech*Routes`
74
+ * de la lib. Pasa si el usuario tiene **AL MENOS UNO** de los permisos (OR), igual que
75
+ * el resto del gating del factory (`*valHasPermission`, menú). El match de wildcards
76
+ * (`*:*`, `resource:*`, `*:action`) lo resuelve `AuthService.hasPermission`.
77
+ *
78
+ * Es una capa ADICIONAL al gating fino dentro de los componentes (botones por
79
+ * `*valHasPermission`) y al 403 del backend — no los reemplaza. Sin permiso redirige
80
+ * a `unauthorizedRoute` (mismo destino que `permissionGuard`).
81
+ *
82
+ * @param permissions - Uno o más permisos requeridos (OR)
83
+ * @returns Guard function
84
+ *
85
+ * @example
86
+ * ```typescript
87
+ * import { rbacGuard } from 'valtech-components';
88
+ *
89
+ * const routes: Routes = [
90
+ * {
91
+ * path: 'api-keys',
92
+ * canActivate: [rbacGuard('api-keys:read')],
93
+ * component: ApiKeysViewComponent,
94
+ * },
95
+ * {
96
+ * path: 'permissions',
97
+ * canActivate: [rbacGuard('roles:read', 'rbac:manage')],
98
+ * component: PermissionsViewComponent,
99
+ * },
100
+ * ];
101
+ * ```
102
+ */
103
+ export declare function rbacGuard(...permissions: string[]): CanActivateFn;
68
104
  /**
69
105
  * Guard que lee permisos desde route.data.
70
106
  * Permite configurar permisos directamente en la definición de rutas.
@@ -71,7 +71,7 @@
71
71
  export * from './types';
72
72
  export { VALTECH_AUTH_CONFIG, provideValtechAuth, provideValtechAuthInterceptor, DEFAULT_AUTH_CONFIG, } from './config';
73
73
  export { AuthService } from './auth.service';
74
- export { authGuard, guestGuard, permissionGuard, permissionGuardFromRoute, superAdminGuard, roleGuard, } from './guards';
74
+ export { authGuard, guestGuard, permissionGuard, permissionGuardFromRoute, rbacGuard, superAdminGuard, roleGuard, } from './guards';
75
75
  export { authInterceptor } from './interceptor';
76
76
  export { AuthStateService } from './auth-state.service';
77
77
  export { TokenService } from './token.service';
package/lib/version.d.ts CHANGED
@@ -2,4 +2,4 @@
2
2
  * Current version of valtech-components.
3
3
  * This is automatically updated during the publish process.
4
4
  */
5
- export declare const VERSION = "4.0.154";
5
+ export declare const VERSION = "4.0.155";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "valtech-components",
3
- "version": "4.0.154",
3
+ "version": "4.0.155",
4
4
  "private": false,
5
5
  "bin": {
6
6
  "valtech-firebase-config": "./src/lib/services/firebase/scripts/generate-sw-config.js"