@senior-gestao-empresarial/angular-components 4.21.1 → 4.22.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.
@@ -6922,18 +6922,20 @@
6922
6922
  /**
6923
6923
  * Method to verify if user has permission on a specific module
6924
6924
  * @param module Module to verify the permission
6925
+ * @param requestPermission Indicative if must be call the primitive
6925
6926
  * @returns An boolean Observable
6926
6927
  */
6927
- VerifyModulePermission.prototype.hasPermission = function (module) {
6928
+ VerifyModulePermission.prototype.hasPermission = function (module, requestPermission) {
6928
6929
  var moduleSubject = VerifyModulePermission_1.subjectsPerModuleMap.get(module);
6929
- if (!moduleSubject) {
6930
+ if (!moduleSubject || requestPermission) {
6930
6931
  var newModuleSubject_1 = new rxjs.ReplaySubject(1);
6931
6932
  VerifyModulePermission_1.subjectsPerModuleMap.set(module, newModuleSubject_1);
6932
6933
  this.verifyModulePermissionService
6933
- .queryModule({ modulo: module })
6934
+ .queryModule({ modulo: module, somenteAtivo: true })
6934
6935
  .pipe(operators.take(1))
6935
6936
  .subscribe(function (response) {
6936
- var hasPermission = !!response.modulos.find(function (modulo) { return modulo.ativo && !modulo.empresa; });
6937
+ var _a;
6938
+ var hasPermission = ((_a = response === null || response === void 0 ? void 0 : response.modulos) === null || _a === void 0 ? void 0 : _a.length) > 0;
6937
6939
  newModuleSubject_1.next(hasPermission);
6938
6940
  }, function (err) {
6939
6941
  VerifyModulePermission_1.subjectsPerModuleMap.delete(module);