@resolveio/client-lib-core 1.2.9 → 1.3.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.
- 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 +15 -49
- package/fesm2015/resolveio-client-lib-core.mjs +135 -78
- package/fesm2015/resolveio-client-lib-core.mjs.map +1 -1
- package/fesm2020/resolveio-client-lib-core.mjs +135 -78
- 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 +3 -1
- package/package.json +1 -1
|
@@ -4815,27 +4815,7 @@ class NavbarModuleComponent extends BaseComponent {
|
|
|
4815
4815
|
}));
|
|
4816
4816
|
this.routerEvents$.push(this._services._app.navbarModuleData.subscribe(data => {
|
|
4817
4817
|
this.menuData = data;
|
|
4818
|
-
|
|
4819
|
-
this.selectedTab = this.menuData.tabs[0];
|
|
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
|
-
}
|
|
4838
|
-
}
|
|
4818
|
+
this.selectTabFromRouter();
|
|
4839
4819
|
}));
|
|
4840
4820
|
this.routerEvents$.push(this._services._app.tourStarted.subscribe(tourStarted => {
|
|
4841
4821
|
this.tourStarted = tourStarted;
|
|
@@ -4847,38 +4827,24 @@ class NavbarModuleComponent extends BaseComponent {
|
|
|
4847
4827
|
});
|
|
4848
4828
|
}
|
|
4849
4829
|
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;
|
|
4830
|
+
if (this.menuData) {
|
|
4831
|
+
if (this._services._router.url === '/') {
|
|
4832
|
+
this.selectedTab = this.menuData.tabs[0];
|
|
4858
4833
|
}
|
|
4859
4834
|
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');
|
|
4835
|
+
this.selectedTab = null;
|
|
4836
|
+
this.currentRoute = this._services._router.url.replace(/\/[a-f0-9]{24}$/, '').replace(/\?.+$/, '');
|
|
4837
|
+
for (let i = 0; i < this.menuData.tabs.length; i++) {
|
|
4838
|
+
let tab = this.menuData.tabs[i];
|
|
4839
|
+
if (tab.link === this.currentRoute) {
|
|
4840
|
+
this.selectedTab = tab;
|
|
4841
|
+
break;
|
|
4842
|
+
}
|
|
4873
4843
|
}
|
|
4874
|
-
if (
|
|
4875
|
-
this.selectedTab = this.menuData.tabs[
|
|
4876
|
-
break;
|
|
4844
|
+
if (this.selectedTab === null) {
|
|
4845
|
+
this.selectedTab = this.menuData.tabs[0];
|
|
4877
4846
|
}
|
|
4878
4847
|
}
|
|
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
4848
|
}
|
|
4883
4849
|
}
|
|
4884
4850
|
tabClass(tab) {
|
|
@@ -5546,14 +5512,49 @@ class AuthGuard {
|
|
|
5546
5512
|
resolve(false);
|
|
5547
5513
|
}
|
|
5548
5514
|
else {
|
|
5549
|
-
let view = state.url.replace(/^(\/[-a-z]+\/[^\/]+)\/.*$/, '$1').replace(
|
|
5550
|
-
let moduleView = view.replace(/^(
|
|
5551
|
-
if (
|
|
5552
|
-
|
|
5515
|
+
let view = state.url.replace(/^(\/[-a-z]+\/[^\/]+)\/.*$/, '$1').replace(/\?.+$/, '');
|
|
5516
|
+
let moduleView = view.replace(/^(\/[-a-z]+\/).*$/, '$1');
|
|
5517
|
+
if (!this.isLinkFakeRoute(view)) {
|
|
5518
|
+
if (user.roles.super_admin) {
|
|
5519
|
+
resolve(true);
|
|
5520
|
+
}
|
|
5521
|
+
else if (!user.roles.groups.filter(a => a.views.some(b => b === view && !this.isLinkPartialRoute(b))).length) {
|
|
5522
|
+
if (user.roles.groups.filter(a => a.views.some(b => b.startsWith(moduleView) && !this.doesLinkHaveParameter(b) && !this.isLinkFakeRoute(b))).length) {
|
|
5523
|
+
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];
|
|
5524
|
+
this._router.navigateByUrl(link);
|
|
5525
|
+
}
|
|
5526
|
+
else {
|
|
5527
|
+
this._router.navigateByUrl('/home');
|
|
5528
|
+
}
|
|
5529
|
+
resolve(false);
|
|
5530
|
+
}
|
|
5531
|
+
else if (!user.roles.groups.filter(a => a.views.some(b => b.startsWith(view) && this.isLinkPartialRoute(b))).length) {
|
|
5532
|
+
if (user.roles.groups.filter(a => a.views.some(b => b.startsWith(moduleView) && !this.doesLinkHaveParameter(b) && !this.isLinkFakeRoute(b))).length) {
|
|
5533
|
+
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];
|
|
5534
|
+
this._router.navigateByUrl(link);
|
|
5535
|
+
}
|
|
5536
|
+
else {
|
|
5537
|
+
this._router.navigateByUrl('/home');
|
|
5538
|
+
}
|
|
5539
|
+
resolve(false);
|
|
5540
|
+
}
|
|
5541
|
+
else {
|
|
5542
|
+
resolve(true);
|
|
5543
|
+
}
|
|
5553
5544
|
}
|
|
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.
|
|
5545
|
+
else if (!user.roles.groups.filter(a => a.views.some(b => b === view && !this.isLinkPartialRoute(b))).length) {
|
|
5546
|
+
if (user.roles.groups.filter(a => a.views.some(b => b.startsWith(moduleView) && !this.doesLinkHaveParameter(b) && !this.isLinkFakeRoute(b))).length) {
|
|
5547
|
+
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];
|
|
5548
|
+
this._router.navigateByUrl(link);
|
|
5549
|
+
}
|
|
5550
|
+
else {
|
|
5551
|
+
this._router.navigateByUrl('/home');
|
|
5552
|
+
}
|
|
5553
|
+
resolve(false);
|
|
5554
|
+
}
|
|
5555
|
+
else if (!user.roles.groups.filter(a => a.views.some(b => b.startsWith(view) && this.isLinkPartialRoute(b))).length) {
|
|
5556
|
+
if (user.roles.groups.filter(a => a.views.some(b => b.startsWith(moduleView) && !this.doesLinkHaveParameter(b) && !this.isLinkFakeRoute(b))).length) {
|
|
5557
|
+
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
5558
|
this._router.navigateByUrl(link);
|
|
5558
5559
|
}
|
|
5559
5560
|
else {
|
|
@@ -5562,7 +5563,7 @@ class AuthGuard {
|
|
|
5562
5563
|
resolve(false);
|
|
5563
5564
|
}
|
|
5564
5565
|
else {
|
|
5565
|
-
|
|
5566
|
+
this._router.navigateByUrl('/home');
|
|
5566
5567
|
}
|
|
5567
5568
|
}
|
|
5568
5569
|
});
|
|
@@ -5581,14 +5582,49 @@ class AuthGuard {
|
|
|
5581
5582
|
resolve(false);
|
|
5582
5583
|
}
|
|
5583
5584
|
else {
|
|
5584
|
-
let view = state.url.replace(/^(\/[-a-z]+\/[^\/]+)\/.*$/, '$1').replace(
|
|
5585
|
-
let moduleView = view.replace(/^(
|
|
5586
|
-
if (
|
|
5587
|
-
|
|
5585
|
+
let view = state.url.replace(/^(\/[-a-z]+\/[^\/]+)\/.*$/, '$1').replace(/\?.+$/, '');
|
|
5586
|
+
let moduleView = view.replace(/^(\/[-a-z]+\/).*$/, '$1');
|
|
5587
|
+
if (!this.isLinkFakeRoute(view)) {
|
|
5588
|
+
if (user.roles.super_admin) {
|
|
5589
|
+
resolve(true);
|
|
5590
|
+
}
|
|
5591
|
+
else if (!user.roles.groups.filter(a => a.views.some(b => b === view && !this.isLinkPartialRoute(b))).length) {
|
|
5592
|
+
if (user.roles.groups.filter(a => a.views.some(b => b.startsWith(moduleView) && !this.doesLinkHaveParameter(b) && !this.isLinkFakeRoute(b))).length) {
|
|
5593
|
+
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];
|
|
5594
|
+
this._router.navigateByUrl(link);
|
|
5595
|
+
}
|
|
5596
|
+
else {
|
|
5597
|
+
this._router.navigateByUrl('/home');
|
|
5598
|
+
}
|
|
5599
|
+
resolve(false);
|
|
5600
|
+
}
|
|
5601
|
+
else if (!user.roles.groups.filter(a => a.views.some(b => b.startsWith(view) && this.isLinkPartialRoute(b))).length) {
|
|
5602
|
+
if (user.roles.groups.filter(a => a.views.some(b => b.startsWith(moduleView) && !this.doesLinkHaveParameter(b) && !this.isLinkFakeRoute(b))).length) {
|
|
5603
|
+
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];
|
|
5604
|
+
this._router.navigateByUrl(link);
|
|
5605
|
+
}
|
|
5606
|
+
else {
|
|
5607
|
+
this._router.navigateByUrl('/home');
|
|
5608
|
+
}
|
|
5609
|
+
resolve(false);
|
|
5610
|
+
}
|
|
5611
|
+
else {
|
|
5612
|
+
resolve(true);
|
|
5613
|
+
}
|
|
5614
|
+
}
|
|
5615
|
+
else if (!user.roles.groups.filter(a => a.views.some(b => b === view && !this.isLinkPartialRoute(b))).length) {
|
|
5616
|
+
if (user.roles.groups.filter(a => a.views.some(b => b.startsWith(moduleView) && !this.doesLinkHaveParameter(b) && !this.isLinkFakeRoute(b))).length) {
|
|
5617
|
+
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];
|
|
5618
|
+
this._router.navigateByUrl(link);
|
|
5619
|
+
}
|
|
5620
|
+
else {
|
|
5621
|
+
this._router.navigateByUrl('/home');
|
|
5622
|
+
}
|
|
5623
|
+
resolve(false);
|
|
5588
5624
|
}
|
|
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.
|
|
5625
|
+
else if (!user.roles.groups.filter(a => a.views.some(b => b.startsWith(view) && this.isLinkPartialRoute(b))).length) {
|
|
5626
|
+
if (user.roles.groups.filter(a => a.views.some(b => b.startsWith(moduleView) && !this.doesLinkHaveParameter(b) && !this.isLinkFakeRoute(b))).length) {
|
|
5627
|
+
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
5628
|
this._router.navigateByUrl(link);
|
|
5593
5629
|
}
|
|
5594
5630
|
else {
|
|
@@ -5597,7 +5633,7 @@ class AuthGuard {
|
|
|
5597
5633
|
resolve(false);
|
|
5598
5634
|
}
|
|
5599
5635
|
else {
|
|
5600
|
-
|
|
5636
|
+
this._router.navigateByUrl('/home');
|
|
5601
5637
|
}
|
|
5602
5638
|
}
|
|
5603
5639
|
}
|
|
@@ -5611,12 +5647,33 @@ class AuthGuard {
|
|
|
5611
5647
|
for (let j = 0; j < permission.views.length; j++) {
|
|
5612
5648
|
let view = permission.views[j];
|
|
5613
5649
|
if (view.link === link) {
|
|
5614
|
-
|
|
5615
|
-
|
|
5616
|
-
|
|
5617
|
-
|
|
5618
|
-
|
|
5619
|
-
|
|
5650
|
+
return !!view.has_parameter;
|
|
5651
|
+
}
|
|
5652
|
+
}
|
|
5653
|
+
}
|
|
5654
|
+
return false;
|
|
5655
|
+
}
|
|
5656
|
+
isLinkFakeRoute(link) {
|
|
5657
|
+
let permissions = this._aps.getAllModulePermissions();
|
|
5658
|
+
for (let i = 0; i < permissions.length; i++) {
|
|
5659
|
+
let permission = permissions[i];
|
|
5660
|
+
for (let j = 0; j < permission.views.length; j++) {
|
|
5661
|
+
let view = permission.views[j];
|
|
5662
|
+
if (view.link === link) {
|
|
5663
|
+
return !!view.fake_route;
|
|
5664
|
+
}
|
|
5665
|
+
}
|
|
5666
|
+
}
|
|
5667
|
+
return false;
|
|
5668
|
+
}
|
|
5669
|
+
isLinkPartialRoute(link) {
|
|
5670
|
+
let permissions = this._aps.getAllModulePermissions();
|
|
5671
|
+
for (let i = 0; i < permissions.length; i++) {
|
|
5672
|
+
let permission = permissions[i];
|
|
5673
|
+
for (let j = 0; j < permission.views.length; j++) {
|
|
5674
|
+
let view = permission.views[j];
|
|
5675
|
+
if (view.link === link) {
|
|
5676
|
+
return !!view.partial_route;
|
|
5620
5677
|
}
|
|
5621
5678
|
}
|
|
5622
5679
|
}
|
|
@@ -6489,7 +6546,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.9", ngImpor
|
|
|
6489
6546
|
const UserSettingsModulePermission = {
|
|
6490
6547
|
name: 'user-settings',
|
|
6491
6548
|
views: [
|
|
6492
|
-
{ link: '/user-settings/settings', label: 'Settings'
|
|
6549
|
+
{ link: '/user-settings/settings', label: 'Settings' }
|
|
6493
6550
|
],
|
|
6494
6551
|
approval: {
|
|
6495
6552
|
type: 'user-settings'
|
|
@@ -8707,10 +8764,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.9", ngImpor
|
|
|
8707
8764
|
const ReportBuilderModulePermission = {
|
|
8708
8765
|
name: 'report-builder',
|
|
8709
8766
|
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'
|
|
8767
|
+
{ link: '/report-builder/list', label: 'List' },
|
|
8768
|
+
{ link: '/report-builder/new', label: 'New' },
|
|
8769
|
+
{ link: '/report-builder/scheduled-job', label: 'Scheduled Job' },
|
|
8770
|
+
{ link: '/report-builder/dashboard-builder', label: 'Dashboard Builder' },
|
|
8714
8771
|
{ link: '/report-builder/detail', label: 'Detail', has_parameter: true },
|
|
8715
8772
|
{ link: '/report-builder/edit', label: 'Edit', has_parameter: true },
|
|
8716
8773
|
{ link: '/report-builder/delete', label: 'Delete', has_parameter: true },
|
|
@@ -8720,9 +8777,9 @@ const ReportBuilderModulePermission = {
|
|
|
8720
8777
|
const SuperAdminModulePermission = {
|
|
8721
8778
|
name: 'super-admin',
|
|
8722
8779
|
views: [
|
|
8723
|
-
{ link: '/super-admin/dashboard', label: 'Dashboard'
|
|
8724
|
-
{ link: '/super-admin/apm', label: 'APM'
|
|
8725
|
-
{ link: '/super-admin/monitor', label: 'Monitor'
|
|
8780
|
+
{ link: '/super-admin/dashboard', label: 'Dashboard' },
|
|
8781
|
+
{ link: '/super-admin/apm', label: 'APM' },
|
|
8782
|
+
{ link: '/super-admin/monitor', label: 'Monitor' }
|
|
8726
8783
|
]
|
|
8727
8784
|
};
|
|
8728
8785
|
|