From 872f778b697102bc7b46ce42a51b690ffb2de6fb Mon Sep 17 00:00:00 2001 From: Iaroslav Moskviak Date: Thu, 14 May 2026 07:57:16 -0400 Subject: [PATCH] hasRole fix --- src/app/core/facets-manager/facets-manager.component.ts | 1 - src/app/core/substance-form/can-register-substance-form.ts | 7 +++---- .../core/substance-ssg4m/substance-ssg4m-form.component.ts | 4 ---- 3 files changed, 3 insertions(+), 9 deletions(-) diff --git a/src/app/core/facets-manager/facets-manager.component.ts b/src/app/core/facets-manager/facets-manager.component.ts index 71c4017f8..edcbd9875 100644 --- a/src/app/core/facets-manager/facets-manager.component.ts +++ b/src/app/core/facets-manager/facets-manager.component.ts @@ -308,7 +308,6 @@ export class FacetsManagerComponent implements OnInit, OnDestroy, AfterViewInit if (this.facetsConfig[facetKey].length && (facetKey === 'default' || (facetKey === 'admin' && isAdmin) - || (facetKey !== 'admin' && this.authService.hasRoles(facetKey)) || (facetKey === 'staging' && this.calledFrom === 'staging'))) { this.facetsConfig[facetKey].forEach(facet => { for (let facetIndex = 0; facetIndex < facetsCopy.length; facetIndex++) { diff --git a/src/app/core/substance-form/can-register-substance-form.ts b/src/app/core/substance-form/can-register-substance-form.ts index 2d708f24a..ef52b4d39 100644 --- a/src/app/core/substance-form/can-register-substance-form.ts +++ b/src/app/core/substance-form/can-register-substance-form.ts @@ -24,14 +24,13 @@ export class CanRegisterSubstanceForm implements CanActivate { } else { this.authService.getAuth().subscribe(auth => { if (auth) { - this.authService.hasAnyRolesAsync('DataEntry', 'SuperDataEntry').subscribe(response => { - if (response) { + this.authService.hasSpecificPrivilege('Create').then(canCreate => { + if (canCreate) { observer.next(true); - observer.complete(); } else { observer.next(this.router.parseUrl('/browse-substance')); - observer.complete(); } + observer.complete(); }); } else { const navigationExtras: NavigationExtras = { diff --git a/src/app/core/substance-ssg4m/substance-ssg4m-form.component.ts b/src/app/core/substance-ssg4m/substance-ssg4m-form.component.ts index 1033c0c47..d82f47bb7 100644 --- a/src/app/core/substance-ssg4m/substance-ssg4m-form.component.ts +++ b/src/app/core/substance-ssg4m/substance-ssg4m-form.component.ts @@ -89,8 +89,6 @@ export class SubstanceSsg4ManufactureFormComponent definition: SubstanceFormDefinition; user: string; feature: string; - isAdmin: boolean; - isUpdater: boolean; isAuthenticated: boolean; messageField: string; errorMessage: string; @@ -161,8 +159,6 @@ export class SubstanceSsg4ManufactureFormComponent this.showFormReadOnly = this.activatedRoute.snapshot.queryParams["readonly"] || "false"; this.loadingService.setLoading(true); - this.isAdmin = this.authService.hasRoles("admin"); - this.isUpdater = this.authService.hasAnyRoles("Updater", "SuperUpdater"); this.isAuthenticated = this.authService.getUser() !== ""; this.overlayContainer = this.overlayContainerService.getContainerElement(); this.imported = false;