This is an automated email from the ASF dual-hosted git repository.

ankovalyshyn pushed a commit to branch feature/projects
in repository https://gitbox.apache.org/repos/asf/incubator-dlab.git

commit deffcedfb8e46cebc2ad1f9737a93933bf76156e
Author: Andriana Kovalyshyn <andriana_kovalys...@epam.com>
AuthorDate: Thu May 30 13:24:13 2019 +0300

    [DLAB-631]: modified passageway to check user access
---
 .../resources/webapp/src/app/core/services/cloudProvider.guard.ts | 2 +-
 .../webapp/src/app/core/services/healthStatus.service.ts          | 8 ++++++--
 2 files changed, 7 insertions(+), 3 deletions(-)

diff --git 
a/services/self-service/src/main/resources/webapp/src/app/core/services/cloudProvider.guard.ts
 
b/services/self-service/src/main/resources/webapp/src/app/core/services/cloudProvider.guard.ts
index 5ebfa1e..7127cc0 100644
--- 
a/services/self-service/src/main/resources/webapp/src/app/core/services/cloudProvider.guard.ts
+++ 
b/services/self-service/src/main/resources/webapp/src/app/core/services/cloudProvider.guard.ts
@@ -26,6 +26,6 @@ export class CloudProviderGuard implements CanActivate {
   constructor(private _healthStatus: HealthStatusService) {}
 
   canActivate(next: ActivatedRouteSnapshot, state: RouterStateSnapshot) {
-    return this._healthStatus.isBillingEnabled();
+    return this._healthStatus.isPassageway('billing');
   }
 }
diff --git 
a/services/self-service/src/main/resources/webapp/src/app/core/services/healthStatus.service.ts
 
b/services/self-service/src/main/resources/webapp/src/app/core/services/healthStatus.service.ts
index 68795b2..8dbad93 100644
--- 
a/services/self-service/src/main/resources/webapp/src/app/core/services/healthStatus.service.ts
+++ 
b/services/self-service/src/main/resources/webapp/src/app/core/services/healthStatus.service.ts
@@ -108,17 +108,21 @@ export class HealthStatusService {
         catchError(ErrorUtils.handleServiceError));
   }
 
-  public isBillingEnabled(): Observable<boolean> {
+  public isPassageway(parameter: string): Observable<boolean> {
     return this.applicationServiceFacade
       .buildGetEnvironmentHealthStatus()
       .pipe(
         map(response => {
           if (response.status === HTTP_STATUS_CODES.OK) {
             const data = response.body;
-            if (!data.billingEnabled) {
+            if (parameter === 'billing' && !data.billingEnabled) {
               this.appRoutingService.redirectToHomePage();
               return false;
             }
+            if (parameter === 'administration' && !data.admin) {
+              this.appRoutingService.redirectToNoAccessPage();
+              return false;
+            }
           }
           return true;
         }));


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@dlab.apache.org
For additional commands, e-mail: commits-h...@dlab.apache.org

Reply via email to