diff --git a/src/sunstone/public/js/sunstone.js b/src/sunstone/public/js/sunstone.js index a2c282d8e8..b0029e382a 100644 --- a/src/sunstone/public/js/sunstone.js +++ b/src/sunstone/public/js/sunstone.js @@ -443,7 +443,7 @@ $(document).ready(function(){ timeout: true, success: function (request, obj_list){ $.each(obj_list,function(){ - $('.zone-ul').append('
  • '+this.ZONE.NAME+'
  • '); + $('.zone-ul').append('
  • '+this.ZONE.NAME+'
  • '); }); }, error: onError @@ -454,8 +454,7 @@ $(document).ready(function(){ url: 'config', type: "HEAD", headers: { - "ZONE_ENDPOINT": this.id, - "ZONE_NAME" : this.className.split(" ")[1] + "ZONE_NAME" : this.id }, dataType: "json", success: function(){ diff --git a/src/sunstone/sunstone-server.rb b/src/sunstone/sunstone-server.rb index 73e1d73bbe..e0f7319ae1 100755 --- a/src/sunstone/sunstone-server.rb +++ b/src/sunstone/sunstone-server.rb @@ -224,18 +224,22 @@ before do unless request.path=='/login' || request.path=='/' || request.path=='/vnc' halt 401 unless authorized? - # Extra check: Retrieve list - - if env['HTTP_ZONE_ENDPOINT'] - session[:active_zone_endpoint] = env['HTTP_ZONE_ENDPOINT'] - end - - if env['HTTP_ZONE_ENDPOINT'] && env['HTTP_ZONE_ENDPOINT'].to_i == -1 - session.delete(:active_zone_endpoint) - end - + # Extra check: Retrieve list if env['HTTP_ZONE_NAME'] session[:zone_name] = env['HTTP_ZONE_NAME'] + + client=$cloud_auth.client(session[:user]) + zpool = ZonePoolJSON.new(client) + + rc = zpool.info + + return [500, rc.to_json] if OpenNebula.is_error?(rc) + + zpool.each{|z| + if z['TEMPLATE/ENDPOINT'] == env['HTTP_ZONE_NAME'] + session[:active_zone_endpoint] = z['TEMPLATE/ENDPOINT'] + end + } end end