mirror of https://github.com/apache/cloudstack.git
bug 8847: createUser api - "account" parameter is required now
status 8847: resolved fixed
This commit is contained in:
parent
670afd2331
commit
5129df106b
|
|
@ -40,7 +40,7 @@ public class CreateUserCmd extends BaseCmd {
|
|||
//////////////// API parameters /////////////////////
|
||||
/////////////////////////////////////////////////////
|
||||
|
||||
@Parameter(name=ApiConstants.ACCOUNT, type=CommandType.STRING, description="Creates the user under the specified account. If no account is specified, the username will be used as the account name.")
|
||||
@Parameter(name=ApiConstants.ACCOUNT, type=CommandType.STRING, required=true, description="Creates the user under the specified account. If no account is specified, the username will be used as the account name.")
|
||||
private String accountName;
|
||||
|
||||
@Parameter(name=ApiConstants.DOMAIN_ID, type=CommandType.LONG, description="Creates the user under the specified domain. Has to be accompanied with the account parameter")
|
||||
|
|
|
|||
|
|
@ -1101,10 +1101,15 @@ public class AccountManagerImpl implements AccountManager, AccountService, Manag
|
|||
String timeZone = cmd.getTimezone();
|
||||
Long accountId = null;
|
||||
|
||||
//default domain to ROOT if not specified
|
||||
if (domainId == null) {
|
||||
domainId = Domain.ROOT_DOMAIN;
|
||||
}
|
||||
|
||||
Account account = _accountDao.findActiveAccount(accountName, domainId);
|
||||
|
||||
if( account == null){
|
||||
throw new InvalidParameterValueException("Unable to find account to create user");
|
||||
if(account == null){
|
||||
throw new InvalidParameterValueException("Unable to find account " + accountName + " in domain id=" + domainId + " to create user");
|
||||
}else{
|
||||
accountId = account.getAccountId();
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue