From: Scott Baker Date: Mon, 14 Jul 2014 19:24:03 +0000 (-0700) Subject: hide non-member slices, even from admin X-Git-Url: http://git.onelab.eu/?p=plstackapi.git;a=commitdiff_plain;h=0393e5d0a89f6e03a54a3477efb49a33446641c2 hide non-member slices, even from admin --- diff --git a/planetstack/core/xoslib/static/js/xosDeveloper.js b/planetstack/core/xoslib/static/js/xosDeveloper.js index 94749f1..99641c3 100644 --- a/planetstack/core/xoslib/static/js/xosDeveloper.js +++ b/planetstack/core/xoslib/static/js/xosDeveloper.js @@ -12,7 +12,7 @@ DeveloperApp.SliceDetailView = Marionette.ItemView.extend({ DeveloperApp.SliceListView = Marionette.CompositeView.extend({ tagName: "table", - className: "table table-bordered", + className: "table table-bordered table-striped", template: "#developer-slicetable-template", childView: DeveloperApp.SliceDetailView, childViewContainer: "tbody", @@ -27,7 +27,16 @@ DeveloperApp.SliceListView = Marionette.CompositeView.extend({ this.collection.sortVar = fieldName; this.collection.sortOrder = order; this.collection.sort(); - } + }, + + attachHtml: function(compositeView, childView, index) { + // The REST API will let admin users see everything. For the developer + // view we still want to hide slices we are not members of. + if (childView.model.get("sliceInfo").roles.length == 0) { + return; + } + DeveloperApp.SliceListView.__super__.attachHtml(compositeView, childView, index); + }, }); DeveloperApp.on("start", function() {