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 484d8d6bac3cf8f6769482eb90031a9038636b1b
Author: Andriana Kovalyshyn <[email protected]>
AuthorDate: Thu May 30 13:23:32 2019 +0300

    [DLAB-631]: added admin guard to check user access
---
 .../resources/webapp/src/app/core/core.module.ts   |  2 ++
 .../webapp/src/app/core/services/admin.quard.ts    | 31 ++++++++++++++++++++++
 .../webapp/src/app/core/services/index.ts          |  1 +
 3 files changed, 34 insertions(+)

diff --git 
a/services/self-service/src/main/resources/webapp/src/app/core/core.module.ts 
b/services/self-service/src/main/resources/webapp/src/app/core/core.module.ts
index 0280665..4b308c3 100644
--- 
a/services/self-service/src/main/resources/webapp/src/app/core/core.module.ts
+++ 
b/services/self-service/src/main/resources/webapp/src/app/core/core.module.ts
@@ -27,6 +27,7 @@ import { UserAccessKeyService } from 
'./services/userAccessKey.service';
 import { UserResourceService } from './services/userResource.service';
 import { AuthorizationGuard } from './services/authorization.guard';
 import { CloudProviderGuard } from './services/cloudProvider.guard';
+import { AdminGuard } from './services/admin.quard';
 import { CheckParamsGuard } from './services/checkParams.guard';
 import { LibrariesInstallationService } from 
'./services/librariesInstallation.service';
 import { ManageUngitService } from './services/manageUngit.service';
@@ -57,6 +58,7 @@ export class CoreModule {
       providers: [
         ApplicationSecurityService,
         AuthorizationGuard,
+        AdminGuard,
         CloudProviderGuard,
         CheckParamsGuard,
         UserAccessKeyService,
diff --git 
a/services/self-service/src/main/resources/webapp/src/app/core/services/admin.quard.ts
 
b/services/self-service/src/main/resources/webapp/src/app/core/services/admin.quard.ts
new file mode 100644
index 0000000..a58e4cc
--- /dev/null
+++ 
b/services/self-service/src/main/resources/webapp/src/app/core/services/admin.quard.ts
@@ -0,0 +1,31 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import { Injectable } from '@angular/core';
+import { CanActivate, ActivatedRouteSnapshot, RouterStateSnapshot } from 
'@angular/router';
+import { HealthStatusService } from './healthStatus.service';
+
+@Injectable()
+export class AdminGuard implements CanActivate {
+  constructor(private _healthStatus: HealthStatusService) {}
+
+  canActivate(next: ActivatedRouteSnapshot, state: RouterStateSnapshot) {
+    return this._healthStatus.isPassageway('administration');
+  }
+}
diff --git 
a/services/self-service/src/main/resources/webapp/src/app/core/services/index.ts
 
b/services/self-service/src/main/resources/webapp/src/app/core/services/index.ts
index 803fd9d..caf1904 100644
--- 
a/services/self-service/src/main/resources/webapp/src/app/core/services/index.ts
+++ 
b/services/self-service/src/main/resources/webapp/src/app/core/services/index.ts
@@ -24,6 +24,7 @@ export * from './healthStatus.service';
 export * from './userAccessKey.service';
 export * from './userResource.service';
 export * from './authorization.guard';
+export * from './admin.quard';
 export * from './cloudProvider.guard';
 export * from './checkParams.guard';
 export * from './librariesInstallation.service';


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to