You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@helix.apache.org by jx...@apache.org on 2017/12/20 17:54:14 UTC

[11/50] [abbrv] helix git commit: [helix-front] Adding support for permission check

[helix-front] Adding support for permission check


Project: http://git-wip-us.apache.org/repos/asf/helix/repo
Commit: http://git-wip-us.apache.org/repos/asf/helix/commit/fc04d533
Tree: http://git-wip-us.apache.org/repos/asf/helix/tree/fc04d533
Diff: http://git-wip-us.apache.org/repos/asf/helix/diff/fc04d533

Branch: refs/heads/master
Commit: fc04d533dca89ca872ad7031ca69bc497b98919e
Parents: 6aa4266
Author: Vivo Xu <vx...@linkedin.com>
Authored: Mon Sep 11 16:50:23 2017 -0700
Committer: Junkai Xue <jx...@linkedin.com>
Committed: Mon Nov 6 17:07:36 2017 -0800

----------------------------------------------------------------------
 .../app/cluster/cluster-detail/cluster-detail.component.html    | 2 +-
 .../app/cluster/cluster-detail/cluster-detail.component.ts      | 3 ++-
 .../client/app/cluster/cluster-list/cluster-list.component.html | 2 +-
 .../client/app/cluster/cluster-list/cluster-list.component.ts   | 2 ++
 .../configuration/config-detail/config-detail.component.html    | 2 +-
 .../app/configuration/config-detail/config-detail.component.ts  | 3 +++
 helix-front/client/app/core/helix.service.ts                    | 5 +++++
 helix-front/server/controllers/helix.ts                         | 5 +++++
 8 files changed, 20 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/helix/blob/fc04d533/helix-front/client/app/cluster/cluster-detail/cluster-detail.component.html
----------------------------------------------------------------------
diff --git a/helix-front/client/app/cluster/cluster-detail/cluster-detail.component.html b/helix-front/client/app/cluster/cluster-detail/cluster-detail.component.html
index f70725b..835481d 100644
--- a/helix-front/client/app/cluster/cluster-detail/cluster-detail.component.html
+++ b/helix-front/client/app/cluster/cluster-detail/cluster-detail.component.html
@@ -18,7 +18,7 @@
           <a md-button color="accent" routerLink="controller">{{ cluster.controller }}</a>
         </h6>
         <span fxFlex="1 1 auto"></span>
-        <button md-mini-fab [mdMenuTriggerFor]="menu">
+        <button md-mini-fab *ngIf="can" [mdMenuTriggerFor]="menu">
           <md-icon>menu</md-icon>
         </button>
         <md-menu #menu="mdMenu">

http://git-wip-us.apache.org/repos/asf/helix/blob/fc04d533/helix-front/client/app/cluster/cluster-detail/cluster-detail.component.ts
----------------------------------------------------------------------
diff --git a/helix-front/client/app/cluster/cluster-detail/cluster-detail.component.ts b/helix-front/client/app/cluster/cluster-detail/cluster-detail.component.ts
index 7c6ca42..6333117 100644
--- a/helix-front/client/app/cluster/cluster-detail/cluster-detail.component.ts
+++ b/helix-front/client/app/cluster/cluster-detail/cluster-detail.component.ts
@@ -24,6 +24,7 @@ export class ClusterDetailComponent implements OnInit {
   ];
 
   cluster: Cluster;
