@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
|
@@ -4806,35 +4806,21 @@ class NavbarModuleComponent extends BaseComponent {
|
|
|
4806
4806
|
this.routerEvents$.push(this._services._router.events
|
|
4807
4807
|
//.filter(event => event instanceof NavigationEnd)
|
|
4808
4808
|
.subscribe((event) => {
|
|
4809
|
-
this.
|
|
4809
|
+
if (this._services._router.url.replace(/\/[a-f0-9]{24}$/, '').replace(/\?.+$/, '') !== this.currentRoute) {
|
|
4810
|
+
this.selectTabFromRouter();
|
|
4811
|
+
}
|
|
4810
4812
|
}));
|
|
4811
4813
|
this.routerEvents$.push(this._services._router.events
|
|
4812
4814
|
//.filter(event => event instanceof NavigationCancel)
|
|
4813
4815
|
.subscribe((event) => {
|
|
4814
|
-
this.
|
|
4816
|
+
if (this._services._router.url.replace(/\/[a-f0-9]{24}$/, '').replace(/\?.+$/, '') !== this.currentRoute) {
|
|
4817
|
+
this.selectTabFromRouter();
|
|
4818
|
+
}
|
|
4815
4819
|
}));
|
|
4816
4820
|
this.routerEvents$.push(this._services._app.navbarModuleData.subscribe(data => {
|
|
4817
4821
|
this.menuData = data;
|
|
4818
|
-
if (
|
|
4819
|
-
this.
|
|
4820
|
-
}
|
|
4821
|
-
if (this.selectedTab) {
|
|
4822
|
-
for (let i = 0; i < this.menuData.tabs.length; i++) {
|
|
4823
|
-
let tabLink = '';
|
|
4824
|
-
if (this.menuData.tabs[i].link.startsWith('/customer-portal/frac') || this.menuData.tabs[i].link.startsWith('/customer-portal/production')) {
|
|
4825
|
-
tabLink = this.menuData.tabs[i].link;
|
|
4826
|
-
}
|
|
4827
|
-
else {
|
|
4828
|
-
tabLink = this.menuData.tabs[i].link.replace(/^(\/[-a-z]+\/[^\/]+)\/.*$/, '$1');
|
|
4829
|
-
}
|
|
4830
|
-
if (tabLink === this.currentRoute) {
|
|
4831
|
-
this.selectedTab = this.menuData.tabs[i];
|
|
4832
|
-
break;
|
|
4833
|
-
}
|
|
4834
|
-
}
|
|
4835
|
-
if (this.selectedTab === null) {
|
|
4836
|
-
this.selectedTab = this.menuData.tabs[0];
|
|
4837
|
-
}
|
|
4822
|
+
if (this._services._router.url.replace(/\/[a-f0-9]{24}$/, '').replace(/\?.+$/, '') !== this.currentRoute) {
|
|
4823
|
+
this.selectTabFromRouter();
|
|
4838
4824
|
}
|
|
4839
4825
|
}));
|
|
4840
4826
|
this.routerEvents$.push(this._services._app.tourStarted.subscribe(tourStarted => {
|
|
@@ -4847,38 +4833,24 @@ class NavbarModuleComponent extends BaseComponent {
|
|
|
4847
4833
|
});
|
|
4848
4834
|
}
|
|
4849
4835
|
selectTabFromRouter() {
|
|
4850
|
-
if (this.
|
|
4851
|
-
this.
|
|
4852
|
-
|
|
4853
|
-
else {
|
|
4854
|
-
this.selectedTab = null;
|
|
4855
|
-
let routerLink = '';
|
|
4856
|
-
if (this._services._router.url.startsWith('/customer-portal/frac') || this._services._router.url.startsWith('/customer-portal/production')) {
|
|
4857
|
-
routerLink = this._services._router.url;
|
|
4836
|
+
if (this.menuData) {
|
|
4837
|
+
if (this._services._router.url === '/') {
|
|
4838
|
+
this.selectedTab = this.menuData.tabs[0];
|
|
4858
4839
|
}
|
|
4859
4840
|
else {
|
|
4860
|
-
|
|
4861
|
-
|
|
4862
|
-
|
|
4863
|
-
|
|
4864
|
-
|
|
4865
|
-
|
|
4866
|
-
|
|
4867
|
-
|
|
4868
|
-
if (this.menuData.tabs[i].link.startsWith('/customer-portal/frac') || this.menuData.tabs[i].link.startsWith('/customer-portal/production')) {
|
|
4869
|
-
tabLink = this.menuData.tabs[i].link;
|
|
4870
|
-
}
|
|
4871
|
-
else {
|
|
4872
|
-
tabLink = this.menuData.tabs[i].link.replace(/^(\/[-a-z]+\/[^\/]+)\/.*$/, '$1');
|
|
4841
|
+
this.selectedTab = null;
|
|
4842
|
+
this.currentRoute = this._services._router.url.replace(/\/[a-f0-9]{24}$/, '').replace(/\?.+$/, '');
|
|
4843
|
+
for (let i = 0; i < this.menuData.tabs.length; i++) {
|
|
4844
|
+
let tab = this.menuData.tabs[i];
|
|
4845
|
+
if (tab.link === this.currentRoute) {
|
|
4846
|
+
this.selectedTab = tab;
|
|
4847
|
+
break;
|
|
4848
|
+
}
|
|
4873
4849
|
}
|
|
4874
|
-
if (
|
|
4875
|
-
this.selectedTab = this.menuData.tabs[
|
|
4876
|
-
break;
|
|
4850
|
+
if (this.selectedTab === null) {
|
|
4851
|
+
this.selectedTab = this.menuData.tabs[0];
|
|
4877
4852
|
}
|
|
4878
4853
|
}
|
|
4879
|
-
if (this.selectedTab === null) {
|
|
4880
|
-
this.selectedTab = this.menuData.tabs.filter(a => a.link === routerLink)[0] ? this.menuData.tabs.filter(a => a.link === routerLink)[0] : this.menuData.tabs[0];
|
|
4881
|
-
}
|
|
4882
4854
|
}
|
|
4883
4855
|
}
|
|
4884
4856
|
tabClass(tab) {
|
|
@@ -5546,14 +5518,49 @@ class AuthGuard {
|
|
|
5546
5518
|
resolve(false);
|
|
5547
5519
|
}
|
|
5548
5520
|
else {
|
|
5549
|
-
let view = state.url.replace(/^(\/[-a-z]+\/[^\/]+)\/.*$/, '$1').replace(
|
|
5550
|
-
let moduleView = view.replace(/^(
|
|
5551
|
-
if (
|
|
5552
|
-
|
|
5521
|
+
let view = state.url.replace(/^(\/[-a-z]+\/[^\/]+)\/.*$/, '$1').replace(/\?.+$/, '');
|
|
5522
|
+
let moduleView = view.replace(/^(\/[-a-z]+\/).*$/, '$1');
|
|
5523
|
+
if (!this.isLinkFakeRoute(view)) {
|
|
5524
|
+
if (user.roles.super_admin) {
|
|
5525
|
+
resolve(true);
|
|
5526
|
+
}
|
|
5527
|
+
else if (!user.roles.groups.filter(a => a.views.some(b => b === view && !this.isLinkPartialRoute(b))).length) {
|
|
5528
|
+
if (user.roles.groups.filter(a => a.views.some(b => b.startsWith(moduleView) && !this.doesLinkHaveParameter(b) && !this.isLinkFakeRoute(b))).length) {
|
|
5529
|
+
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];
|
|
5530
|
+
this._router.navigateByUrl(link);
|
|
5531
|
+
}
|
|
5532
|
+
else {
|
|
5533
|
+
this._router.navigateByUrl('/home');
|
|
5534
|
+
}
|
|
5535
|
+
resolve(false);
|
|
5536
|
+
}
|
|
5537
|
+
else if (!user.roles.groups.filter(a => a.views.some(b => b.startsWith(view) && this.isLinkPartialRoute(b))).length) {
|
|
5538
|
+
if (user.roles.groups.filter(a => a.views.some(b => b.startsWith(moduleView) && !this.doesLinkHaveParameter(b) && !this.isLinkFakeRoute(b))).length) {
|
|
5539
|
+
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];
|
|
5540
|
+
this._router.navigateByUrl(link);
|
|
5541
|
+
}
|
|
5542
|
+
else {
|
|
5543
|
+
this._router.navigateByUrl('/home');
|
|
5544
|
+
}
|
|
5545
|
+
resolve(false);
|
|
5546
|
+
}
|
|
5547
|
+
else {
|
|
5548
|
+
resolve(true);
|
|
5549
|
+
}
|
|
5553
5550
|
}
|
|
5554
|
-
else if (!user.roles.groups.filter(a => a.views.
|
|
5555
|
-
if (user.roles.groups.filter(a => a.views.
|
|
5556
|
-
let link = user.roles.groups.filter(a => a.views.
|
|
5551
|
+
else if (!user.roles.groups.filter(a => a.views.some(b => b === view && !this.isLinkPartialRoute(b))).length) {
|
|
5552
|
+
if (user.roles.groups.filter(a => a.views.some(b => b.startsWith(moduleView) && !this.doesLinkHaveParameter(b) && !this.isLinkFakeRoute(b))).length) {
|
|
5553
|
+
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
|
+
this._router.navigateByUrl(link);
|
|
5555
|
+
}
|
|
5556
|
+
else {
|
|
5557
|
+
this._router.navigateByUrl('/home');
|
|
5558
|
+
}
|
|
5559
|
+
resolve(false);
|
|
5560
|
+
}
|
|
5561
|
+
else if (!user.roles.groups.filter(a => a.views.some(b => b.startsWith(view) && this.isLinkPartialRoute(b))).length) {
|
|
5562
|
+
if (user.roles.groups.filter(a => a.views.some(b => b.startsWith(moduleView) && !this.doesLinkHaveParameter(b) && !this.isLinkFakeRoute(b))).length) {
|
|
5563
|
+
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];
|
|
5557
5564
|
this._router.navigateByUrl(link);
|
|
5558
5565
|
}
|
|
5559
5566
|
else {
|
|
@@ -5562,7 +5569,7 @@ class AuthGuard {
|
|
|
5562
5569
|
resolve(false);
|
|
5563
5570
|
}
|
|
5564
5571
|
else {
|
|
5565
|
-
|
|
5572
|
+
this._router.navigateByUrl('/home');
|
|
5566
5573
|
}
|
|
5567
5574
|
}
|
|
5568
5575
|
});
|
|
@@ -5581,14 +5588,49 @@ class AuthGuard {
|
|
|
5581
5588
|
resolve(false);
|
|
5582
5589
|
}
|
|
5583
5590
|
else {
|
|
5584
|
-
let view = state.url.replace(/^(\/[-a-z]+\/[^\/]+)\/.*$/, '$1').replace(
|
|
5585
|
-
let moduleView = view.replace(/^(
|
|
5586
|
-
if (
|
|
5587
|
-
|
|
5591
|
+
let view = state.url.replace(/^(\/[-a-z]+\/[^\/]+)\/.*$/, '$1').replace(/\?.+$/, '');
|
|
5592
|
+
let moduleView = view.replace(/^(\/[-a-z]+\/).*$/, '$1');
|
|
5593
|
+
if (!this.isLinkFakeRoute(view)) {
|
|
5594
|
+
if (user.roles.super_admin) {
|
|
5595
|
+
resolve(true);
|
|
5596
|
+
}
|
|
5597
|
+
else if (!user.roles.groups.filter(a => a.views.some(b => b === view && !this.isLinkPartialRoute(b))).length) {
|
|
5598
|
+
if (user.roles.groups.filter(a => a.views.some(b => b.startsWith(moduleView) && !this.doesLinkHaveParameter(b) && !this.isLinkFakeRoute(b))).length) {
|
|
5599
|
+
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];
|
|
5600
|
+
this._router.navigateByUrl(link);
|
|
5601
|
+
}
|
|
5602
|
+
else {
|
|
5603
|
+
this._router.navigateByUrl('/home');
|
|
5604
|
+
}
|
|
5605
|
+
resolve(false);
|
|
5606
|
+
}
|
|
5607
|
+
else if (!user.roles.groups.filter(a => a.views.some(b => b.startsWith(view) && this.isLinkPartialRoute(b))).length) {
|
|
5608
|
+
if (user.roles.groups.filter(a => a.views.some(b => b.startsWith(moduleView) && !this.doesLinkHaveParameter(b) && !this.isLinkFakeRoute(b))).length) {
|
|
5609
|
+
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];
|
|
5610
|
+
this._router.navigateByUrl(link);
|
|
5611
|
+
}
|
|
5612
|
+
else {
|
|
5613
|
+
this._router.navigateByUrl('/home');
|
|
5614
|
+
}
|
|
5615
|
+
resolve(false);
|
|
5616
|
+
}
|
|
5617
|
+
else {
|
|
5618
|
+
resolve(true);
|
|
5619
|
+
}
|
|
5620
|
+
}
|
|
5621
|
+
else if (!user.roles.groups.filter(a => a.views.some(b => b === view && !this.isLinkPartialRoute(b))).length) {
|
|
5622
|
+
if (user.roles.groups.filter(a => a.views.some(b => b.startsWith(moduleView) && !this.doesLinkHaveParameter(b) && !this.isLinkFakeRoute(b))).length) {
|
|
5623
|
+
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];
|
|
5624
|
+
this._router.navigateByUrl(link);
|
|
5625
|
+
}
|
|
5626
|
+
else {
|
|
5627
|
+
this._router.navigateByUrl('/home');
|
|
5628
|
+
}
|
|
5629
|
+
resolve(false);
|
|
5588
5630
|
}
|
|
5589
|
-
else if (!user.roles.groups.filter(a => a.views.
|
|
5590
|
-
if (user.roles.groups.filter(a => a.views.
|
|
5591
|
-
let link = user.roles.groups.filter(a => a.views.
|
|
5631
|
+
else if (!user.roles.groups.filter(a => a.views.some(b => b.startsWith(view) && this.isLinkPartialRoute(b))).length) {
|
|
5632
|
+
if (user.roles.groups.filter(a => a.views.some(b => b.startsWith(moduleView) && !this.doesLinkHaveParameter(b) && !this.isLinkFakeRoute(b))).length) {
|
|
5633
|
+
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];
|
|
5592
5634
|
this._router.navigateByUrl(link);
|
|
5593
5635
|
}
|
|
5594
5636
|
else {
|
|
@@ -5597,7 +5639,7 @@ class AuthGuard {
|
|
|
5597
5639
|
resolve(false);
|
|
5598
5640
|
}
|
|
5599
5641
|
else {
|
|
5600
|
-
|
|
5642
|
+
this._router.navigateByUrl('/home');
|
|
5601
5643
|
}
|
|
5602
5644
|
}
|
|
5603
5645
|
}
|
|
@@ -5611,12 +5653,33 @@ class AuthGuard {
|
|
|
5611
5653
|
for (let j = 0; j < permission.views.length; j++) {
|
|
5612
5654
|
let view = permission.views[j];
|
|
5613
5655
|
if (view.link === link) {
|
|
5614
|
-
|
|
5615
|
-
|
|
5616
|
-
|
|
5617
|
-
|
|
5618
|
-
|
|
5619
|
-
|
|
5656
|
+
return !!view.has_parameter;
|
|
5657
|
+
}
|
|
5658
|
+
}
|
|
5659
|
+
}
|
|
5660
|
+
return false;
|
|
5661
|
+
}
|
|
5662
|
+
isLinkFakeRoute(link) {
|
|
5663
|
+
let permissions = this._aps.getAllModulePermissions();
|
|
5664
|
+
for (let i = 0; i < permissions.length; i++) {
|
|
5665
|
+
let permission = permissions[i];
|
|
5666
|
+
for (let j = 0; j < permission.views.length; j++) {
|
|
5667
|
+
let view = permission.views[j];
|
|
5668
|
+
if (view.link === link) {
|
|
5669
|
+
return false;
|
|
5670
|
+
}
|
|
5671
|
+
}
|
|
5672
|
+
}
|
|
5673
|
+
return true;
|
|
5674
|
+
}
|
|
5675
|
+
isLinkPartialRoute(link) {
|
|
5676
|
+
let permissions = this._aps.getAllModulePermissions();
|
|
5677
|
+
for (let i = 0; i < permissions.length; i++) {
|
|
5678
|
+
let permission = permissions[i];
|
|
5679
|
+
for (let j = 0; j < permission.views.length; j++) {
|
|
5680
|
+
let view = permission.views[j];
|
|
5681
|
+
if (view.link === link) {
|
|
5682
|
+
return !!view.partial_route;
|
|
5620
5683
|
}
|
|
5621
5684
|
}
|
|
5622
5685
|
}
|
|
@@ -6489,7 +6552,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.9", ngImpor
|
|
|
6489
6552
|
const UserSettingsModulePermission = {
|
|
6490
6553
|
name: 'user-settings',
|
|
6491
6554
|
views: [
|
|
6492
|
-
{ link: '/user-settings/settings', label: 'Settings'
|
|
6555
|
+
{ link: '/user-settings/settings', label: 'Settings' }
|
|
6493
6556
|
],
|
|
6494
6557
|
approval: {
|
|
6495
6558
|
type: 'user-settings'
|
|
@@ -8707,10 +8770,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.9", ngImpor
|
|
|
8707
8770
|
const ReportBuilderModulePermission = {
|
|
8708
8771
|
name: 'report-builder',
|
|
8709
8772
|
views: [
|
|
8710
|
-
{ link: '/report-builder/list', label: 'List'
|
|
8711
|
-
{ link: '/report-builder/new', label: 'New'
|
|
8712
|
-
{ link: '/report-builder/scheduled-job', label: 'Scheduled Job'
|
|
8713
|
-
{ link: '/report-builder/dashboard-builder', label: 'Dashboard Builder'
|
|
8773
|
+
{ link: '/report-builder/list', label: 'List' },
|
|
8774
|
+
{ link: '/report-builder/new', label: 'New' },
|
|
8775
|
+
{ link: '/report-builder/scheduled-job', label: 'Scheduled Job' },
|
|
8776
|
+
{ link: '/report-builder/dashboard-builder', label: 'Dashboard Builder' },
|
|
8714
8777
|
{ link: '/report-builder/detail', label: 'Detail', has_parameter: true },
|
|
8715
8778
|
{ link: '/report-builder/edit', label: 'Edit', has_parameter: true },
|
|
8716
8779
|
{ link: '/report-builder/delete', label: 'Delete', has_parameter: true },
|
|
@@ -8720,9 +8783,9 @@ const ReportBuilderModulePermission = {
|
|
|
8720
8783
|
const SuperAdminModulePermission = {
|
|
8721
8784
|
name: 'super-admin',
|
|
8722
8785
|
views: [
|
|
8723
|
-
{ link: '/super-admin/dashboard', label: 'Dashboard'
|
|
8724
|
-
{ link: '/super-admin/apm', label: 'APM'
|
|
8725
|
-
{ link: '/super-admin/monitor', label: 'Monitor'
|
|
8786
|
+
{ link: '/super-admin/dashboard', label: 'Dashboard' },
|
|
8787
|
+
{ link: '/super-admin/apm', label: 'APM' },
|
|
8788
|
+
{ link: '/super-admin/monitor', label: 'Monitor' }
|
|
8726
8789
|
]
|
|
8727
8790
|
};
|
|
8728
8791
|
|