Bug 6905: explicitly deny access when management server is not fully up for service

This commit is contained in:
Kelven Yang 2011-01-14 10:28:00 -08:00
parent 8fbdc0bebf
commit e9b446e3bd
1 changed files with 13 additions and 2 deletions

View File

@ -75,6 +75,12 @@ public class ConsoleProxyServlet extends HttpServlet {
sendResponse(resp, "Service is not ready");
return;
}
if(_ms.getHashKey() == null) {
s_logger.info("Console/thumbnail access denied. Ticket service is not ready yet");
sendResponse(resp, "Service is not ready");
return;
}
String userId = null;
String account = null;
@ -361,10 +367,15 @@ public class ConsoleProxyServlet extends HttpServlet {
private boolean checkSessionPermision(HttpServletRequest req, long vmId, Account accountObj) {
VMInstanceVO vm = _ms.findVMInstanceById(vmId);
if(vm == null) {
s_logger.debug("Console/thumbnail access denied. VM " + vmId + " does not exist in system any more");
return false;
}
if(accountObj.getType() == Account.ACCOUNT_TYPE_ADMIN)
return true;
VMInstanceVO vm = _ms.findVMInstanceById(vmId);
switch(vm.getType())
{
case User :