mirror of https://github.com/apache/cloudstack.git
ApiServer: Log a better message if api access fails and debug it
Signed-off-by: Rohit Yadav <bhaisaab@apache.org>
This commit is contained in:
parent
345c179e77
commit
e63e352508
|
|
@ -552,14 +552,14 @@ public class ApiServer implements HttpRequestHandler {
|
|||
if (userId != null) {
|
||||
User user = ApiDBUtils.findUserById(userId);
|
||||
if (!isCommandAvailable(user, commandName)) {
|
||||
s_logger.warn("The given command:" + commandName + " does not exist or it is not available for user");
|
||||
s_logger.debug("The given command:" + commandName + " does not exist or it is not available for user with id:" + userId);
|
||||
throw new ServerApiException(BaseCmd.UNSUPPORTED_ACTION_ERROR, "The given command does not exist or it is not available for user");
|
||||
}
|
||||
return true;
|
||||
} else {
|
||||
// check against every available command to see if the command exists or not
|
||||
if (!isCommandAvailable(null, commandName) && !commandName.equals("login") && !commandName.equals("logout")) {
|
||||
s_logger.warn("The given command:" + commandName + " does not exist or it is not available for user");
|
||||
s_logger.debug("The given command:" + commandName + " does not exist or it is not available for user with id:" + userId);
|
||||
throw new ServerApiException(BaseCmd.UNSUPPORTED_ACTION_ERROR, "The given command does not exist or it is not available for user");
|
||||
}
|
||||
}
|
||||
|
|
@ -653,8 +653,8 @@ public class ApiServer implements HttpRequestHandler {
|
|||
UserContext.updateContext(user.getId(), account, null);
|
||||
|
||||
if (!isCommandAvailable(user, commandName)) {
|
||||
s_logger.warn("The given command:" + commandName + " does not exist or it is not available for user");
|
||||
throw new ServerApiException(BaseCmd.UNSUPPORTED_ACTION_ERROR, "The given command:" + commandName + " does not exist or it is not available for user");
|
||||
s_logger.debug("The given command:" + commandName + " does not exist or it is not available for user");
|
||||
throw new ServerApiException(BaseCmd.UNSUPPORTED_ACTION_ERROR, "The given command:" + commandName + " does not exist or it is not available for user with id:" + userId);
|
||||
}
|
||||
|
||||
// verify secret key exists
|
||||
|
|
|
|||
Loading…
Reference in New Issue