[Kimchi-devel] [PATCH 3/4] Authorization: remove [+] icon from non-root users view

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


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

This patch removes [+] icon from the toolbar for users without 'admin'
role

Signed-off-by: Wen Wang <wenwang at linux.vnet.ibm.com>
---
 ui/js/src/kimchi.guest_main.js   |    4 ++++
 ui/js/src/kimchi.network.js      |    4 ++++
 ui/js/src/kimchi.storage_main.js |    4 ++++
 3 files changed, 12 insertions(+), 0 deletions(-)

diff --git a/ui/js/src/kimchi.guest_main.js b/ui/js/src/kimchi.guest_main.js
index acbae15..3d3a4b8 100644
--- a/ui/js/src/kimchi.guest_main.js
+++ b/ui/js/src/kimchi.guest_main.js
@@ -323,6 +323,10 @@ kimchi.guestSetRequestHeader = function(xhr) {
 };
 
 kimchi.guest_main = function() {
+    var guestsMode = kimchi.cookie.get('GuestsMode');
+    if(guestsMode != 'admin') {
+        $('.tools').remove();
+    }
     $("#vm-add").on("click", function(event) {
         kimchi.window.open('guest-add.html');
     });
diff --git a/ui/js/src/kimchi.network.js b/ui/js/src/kimchi.network.js
index cbd967f..a44e33c 100644
--- a/ui/js/src/kimchi.network.js
+++ b/ui/js/src/kimchi.network.js
@@ -19,6 +19,10 @@
 kimchi.NETWORK_TYPE_BRIDGE = "bridged";
 
 kimchi.initNetwork = function() {
+    var networkMode = kimchi.cookie.get('NetworkMode');
+    if(networkMode != 'admin') {
+        $('.tools').remove();
+    }
     kimchi.initNetworkListView();
     kimchi.initNetworkDialog();
     kimchi.initNetworkCreation();
diff --git a/ui/js/src/kimchi.storage_main.js b/ui/js/src/kimchi.storage_main.js
index 3a18f82..593e7b1 100644
--- a/ui/js/src/kimchi.storage_main.js
+++ b/ui/js/src/kimchi.storage_main.js
@@ -234,6 +234,10 @@ kimchi.initLogicalPoolExtend = function() {
 }
 
 kimchi.storage_main = function() {
+    var storageMode = kimchi.cookie.get('StorageMode');
+    if(storageMode != 'admin') {
+        $('.tools').remove();
+    }
     $('#storage-pool-add').on('click', function() {
         kimchi.window.open('storagepool-add.html');
     });
-- 
1.7.1




More information about the Kimchi-devel mailing list