[Kimchi-devel] [PATCH] Issue#352: Debug Report Section NOT Hidden for Non-root User

Hongliang Wang hlwang at linux.vnet.ibm.com
Thu Mar 20 10:44:20 UTC 2014


When a non-root user tries to request /debugreports, he will receive
an HTTP 403 error. In this situation, we should hide the section.

Signed-off-by: Hongliang Wang <hlwang at linux.vnet.ibm.com>
---
 ui/js/src/kimchi.host.js | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/ui/js/src/kimchi.host.js b/ui/js/src/kimchi.host.js
index 6e4678f..ae2ee7d 100644
--- a/ui/js/src/kimchi.host.js
+++ b/ui/js/src/kimchi.host.js
@@ -202,6 +202,7 @@ kimchi.host_main = function() {
 
     var listDebugReports = function() {
         kimchi.listReports(function(reports) {
+            $('#debug-report-section').removeClass('hidden');
             $.each(reports, function(i, item) {
                 reports[i]['id'] = i + 1;
             });
@@ -211,6 +212,12 @@ kimchi.host_main = function() {
             else {
                 initReportGrid(reports);
             }
+        }, function(error) {
+            if(error['status'] == 403) {
+                $('#debug-report-section').addClass('hidden');
+                return;
+            }
+            $('#debug-report-section').removeClass('hidden');
         });
     };
 
@@ -281,7 +288,6 @@ kimchi.host_main = function() {
             }
 
             if(capabilities['system_report_tool']) {
-                $('#debug-report-section').removeClass('hidden');
                 listDebugReports();
                 kimchi.topic('kimchi/debugReportAdded')
                     .subscribe(listDebugReports);
-- 
1.8.1.4




More information about the Kimchi-devel mailing list