oip-common 0.3.1 → 0.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.
@@ -1280,12 +1280,20 @@ class BaseModuleComponent {
1280
1280
  t(key, interpolateParams) {
1281
1281
  return this.translateService.instant(key, interpolateParams);
1282
1282
  }
1283
+ /**
1284
+ * Checks whether the current user has the specified security right.
1285
+ */
1286
+ hasRight(code) {
1287
+ return this.hasSecurityRight(this.securityRoles, this.securitySettings, code);
1288
+ }
1283
1289
  /**
1284
1290
  * Initializes the component and subscribes to local settings updates.
1285
1291
  */
1286
1292
  constructor() {
1287
1293
  this.isInitialized = false;
1288
1294
  this.moduleInstanceReloadPromise = Promise.resolve();
1295
+ this.securityRoles = [];
1296
+ this.securitySettings = [];
1289
1297
  this.destroyRef = inject(DestroyRef);
1290
1298
  this.securityService = inject(SecurityService);
1291
1299
  this.httpClient = inject(HttpClient);
@@ -1493,8 +1501,12 @@ class BaseModuleComponent {
1493
1501
  this.canEdit = false;
1494
1502
  this.canDelete = false;
1495
1503
  this.securityRightsLoaded = false;
1504
+ this.securityRoles = [];
1505
+ this.securitySettings = [];
1496
1506
  }
1497
1507
  updateRightsState(roles, securitySettings) {
1508
+ this.securityRoles = roles;
1509
+ this.securitySettings = securitySettings;
1498
1510
  this.canRead = this.hasSecurityRight(roles, securitySettings, BaseModuleComponent.readRight);
1499
1511
  this.canEdit = this.hasSecurityRight(roles, securitySettings, BaseModuleComponent.editRight);
1500
1512
  this.canDelete = this.hasSecurityRight(roles, securitySettings, BaseModuleComponent.deleteRight);