+  can = false;
 
   constructor(
     protected route: ActivatedRoute,
@@ -37,7 +38,7 @@ export class ClusterDetailComponent implements OnInit {
 
   ngOnInit() {
     this.route.data.subscribe(data => this.cluster = data.cluster);
-
+    this.clusterService.can().subscribe(data => this.can = data);
     this.route.params
       .map(p => p.name)
       .subscribe(name => {

http://git-wip-us.apache.org/repos/asf/helix/blob/fc04d533/helix-front/client/app/cluster/cluster-list/cluster-list.component.html
----------------------------------------------------------------------
diff --git a/helix-front/client/app/cluster/cluster-list/cluster-list.component.html b/helix-front/client/app/cluster/cluster-list/cluster-list.component.html
index 81fa648..480bd51 100644
--- a/helix-front/client/app/cluster/cluster-list/cluster-list.component.html
+++ b/helix-front/client/app/cluster/cluster-list/cluster-list.component.html
@@ -5,7 +5,7 @@
     </md-spinner>
   </section>
   <md-nav-list *ngIf="!isLoading && !errorMessage">
-    <button md-mini-fab (click)="createCluster()">
+    <button md-mini-fab *ngIf="can" (click)="createCluster()">
       <md-icon>add</md-icon>
     </button>
     <h3 md-subheader>Clusters</h3>

http://git-wip-us.apache.org/repos/asf/helix/blob/fc04d533/helix-front/client/app/cluster/cluster-list/cluster-list.component.ts
----------------------------------------------------------------------
diff --git a/helix-front/client/app/cluster/cluster-list/cluster-list.component.ts b/helix-front/client/app/cluster/cluster-list/cluster-list.component.ts
index 66905b3..f9a2321 100644
--- a/helix-front/client/app/cluster/cluster-list/cluster-list.component.ts
+++ b/helix-front/client/app/cluster/cluster-list/cluster-list.component.ts
@@ -16,6 +16,7 @@ export class ClusterListComponent implements OnInit {
   clusters: Cluster[] = [];
   errorMessage: string = '';
   isLoading: boolean = true;
+  can: boolean = false;
 
   constructor(
     protected clusterService: ClusterService,
@@ -25,6 +26,7 @@ export class ClusterListComponent implements OnInit {
 
   ngOnInit() {
     this.loadClusters();
+    this.clusterService.can().subscribe(data => this.can = data);
   }
 
   loadClusters() {

http://git-wip-us.apache.org/repos/asf/helix/blob/fc04d533/helix-front/client/app/configuration/config-detail/config-detail.component.html
----------------------------------------------------------------------
diff --git a/helix-front/client/app/configuration/config-detail/config-detail.component.html b/helix-front/client/app/configuration/config-detail/config-detail.component.html
index 826e258..1bbf564 100644
--- a/helix-front/client/app/configuration/config-detail/config-detail.component.html
+++ b/helix-front/client/app/configuration/config-detail/config-detail.component.html
@@ -4,7 +4,7 @@
 
   <hi-node-viewer
     [obj]="obj"
-    [unlockable]="clusterName != null"
+    [unlockable]="can && clusterName != null"
     (update)="updateConfig($event)"
     (create)="createConfig($event)"
     (delete)="deleteConfig($event)">

http://git-wip-us.apache.org/repos/asf/helix/blob/fc04d533/helix-front/client/app/configuration/config-detail/config-detail.component.ts
----------------------------------------------------------------------
diff --git a/helix-front/client/app/configuration/config-detail/config-detail.component.ts b/helix-front/client/app/configuration/config-detail/config-detail.component.ts
index 3958b9d..31591c2 100644
--- a/helix-front/client/app/configuration/config-detail/config-detail.component.ts
+++ b/helix-front/client/app/configuration/config-detail/config-detail.component.ts
@@ -15,6 +15,7 @@ export class ConfigDetailComponent implements OnInit {
   isLoading = true;
   obj: any = {};
   clusterName: string;
+  can = false;
 
   constructor(
     protected route: ActivatedRoute,
@@ -59,6 +60,8 @@ export class ConfigDetailComponent implements OnInit {
           });
       }
     }
+
+    this.service.can().subscribe(data => this.can = data);
   }
 
   loadClusterConfig() {

http://git-wip-us.apache.org/repos/asf/helix/blob/fc04d533/helix-front/client/app/core/helix.service.ts
----------------------------------------------------------------------
diff --git a/helix-front/client/app/core/helix.service.ts b/helix-front/client/app/core/helix.service.ts
index 3a3b59b..8bb0345 100644
--- a/helix-front/client/app/core/helix.service.ts
+++ b/helix-front/client/app/core/helix.service.ts
@@ -13,6 +13,11 @@ export class HelixService {
     private http: Http
   ) { }
 
+  public can(): Observable<boolean> {
+    return this
+      .request(`/can`, '');
+  }
+
   protected request(path: string, helix?: string): Observable<any> {
 
     if (helix == null) {

http://git-wip-us.apache.org/repos/asf/helix/blob/fc04d533/helix-front/server/controllers/helix.ts
----------------------------------------------------------------------
diff --git a/helix-front/server/controllers/helix.ts b/helix-front/server/controllers/helix.ts
index 7f1fe17..6565499 100644
--- a/helix-front/server/controllers/helix.ts
+++ b/helix-front/server/controllers/helix.ts
@@ -10,6 +10,7 @@ export class HelixCtrl {
 
   constructor(router: Router) {
     router.route('/helix/list').get(this.list);
+    router.route('/helix/can').get(this.can);
     router.route('/helix/*').all(this.proxy);
   }
 
@@ -51,4 +52,8 @@ export class HelixCtrl {
   protected list(req: Request, res: Response) {
     res.json(HELIX_ENDPOINTS);
   }
+
+  protected can(req: Request, res: Response) {
+    res.json(false);
+  }
 }