@resolveio/client-lib-core 1.2.9 → 1.3.1
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/esm2020/lib/auth/auth-guard.service.mjs +114 -23
- package/esm2020/lib/models/permission.model.mjs +1 -1
- package/esm2020/lib/report-builder.permission.mjs +5 -5
- package/esm2020/lib/super-admin.permission.mjs +4 -4
- package/esm2020/lib/user-settings/user-settings.permission.mjs +2 -2
- package/esm2020/lib/widgets/navbar-module/navbar-module.component.mjs +22 -50
- package/fesm2015/resolveio-client-lib-core.mjs +142 -79
- package/fesm2015/resolveio-client-lib-core.mjs.map +1 -1
- package/fesm2020/resolveio-client-lib-core.mjs +142 -79
- package/fesm2020/resolveio-client-lib-core.mjs.map +1 -1
- package/lib/auth/auth-guard.service.d.ts +2 -0
- package/lib/models/permission.model.d.ts +2 -1
- package/package.json +1 -1
|
@@ -4803,35 +4803,21 @@ class NavbarModuleComponent extends BaseComponent {
|
|
|
4803
4803
|
this.routerEvents$.push(this._services._router.events
|
|
4804
4804
|
//.filter(event => event instanceof NavigationEnd)
|
|
4805
4805
|
.subscribe((event) => {
|
|
4806
|
-
this.
|
|
4806
|
+
if (this._services._router.url.replace(/\/[a-f0-9]{24}$/, '').replace(/\?.+$/, '') !== this.currentRoute) {
|
|
4807
|
+
this.selectTabFromRouter();
|
|
4808
|
+
}
|
|
4807
4809
|
}));
|
|
4808
4810
|
this.routerEvents$.push(this._services._router.events
|
|
4809
4811
|
//.filter(event => event instanceof NavigationCancel)
|
|
4810
4812
|
.subscribe((event) => {
|
|
4811
|
-
this.
|
|
4813
|
+
if (this._services._router.url.replace(/\/[a-f0-9]{24}$/, '').replace(/\?.+$/, '') !== this.currentRoute) {
|
|
4814
|
+
this.selectTabFromRouter();
|
|
4815
|
+
}
|
|
4812
4816
|
}));
|
|
4813
4817
|
this.routerEvents$.push(this._services._app.navbarModuleData.subscribe(data => {
|
|
4814
4818
|
this.menuData = data;
|
|
4815
|
-
if (
|
|
4816
|
-
this.
|
|
4817
|
-
}
|
|
4818
|
-
if (this.selectedTab) {
|
|
4819
|
-
for (let i = 0; i < this.menuData.tabs.length; i++) {
|
|
4820
|
-
let tabLink = '';
|
|
4821
|
-
if (this.menuData.tabs[i].link.startsWith('/customer-portal/frac') || this.menuData.tabs[i].link.startsWith('/customer-portal/production')) {
|
|
4822
|
-
tabLink = this.menuData.tabs[i].link;
|
|
4823
|
-
}
|
|
4824
|
-
else {
|
|
4825
|
-
tabLink = this.menuData.tabs[i].link.replace(/^(\/[-a-z]+\/[^\/]+)\/.*$/, '$1');
|
|
4826
|
-
}
|
|
4827
|
-
if (tabLink === this.currentRoute) {
|
|
4828
|
-
this.selectedTab = this.menuData.tabs[i];
|
|
4829
|
-
break;
|
|
4830
|
-
}
|
|
4831
|
-
}
|
|
4832
|
-
if (this.selectedTab === null) {
|
|
4833
|
-
this.selectedTab = this.menuData.tabs[0];
|
|
4834
|
-
}
|
|
4819
|
+
if (this._services._router.url.replace(/\/[a-f0-9]{24}$/, '').replace(/\?.+$/, '') !== this.currentRoute) {
|
|
4820
|
+
this.selectTabFromRouter();
|
|
4835
4821
|
}
|
|
4836
4822
|
}));
|
|
4837
4823
|
this.routerEvents$.push(this._services._app.tourStarted.subscribe(tourStarted => {
|
|
@@ -4844,38 +4830,24 @@ class NavbarModuleComponent extends BaseComponent {
|
|
|
4844
4830
|
});
|
|
4845
4831
|
}
|
|
4846
4832
|
selectTabFromRouter() {
|
|
4847
|
-
if (this.
|
|
4848
|
-
this.
|
|
4849
|
-
|
|
4850
|
-
else {
|
|
4851
|
-
this.selectedTab = null;
|
|
4852
|
-
let routerLink = '';
|
|
4853
|
-
if (this._services._router.url.startsWith('/customer-portal/frac') || this._services._router.url.startsWith('/customer-portal/production')) {
|
|
4854
|
-
routerLink = this._services._router.url;
|
|
4833
|
+
if (this.menuData) {
|
|
4834
|
+
if (this._services._router.url === '/') {
|
|
4835
|
+
this.selectedTab = this.menuData.tabs[0];
|
|
4855
4836
|
}
|
|
4856
4837
|
else {
|
|
4857
|
-
|
|
4858
|
-
|
|
4859
|
-
|
|
4860
|
-
|
|
4861
|
-
|
|
4862
|
-
|
|
4863
|
-
|
|
4864
|
-
|
|
4865
|
-
if (this.menuData.tabs[i].link.startsWith('/customer-portal/frac') || this.menuData.tabs[i].link.startsWith('/customer-portal/production')) {
|
|
4866
|
-
tabLink = this.menuData.tabs[i].link;
|
|
4867
|
-
}
|
|
4868
|
-
else {
|
|
4869
|
-
tabLink = this.menuData.tabs[i].link.replace(/^(\/[-a-z]+\/[^\/]+)\/.*$/, '$1');
|
|
4838
|
+
this.selectedTab = null;
|
|
4839
|
+
this.currentRoute = this._services._router.url.replace(/\/[a-f0-9]{24}$/, '').replace(/\?.+$/, '');
|
|
4840
|
+
for (let i = 0; i < this.menuData.tabs.length; i++) {
|
|
4841
|
+
let tab = this.menuData.tabs[i];
|
|
4842
|
+
if (tab.link === this.currentRoute) {
|
|
4843
|
+
this.selectedTab = tab;
|
|
4844
|
+
break;
|
|
4845
|
+
}
|
|
4870
4846
|
}
|
|
4871
|
-
if (
|
|
4872
|
-
this.selectedTab = this.menuData.tabs[
|
|
4873
|
-
break;
|
|
4847
|
+
if (this.selectedTab === null) {
|
|
4848
|
+
this.selectedTab = this.menuData.tabs[0];
|
|
4874
4849
|
}
|
|
4875
4850
|
}
|
|
4876
|
-
if (this.selectedTab === null) {
|
|
4877
|
-
this.selectedTab = this.menuData.tabs.filter(a => a.link === routerLink)[0] ? this.menuData.tabs.filter(a => a.link === routerLink)[0] : this.menuData.tabs[0];
|
|
4878
|
-
}
|
|
4879
4851
|
}
|
|
4880
4852
|
}
|
|
4881
4853
|
tabClass(tab) {
|
|
@@ -5543,14 +5515,49 @@ class AuthGuard {
|
|
|
5543
5515
|
resolve(false);
|
|
5544
5516
|
}
|
|
5545
5517
|
else {
|
|
5546
|
-
let view = state.url.replace(/^(\/[-a-z]+\/[^\/]+)\/.*$/, '$1').replace(
|
|
5547
|
-
let moduleView = view.replace(/^(
|
|
5548
|
-
if (
|
|
5549
|
-
|
|
5518
|
+
let view = state.url.replace(/^(\/[-a-z]+\/[^\/]+)\/.*$/, '$1').replace(/\?.+$/, '');
|
|
5519
|
+
let moduleView = view.replace(/^(\/[-a-z]+\/).*$/, '$1');
|
|
5520
|
+
if (!this.isLinkFakeRoute(view)) {
|
|
5521
|
+
if (user.roles.super_admin) {
|
|
5522
|
+
resolve(true);
|
|
5523
|
+
}
|
|
5524
|
+
else if (!user.roles.groups.filter(a => a.views.some(b => b === view && !this.isLinkPartialRoute(b))).length) {
|
|
5525
|
+
if (user.roles.groups.filter(a => a.views.some(b => b.startsWith(moduleView) && !this.doesLinkHaveParameter(b) && !this.isLinkFakeRoute(b))).length) {
|
|
5526
|
+
let link = user.roles.groups.filter(a => a.views.some(b => b.startsWith(moduleView) && !this.doesLinkHaveParameter(b) && !this.isLinkFakeRoute(b)))[0].views.filter(a => a.startsWith(moduleView) && !this.doesLinkHaveParameter(a) && !this.isLinkFakeRoute(a))[0];
|
|
5527
|
+
this._router.navigateByUrl(link);
|
|
5528
|
+
}
|
|
5529
|
+
else {
|
|
5530
|
+
this._router.navigateByUrl('/home');
|
|
5531
|
+
}
|
|
5532
|
+
resolve(false);
|
|
5533
|
+
}
|
|
5534
|
+
else if (!user.roles.groups.filter(a => a.views.some(b => b.startsWith(view) && this.isLinkPartialRoute(b))).length) {
|
|
5535
|
+
if (user.roles.groups.filter(a => a.views.some(b => b.startsWith(moduleView) && !this.doesLinkHaveParameter(b) && !this.isLinkFakeRoute(b))).length) {
|
|
5536
|
+
let link = user.roles.groups.filter(a => a.views.some(b => b.startsWith(moduleView) && !this.doesLinkHaveParameter(b) && !this.isLinkFakeRoute(b)))[0].views.filter(a => a.startsWith(moduleView) && !this.doesLinkHaveParameter(a) && !this.isLinkFakeRoute(a))[0];
|
|
5537
|
+
this._router.navigateByUrl(link);
|
|
5538
|
+
}
|
|
5539
|
+
else {
|
|
5540
|
+
this._router.navigateByUrl('/home');
|
|
5541
|
+
}
|
|
5542
|
+
resolve(false);
|
|
5543
|
+
}
|
|
5544
|
+
else {
|
|
5545
|
+
resolve(true);
|
|
5546
|
+
}
|
|
5550
5547
|
}
|
|
5551
|
-
else if (!user.roles.groups.filter(a => a.views.
|
|
5552
|
-
if (user.roles.groups.filter(a => a.views.
|
|
5553
|
-
let link = user.roles.groups.filter(a => a.views.
|
|
5548
|
+
else if (!user.roles.groups.filter(a => a.views.some(b => b === view && !this.isLinkPartialRoute(b))).length) {
|
|
5549
|
+
if (user.roles.groups.filter(a => a.views.some(b => b.startsWith(moduleView) && !this.doesLinkHaveParameter(b) && !this.isLinkFakeRoute(b))).length) {
|
|
5550
|
+
let link = user.roles.groups.filter(a => a.views.some(b => b.startsWith(moduleView) && !this.doesLinkHaveParameter(b) && !this.isLinkFakeRoute(b)))[0].views.filter(a => a.startsWith(moduleView) && !this.doesLinkHaveParameter(a) && !this.isLinkFakeRoute(a))[0];
|
|
5551
|
+
this._router.navigateByUrl(link);
|
|
5552
|
+
}
|
|
5553
|
+
else {
|
|
5554
|
+
this._router.navigateByUrl('/home');
|
|
5555
|
+
}
|
|
5556
|
+
resolve(false);
|
|
5557
|
+
}
|
|
5558
|
+
else if (!user.roles.groups.filter(a => a.views.some(b => b.startsWith(view) && this.isLinkPartialRoute(b))).length) {
|
|
5559
|
+
if (user.roles.groups.filter(a => a.views.some(b => b.startsWith(moduleView) && !this.doesLinkHaveParameter(b) && !this.isLinkFakeRoute(b))).length) {
|
|
5560
|
+
let link = user.roles.groups.filter(a => a.views.some(b => b.startsWith(moduleView) && !this.doesLinkHaveParameter(b) && !this.isLinkFakeRoute(b)))[0].views.filter(a => a.startsWith(moduleView) && !this.doesLinkHaveParameter(a) && !this.isLinkFakeRoute(a))[0];
|
|
5554
5561
|
this._router.navigateByUrl(link);
|
|
5555
5562
|
}
|
|
5556
5563
|
else {
|
|
@@ -5559,7 +5566,7 @@ class AuthGuard {
|
|
|
5559
5566
|
resolve(false);
|
|
5560
5567
|
}
|
|
5561
5568
|
else {
|
|
5562
|
-
|
|
5569
|
+
this._router.navigateByUrl('/home');
|
|
5563
5570
|
}
|
|
5564
5571
|
}
|
|
5565
5572
|
});
|
|
@@ -5578,14 +5585,49 @@ class AuthGuard {
|
|
|
5578
5585
|
resolve(false);
|
|
5579
5586
|
}
|
|
5580
5587
|
else {
|
|
5581
|
-
let view = state.url.replace(/^(\/[-a-z]+\/[^\/]+)\/.*$/, '$1').replace(
|
|
5582
|
-
let moduleView = view.replace(/^(
|
|
5583
|
-
if (
|
|
5584
|
-
|
|
5588
|
+
let view = state.url.replace(/^(\/[-a-z]+\/[^\/]+)\/.*$/, '$1').replace(/\?.+$/, '');
|
|
5589
|
+
let moduleView = view.replace(/^(\/[-a-z]+\/).*$/, '$1');
|
|
5590
|
+
if (!this.isLinkFakeRoute(view)) {
|
|
5591
|
+
if (user.roles.super_admin) {
|
|
5592
|
+
resolve(true);
|
|
5593
|
+
}
|
|
5594
|
+
else if (!user.roles.groups.filter(a => a.views.some(b => b === view && !this.isLinkPartialRoute(b))).length) {
|
|
5595
|
+
if (user.roles.groups.filter(a => a.views.some(b => b.startsWith(moduleView) && !this.doesLinkHaveParameter(b) && !this.isLinkFakeRoute(b))).length) {
|
|
5596
|
+
let link = user.roles.groups.filter(a => a.views.some(b => b.startsWith(moduleView) && !this.doesLinkHaveParameter(b) && !this.isLinkFakeRoute(b)))[0].views.filter(a => a.startsWith(moduleView) && !this.doesLinkHaveParameter(a) && !this.isLinkFakeRoute(a))[0];
|
|
5597
|
+
this._router.navigateByUrl(link);
|
|
5598
|
+
}
|
|
5599
|
+
else {
|
|
5600
|
+
this._router.navigateByUrl('/home');
|
|
5601
|
+
}
|
|
5602
|
+
resolve(false);
|
|
5603
|
+
}
|
|
5604
|
+
else if (!user.roles.groups.filter(a => a.views.some(b => b.startsWith(view) && this.isLinkPartialRoute(b))).length) {
|
|
5605
|
+
if (user.roles.groups.filter(a => a.views.some(b => b.startsWith(moduleView) && !this.doesLinkHaveParameter(b) && !this.isLinkFakeRoute(b))).length) {
|
|
5606
|
+
let link = user.roles.groups.filter(a => a.views.some(b => b.startsWith(moduleView) && !this.doesLinkHaveParameter(b) && !this.isLinkFakeRoute(b)))[0].views.filter(a => a.startsWith(moduleView) && !this.doesLinkHaveParameter(a) && !this.isLinkFakeRoute(a))[0];
|
|
5607
|
+
this._router.navigateByUrl(link);
|
|
5608
|
+
}
|
|
5609
|
+
else {
|
|
5610
|
+
this._router.navigateByUrl('/home');
|
|
5611
|
+
}
|
|
5612
|
+
resolve(false);
|
|
5613
|
+
}
|
|
5614
|
+
else {
|
|
5615
|
+
resolve(true);
|
|
5616
|
+
}
|
|
5617
|
+
}
|
|
5618
|
+
else if (!user.roles.groups.filter(a => a.views.some(b => b === view && !this.isLinkPartialRoute(b))).length) {
|
|
5619
|
+
if (user.roles.groups.filter(a => a.views.some(b => b.startsWith(moduleView) && !this.doesLinkHaveParameter(b) && !this.isLinkFakeRoute(b))).length) {
|
|
5620
|
+
let link = user.roles.groups.filter(a => a.views.some(b => b.startsWith(moduleView) && !this.doesLinkHaveParameter(b) && !this.isLinkFakeRoute(b)))[0].views.filter(a => a.startsWith(moduleView) && !this.doesLinkHaveParameter(a) && !this.isLinkFakeRoute(a))[0];
|
|
5621
|
+
this._router.navigateByUrl(link);
|
|
5622
|
+
}
|
|
5623
|
+
else {
|
|
5624
|
+
this._router.navigateByUrl('/home');
|
|
5625
|
+
}
|
|
5626
|
+
resolve(false);
|
|
5585
5627
|
}
|
|
5586
|
-
else if (!user.roles.groups.filter(a => a.views.
|
|
5587
|
-
if (user.roles.groups.filter(a => a.views.
|
|
5588
|
-
let link = user.roles.groups.filter(a => a.views.
|
|
5628
|
+
else if (!user.roles.groups.filter(a => a.views.some(b => b.startsWith(view) && this.isLinkPartialRoute(b))).length) {
|
|
5629
|
+
if (user.roles.groups.filter(a => a.views.some(b => b.startsWith(moduleView) && !this.doesLinkHaveParameter(b) && !this.isLinkFakeRoute(b))).length) {
|
|
5630
|
+
let link = user.roles.groups.filter(a => a.views.some(b => b.startsWith(moduleView) && !this.doesLinkHaveParameter(b) && !this.isLinkFakeRoute(b)))[0].views.filter(a => a.startsWith(moduleView) && !this.doesLinkHaveParameter(a) && !this.isLinkFakeRoute(a))[0];
|
|
5589
5631
|
this._router.navigateByUrl(link);
|
|
5590
5632
|
}
|
|
5591
5633
|
else {
|
|
@@ -5594,7 +5636,7 @@ class AuthGuard {
|
|
|
5594
5636
|
resolve(false);
|
|
5595
5637
|
}
|
|
5596
5638
|
else {
|
|
5597
|
-
|
|
5639
|
+
this._router.navigateByUrl('/home');
|
|
5598
5640
|
}
|
|
5599
5641
|
}
|
|
5600
5642
|
}
|
|
@@ -5608,12 +5650,33 @@ class AuthGuard {
|
|
|
5608
5650
|
for (let j = 0; j < permission.views.length; j++) {
|
|
5609
5651
|
let view = permission.views[j];
|
|
5610
5652
|
if (view.link === link) {
|
|
5611
|
-
|
|
5612
|
-
|
|
5613
|
-
|
|
5614
|
-
|
|
5615
|
-
|
|
5616
|
-
|
|
5653
|
+
return !!view.has_parameter;
|
|
5654
|
+
}
|
|
5655
|
+
}
|
|
5656
|
+
}
|
|
5657
|
+
return false;
|
|
5658
|
+
}
|
|
5659
|
+
isLinkFakeRoute(link) {
|
|
5660
|
+
let permissions = this._aps.getAllModulePermissions();
|
|
5661
|
+
for (let i = 0; i < permissions.length; i++) {
|
|
5662
|
+
let permission = permissions[i];
|
|
5663
|
+
for (let j = 0; j < permission.views.length; j++) {
|
|
5664
|
+
let view = permission.views[j];
|
|
5665
|
+
if (view.link === link) {
|
|
5666
|
+
return false;
|
|
5667
|
+
}
|
|
5668
|
+
}
|
|
5669
|
+
}
|
|
5670
|
+
return true;
|
|
5671
|
+
}
|
|
5672
|
+
isLinkPartialRoute(link) {
|
|
5673
|
+
let permissions = this._aps.getAllModulePermissions();
|
|
5674
|
+
for (let i = 0; i < permissions.length; i++) {
|
|
5675
|
+
let permission = permissions[i];
|
|
5676
|
+
for (let j = 0; j < permission.views.length; j++) {
|
|
5677
|
+
let view = permission.views[j];
|
|
5678
|
+
if (view.link === link) {
|
|
5679
|
+
return !!view.partial_route;
|
|
5617
5680
|
}
|
|
5618
5681
|
}
|
|
5619
5682
|
}
|
|
@@ -6496,7 +6559,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.9", ngImpor
|
|
|
6496
6559
|
const UserSettingsModulePermission = {
|
|
6497
6560
|
name: 'user-settings',
|
|
6498
6561
|
views: [
|
|
6499
|
-
{ link: '/user-settings/settings', label: 'Settings'
|
|
6562
|
+
{ link: '/user-settings/settings', label: 'Settings' }
|
|
6500
6563
|
],
|
|
6501
6564
|
approval: {
|
|
6502
6565
|
type: 'user-settings'
|
|
@@ -8700,10 +8763,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.9", ngImpor
|
|
|
8700
8763
|
const ReportBuilderModulePermission = {
|
|
8701
8764
|
name: 'report-builder',
|
|
8702
8765
|
views: [
|
|
8703
|
-
{ link: '/report-builder/list', label: 'List'
|
|
8704
|
-
{ link: '/report-builder/new', label: 'New'
|
|
8705
|
-
{ link: '/report-builder/scheduled-job', label: 'Scheduled Job'
|
|
8706
|
-
{ link: '/report-builder/dashboard-builder', label: 'Dashboard Builder'
|
|
8766
|
+
{ link: '/report-builder/list', label: 'List' },
|
|
8767
|
+
{ link: '/report-builder/new', label: 'New' },
|
|
8768
|
+
{ link: '/report-builder/scheduled-job', label: 'Scheduled Job' },
|
|
8769
|
+
{ link: '/report-builder/dashboard-builder', label: 'Dashboard Builder' },
|
|
8707
8770
|
{ link: '/report-builder/detail', label: 'Detail', has_parameter: true },
|
|
8708
8771
|
{ link: '/report-builder/edit', label: 'Edit', has_parameter: true },
|
|
8709
8772
|
{ link: '/report-builder/delete', label: 'Delete', has_parameter: true },
|
|
@@ -8713,9 +8776,9 @@ const ReportBuilderModulePermission = {
|
|
|
8713
8776
|
const SuperAdminModulePermission = {
|
|
8714
8777
|
name: 'super-admin',
|
|
8715
8778
|
views: [
|
|
8716
|
-
{ link: '/super-admin/dashboard', label: 'Dashboard'
|
|
8717
|
-
{ link: '/super-admin/apm', label: 'APM'
|
|
8718
|
-
{ link: '/super-admin/monitor', label: 'Monitor'
|
|
8779
|
+
{ link: '/super-admin/dashboard', label: 'Dashboard' },
|
|
8780
|
+
{ link: '/super-admin/apm', label: 'APM' },
|
|
8781
|
+
{ link: '/super-admin/monitor', label: 'Monitor' }
|
|
8719
8782
|
]
|
|
8720
8783
|
};
|
|
8721
8784
|
|