@bnsights/bbsf-admin-portal 1.0.9 → 1.0.10

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.
@@ -3798,34 +3798,31 @@
3798
3798
  }
3799
3799
  AuthGuard.prototype.canActivate = function (route, state) {
3800
3800
  return __awaiter(this, void 0, void 0, function () {
3801
- var userPermissionSetID_1, area;
3802
- return __generator(this, function (_a) {
3803
- switch (_a.label) {
3801
+ var _a, userPermissionSetID_1, area;
3802
+ return __generator(this, function (_b) {
3803
+ switch (_b.label) {
3804
3804
  case 0: return [4 /*yield*/, this.authService.isAuthenticated()];
3805
3805
  case 1:
3806
- if (!_a.sent()) return [3 /*break*/, 3];
3807
- debugger;
3806
+ if (!_b.sent()) return [3 /*break*/, 4];
3807
+ _a = this.allowedPermission.length == 0;
3808
+ if (_a) return [3 /*break*/, 3];
3808
3809
  return [4 /*yield*/, this.authService.isUserInRole(this.allowedPermission)];
3809
3810
  case 2:
3810
- if (_a.sent()) {
3811
+ _a = (_b.sent());
3812
+ _b.label = 3;
3813
+ case 3:
3814
+ if (_a)
3811
3815
  return [2 /*return*/, true];
3812
- }
3813
- else if (i1.EnvironmentService.AreaList.length > 0) {
3816
+ if (i1.EnvironmentService.AreaList.length > 0) {
3814
3817
  userPermissionSetID_1 = Number.parseInt(i1.AuthService.user.profile["selectedpermissionsetid"]);
3815
3818
  area = i1.EnvironmentService.AreaList.filter(function (item) { return item.PermissionSetID == userPermissionSetID_1; })[0];
3816
3819
  if (area) {
3817
- this.authService.setUrl(area.AreaUrl);
3818
- this.router.navigate([area.AreaUrl], { queryParams: { redirect: state.url }, replaceUrl: true });
3819
- return [2 /*return*/, false];
3820
+ this.router.navigate([area.AreaUrl]);
3821
+ return [2 /*return*/, true];
3820
3822
  }
3821
- else
3822
- this.authService.setUrl(state.url);
3823
3823
  }
3824
- else
3825
- this.authService.setUrl(state.url);
3826
- _a.label = 3;
3827
- case 3:
3828
- debugger;
3824
+ _b.label = 4;
3825
+ case 4:
3829
3826
  this.authService.setUrl(state.url);
3830
3827
  this.router.navigate(['/Admin/account/login'], { queryParams: { redirect: state.url }, replaceUrl: true });
3831
3828
  return [2 /*return*/, false];
@@ -23785,34 +23782,31 @@
23785
23782
  }
23786
23783
  AuthGuard.prototype.canActivate = function (route, state) {
23787
23784
  return __awaiter(this, void 0, void 0, function () {
23788
- var userPermissionSetID_1, area;
23789
- return __generator(this, function (_a) {
23790
- switch (_a.label) {
23785
+ var _a, userPermissionSetID_1, area;
23786
+ return __generator(this, function (_b) {
23787
+ switch (_b.label) {
23791
23788
  case 0: return [4 /*yield*/, this.authService.isAuthenticated()];
23792
23789
  case 1:
23793
- if (!_a.sent()) return [3 /*break*/, 3];
23794
- debugger;
23790
+ if (!_b.sent()) return [3 /*break*/, 4];
23791
+ _a = this.allowedPermission.length == 0;
23792
+ if (_a) return [3 /*break*/, 3];
23795
23793
  return [4 /*yield*/, this.authService.isUserInRole(this.allowedPermission)];
23796
23794
  case 2:
23797
- if (_a.sent()) {
23795
+ _a = (_b.sent());
23796
+ _b.label = 3;
23797
+ case 3:
23798
+ if (_a)
23798
23799
  return [2 /*return*/, true];
23799
- }
23800
- else if (i1.EnvironmentService.AreaList.length > 0) {
23800
+ if (i1.EnvironmentService.AreaList.length > 0) {
23801
23801
  userPermissionSetID_1 = Number.parseInt(i1.AuthService.user.profile["selectedpermissionsetid"]);
23802
23802
  area = i1.EnvironmentService.AreaList.filter(function (item) { return item.PermissionSetID == userPermissionSetID_1; })[0];
23803
23803
  if (area) {
23804
- this.authService.setUrl(area.AreaUrl);
23805
- this.router.navigate([area.AreaUrl], { queryParams: { redirect: state.url }, replaceUrl: true });
23806
- return [2 /*return*/, false];
23804
+ this.router.navigate([area.AreaUrl]);
23805
+ return [2 /*return*/, true];
23807
23806
  }
23808
- else
23809
- this.authService.setUrl(state.url);
23810
23807
  }
23811
- else
23812
- this.authService.setUrl(state.url);
23813
- _a.label = 3;
23814
- case 3:
23815
- debugger;
23808
+ _b.label = 4;
23809
+ case 4:
23816
23810
  this.authService.setUrl(state.url);
23817
23811
  this.router.navigate(['/Admin/account/login'], { queryParams: { redirect: state.url }, replaceUrl: true });
23818
23812
  return [2 /*return*/, false];