hide non-member slices, even from admin
authorScott Baker <smbaker@gmail.com>
Mon, 14 Jul 2014 19:24:03 +0000 (12:24 -0700)
committerScott Baker <smbaker@gmail.com>
Mon, 14 Jul 2014 19:24:03 +0000 (12:24 -0700)
planetstack/core/xoslib/static/js/xosDeveloper.js

index 94749f1..99641c3 100644 (file)
@@ -12,7 +12,7 @@ DeveloperApp.SliceDetailView = Marionette.ItemView.extend({
 
 DeveloperApp.SliceListView = Marionette.CompositeView.extend({
   tagName: "table",\r
-  className: "table table-bordered",\r
+  className: "table table-bordered table-striped",\r
   template: "#developer-slicetable-template",\r
   childView: DeveloperApp.SliceDetailView,\r
   childViewContainer: "tbody",\r
@@ -27,7 +27,16 @@ DeveloperApp.SliceListView = Marionette.CompositeView.extend({
       this.collection.sortVar = fieldName;\r
       this.collection.sortOrder = order;\r
       this.collection.sort();\r
-  }\r
+  },\r
+\r
+  attachHtml: function(compositeView, childView, index) {\r
+      // The REST API will let admin users see everything. For the developer\r
+      // view we still want to hide slices we are not members of.\r
+      if (childView.model.get("sliceInfo").roles.length == 0) {\r
+          return;\r
+      }\r
+      DeveloperApp.SliceListView.__super__.attachHtml(compositeView, childView, index);\r
+  },\r
 });\r
 
 DeveloperApp.on("start", function() {