From 3b436da4d8b66eafd4dec449410f6364ca949584 Mon Sep 17 00:00:00 2001 From: Tino Vazquez Date: Thu, 13 Feb 2014 13:04:13 +0100 Subject: [PATCH] Fix for non admin user log into Sunstone --- src/sunstone/public/js/plugins/groups-tab.js | 15 +++++++++------ src/sunstone/sunstone-server.rb | 3 ++- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/src/sunstone/public/js/plugins/groups-tab.js b/src/sunstone/public/js/plugins/groups-tab.js index 8258b8a700..e8482dc7f6 100644 --- a/src/sunstone/public/js/plugins/groups-tab.js +++ b/src/sunstone/public/js/plugins/groups-tab.js @@ -920,12 +920,15 @@ function setup_add_rp_dialog(group){ add_it = true; - $.each(providers_array, function(index, provider){ - if (provider.ZONE_ID==zone_id && provider.CLUSTER_ID == key) - { - add_it = false; - } - }); + if(providers_array) + { + $.each(providers_array, function(index, provider){ + if (provider.ZONE_ID==zone_id && provider.CLUSTER_ID == key) + { + add_it = false; + } + }); + } if (add_it) { diff --git a/src/sunstone/sunstone-server.rb b/src/sunstone/sunstone-server.rb index dd87129c25..95eb5d9722 100755 --- a/src/sunstone/sunstone-server.rb +++ b/src/sunstone/sunstone-server.rb @@ -212,7 +212,8 @@ helpers do env['rack.session.options'][:expire_after] = 30*60*60*24-1 end - rc = OpenNebula::System.new(client).get_configuration + serveradmin_client = $cloud_auth.client() + rc = OpenNebula::System.new(serveradmin_client).get_configuration return [500, rc.message] if OpenNebula.is_error?(rc) return [500, "Couldn't find out zone identifier"] if !rc['FEDERATION/ZONE_ID']