[Kimchi-devel] [PATCH 4/4] Authorization: Remove actions based on roles

wenwang at linux.vnet.ibm.com wenwang at linux.vnet.ibm.com
Fri Jul 18 11:18:09 UTC 2014


From: Wen Wang <wenwang at linux.vnet.ibm.com>

Authorization: remove actions menu from storage/network tabs for
non-rooot users

Signed-off-by: Wen Wang <wenwang at linux.vnet.ibm.com>

Conflicts:

	ui/js/src/kimchi.network.js
---
 ui/css/theme-default/storage.css |   18 +++++++++---------
 ui/js/src/kimchi.network.js      |    5 +++++
 ui/js/src/kimchi.storage_main.js |    7 +++++++
 3 files changed, 21 insertions(+), 9 deletions(-)

diff --git a/ui/css/theme-default/storage.css b/ui/css/theme-default/storage.css
index e94c1ec..d0e64b3 100644
--- a/ui/css/theme-default/storage.css
+++ b/ui/css/theme-default/storage.css
@@ -17,7 +17,7 @@
  */
 /*   STORAGE   */
 .handle {
-    width: 5%;
+    padding-left: 111px;
 }
 
 .storage-title {
@@ -148,37 +148,37 @@
 }
 
 .storage-name {
-    width: 20%;
+    width: 199px;
 }
 
 .storage-state {
-    width: 5%;
+    width: 51px;
 }
 
 .storage-location {
-    width: 29%;
+    width: 288px;
 }
 
 .storage-type {
-    width: 10%;
+    width: 98px;
 }
 
 .storage-capacity {
-    width: 10%;
+    width: 98px;
 }
 
 .storage-allocate {
-    width: 10%;
+    width: 98px;
 }
 
 
 .storage-button {
-    width: 11%;
+    width: 108px;
     text-align: center;
 }
 
 .title-name {
-    width: 198px;
+    width: 199px;
 }
 
 .title-state {
diff --git a/ui/js/src/kimchi.network.js b/ui/js/src/kimchi.network.js
index a44e33c..0b13feb 100644
--- a/ui/js/src/kimchi.network.js
+++ b/ui/js/src/kimchi.network.js
@@ -22,6 +22,7 @@ kimchi.initNetwork = function() {
     var networkMode = kimchi.cookie.get('NetworkMode');
     if(networkMode != 'admin') {
         $('.tools').remove();
+        $('.header span:last-child').remove();
     }
     kimchi.initNetworkListView();
     kimchi.initNetworkDialog();
@@ -52,6 +53,10 @@ kimchi.initNetworkListView = function() {
 
 kimchi.addNetworkItem = function(network) {
     $("#networkBody").append(kimchi.getNetworkItemHtml(network));
+    var networkMode = kimchi.cookie.get('NetworkMode');
+    if(networkMode != 'admin') {
+        $('.column-action').remove();
+    }
     kimchi.addNetworkActions(network);
 };
 
diff --git a/ui/js/src/kimchi.storage_main.js b/ui/js/src/kimchi.storage_main.js
index 593e7b1..d0b2a17 100644
--- a/ui/js/src/kimchi.storage_main.js
+++ b/ui/js/src/kimchi.storage_main.js
@@ -16,6 +16,10 @@
  * limitations under the License.
  */
 kimchi.doListStoragePools = function() {
+    var storageMode = kimchi.cookie.get('StorageMode');
+    if(storageMode != 'admin') {
+        $('.title-actions').remove();
+    }
     kimchi.listStoragePools(function(result) {
         var storageHtml = $('#storageTmpl').html();
         if (result && result.length) {
@@ -31,6 +35,9 @@ kimchi.doListStoragePools = function() {
             });
             $('#storagepoolsList').html(listHtml);
             kimchi.storageBindClick();
+            if(storageMode != 'admin') {
+                $('.storage-button').remove();
+            }
         } else {
             $('#storagepoolsList').html('');
         }
-- 
1.7.1




More information about the Kimchi-devel mailing list