@hmcts/rpx-xui-common-lib 1.7.22 → 1.7.28
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/bundles/hmcts-rpx-xui-common-lib.umd.js +25 -21
- package/bundles/hmcts-rpx-xui-common-lib.umd.js.map +1 -1
- package/bundles/hmcts-rpx-xui-common-lib.umd.min.js +1 -1
- package/bundles/hmcts-rpx-xui-common-lib.umd.min.js.map +1 -1
- package/esm2015/lib/services/role-guard/role.guard.js +22 -15
- package/esm2015/lib/services/role-guard/role.service.js +13 -13
- package/esm5/lib/services/role-guard/role.guard.js +22 -15
- package/esm5/lib/services/role-guard/role.service.js +13 -13
- package/fesm2015/hmcts-rpx-xui-common-lib.js +28 -23
- package/fesm2015/hmcts-rpx-xui-common-lib.js.map +1 -1
- package/fesm5/hmcts-rpx-xui-common-lib.js +29 -24
- package/fesm5/hmcts-rpx-xui-common-lib.js.map +1 -1
- package/lib/services/role-guard/role.guard.d.ts +2 -1
- package/lib/services/role-guard/role.service.d.ts +3 -1
- package/package.json +1 -1
|
@@ -7701,19 +7701,18 @@
|
|
|
7701
7701
|
*/
|
|
7702
7702
|
var RoleService = /** @class */ (function () {
|
|
7703
7703
|
function RoleService() {
|
|
7704
|
-
this.pRoles =
|
|
7704
|
+
this.pRoles = new rxjs.BehaviorSubject(null);
|
|
7705
|
+
this.roles$ = this.pRoles.asObservable().pipe(operators.skipWhile(( /**
|
|
7706
|
+
* @param {?} item
|
|
7707
|
+
* @return {?}
|
|
7708
|
+
*/function (item) { return item === null; })));
|
|
7705
7709
|
}
|
|
7706
7710
|
Object.defineProperty(RoleService.prototype, "roles", {
|
|
7707
|
-
get: /**
|
|
7708
|
-
* @return {?}
|
|
7709
|
-
*/ function () {
|
|
7710
|
-
return this.pRoles;
|
|
7711
|
-
},
|
|
7712
7711
|
set: /**
|
|
7713
7712
|
* @param {?} roles
|
|
7714
7713
|
* @return {?}
|
|
7715
7714
|
*/ function (roles) {
|
|
7716
|
-
this.pRoles
|
|
7715
|
+
this.pRoles.next(roles);
|
|
7717
7716
|
},
|
|
7718
7717
|
enumerable: true,
|
|
7719
7718
|
configurable: true
|
|
@@ -7754,23 +7753,28 @@
|
|
|
7754
7753
|
*/
|
|
7755
7754
|
function (route) {
|
|
7756
7755
|
var _this = this;
|
|
7757
|
-
|
|
7758
|
-
|
|
7759
|
-
/** @type {?} */
|
|
7760
|
-
var check = ( /**
|
|
7761
|
-
* @param {?} roleRegEx
|
|
7756
|
+
return this.roleService.roles$.pipe(operators.map(( /**
|
|
7757
|
+
* @param {?} roles
|
|
7762
7758
|
* @return {?}
|
|
7763
|
-
*/function (
|
|
7759
|
+
*/function (roles) {
|
|
7760
|
+
/** @type {?} */
|
|
7761
|
+
var canActivateRoles = (( /** @type {?} */(route.data.needsRole)));
|
|
7764
7762
|
/** @type {?} */
|
|
7765
|
-
var
|
|
7766
|
-
|
|
7767
|
-
* @param {?} role
|
|
7763
|
+
var check = ( /**
|
|
7764
|
+
* @param {?} roleRegEx
|
|
7768
7765
|
* @return {?}
|
|
7769
|
-
*/function (
|
|
7770
|
-
|
|
7771
|
-
|
|
7772
|
-
|
|
7773
|
-
|
|
7766
|
+
*/function (roleRegEx) {
|
|
7767
|
+
/** @type {?} */
|
|
7768
|
+
var regex = new RegExp(roleRegEx);
|
|
7769
|
+
return roles.some(( /**
|
|
7770
|
+
* @param {?} role
|
|
7771
|
+
* @return {?}
|
|
7772
|
+
*/function (role) { return regex.test(role); }));
|
|
7773
|
+
});
|
|
7774
|
+
/** @type {?} */
|
|
7775
|
+
var match = route.data.roleMatching === RoleMatching.ALL ? canActivateRoles.every(check) : canActivateRoles.some(check);
|
|
7776
|
+
return match || _this.router.parseUrl(( /** @type {?} */(route.data.noRoleMatchRedirect)));
|
|
7777
|
+
})));
|
|
7774
7778
|
};
|
|
7775
7779
|
RoleGuard.decorators = [
|
|
7776
7780
|
{ type: i0.Injectable, args: [{
|