[Kimchi-devel] [PATCH 2/4] Authorization: remove host/template tabs for non-root users

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


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

This patch removed host/template tabs from non-root users

Signed-off-by: Wen Wang <wenwang at linux.vnet.ibm.com>
---
 ui/js/src/kimchi.main.js |   21 +++++++++++++--------
 1 files changed, 13 insertions(+), 8 deletions(-)

diff --git a/ui/js/src/kimchi.main.js b/ui/js/src/kimchi.main.js
index 8eb4d73..54a0043 100644
--- a/ui/js/src/kimchi.main.js
+++ b/ui/js/src/kimchi.main.js
@@ -23,13 +23,16 @@ kimchi.main = function() {
         $(tabs).each(function(i, tab) {
             var title = tab['title'];
             var path = tab['path'];
-            tabsHtml.push(
-                '<li>',
-                    '<a class="item" href="', path, '">',
-                        title,
-                    '</a>',
-                '</li>'
-            );
+            var mode = tab['mode'];
+            if (mode != 'none') {
+                tabsHtml.push(
+                    '<li>',
+                        '<a class="item" href="', path, '">',
+                            title,
+                        '</a>',
+                    '</li>'
+                );
+            }
         });
         return tabsHtml.join('');
     };
@@ -41,9 +44,11 @@ kimchi.main = function() {
             var titleKey = $tab.find('title').text();
             var title = i18n[titleKey] ? i18n[titleKey] : titleKey;
             var path = $tab.find('path').text();
+            var mode = kimchi.cookie.get(titleKey + 'Mode');
             tabs.push({
                 title: title,
-                path: path
+                path: path,
+                mode: mode
             });
         });
 
-- 
1.7.1




More information about the Kimchi-devel mailing list