Search in sources :

Example 11 with UserAccount

use of com.cloud.user.UserAccount in project CloudStack-archive by CloudStack-extras.

the class DisableUserCmd method execute.

@Override
public void execute() {
    UserContext.current().setEventDetails("UserId: " + getId());
    UserAccount user = _accountService.disableUser(getId());
    if (user != null) {
        UserResponse response = _responseGenerator.createUserResponse(user);
        response.setResponseName(getCommandName());
        this.setResponseObject(response);
    } else {
        throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to disable user");
    }
}
Also used : UserResponse(com.cloud.api.response.UserResponse) ServerApiException(com.cloud.api.ServerApiException) UserAccount(com.cloud.user.UserAccount)

Example 12 with UserAccount

use of com.cloud.user.UserAccount in project CloudStack-archive by CloudStack-extras.

the class EnableUserCmd method execute.

@Override
public void execute() {
    UserContext.current().setEventDetails("UserId: " + getId());
    UserAccount user = _accountService.enableUser(getId());
    if (user != null) {
        UserResponse response = _responseGenerator.createUserResponse(user);
        response.setResponseName(getCommandName());
        this.setResponseObject(response);
    } else {
        throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to enable user");
    }
}
Also used : UserResponse(com.cloud.api.response.UserResponse) ServerApiException(com.cloud.api.ServerApiException) UserAccount(com.cloud.user.UserAccount)

Example 13 with UserAccount

use of com.cloud.user.UserAccount in project CloudStack-archive by CloudStack-extras.

the class LockUserCmd method execute.

@Override
public void execute() {
    UserAccount user = _accountService.lockUser(getId());
    if (user != null) {
        UserResponse response = _responseGenerator.createUserResponse(user);
        response.setResponseName(getCommandName());
        this.setResponseObject(response);
    } else {
        throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to lock user");
    }
}
Also used : UserResponse(com.cloud.api.response.UserResponse) ServerApiException(com.cloud.api.ServerApiException) UserAccount(com.cloud.user.UserAccount)

Example 14 with UserAccount

use of com.cloud.user.UserAccount in project cloudstack by apache.

the class EnableUserCmd method execute.

@Override
public void execute() {
    CallContext.current().setEventDetails("UserId: " + getId());
    UserAccount user = _regionService.enableUser(this);
    if (user != null) {
        UserResponse response = _responseGenerator.createUserResponse(user);
        response.setResponseName(getCommandName());
        this.setResponseObject(response);
    } else {
        throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to enable user");
    }
}
Also used : UserResponse(org.apache.cloudstack.api.response.UserResponse) ServerApiException(org.apache.cloudstack.api.ServerApiException) UserAccount(com.cloud.user.UserAccount)

Example 15 with UserAccount

use of com.cloud.user.UserAccount in project cloudstack by apache.

the class LockUserCmd method execute.

@Override
public void execute() {
    UserAccount user = _accountService.lockUser(getId());
    if (user != null) {
        UserResponse response = _responseGenerator.createUserResponse(user);
        response.setResponseName(getCommandName());
        this.setResponseObject(response);
    } else {
        throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to lock user");
    }
}
Also used : UserResponse(org.apache.cloudstack.api.response.UserResponse) ServerApiException(org.apache.cloudstack.api.ServerApiException) UserAccount(com.cloud.user.UserAccount)

Aggregations

UserAccount (com.cloud.user.UserAccount)23 ServerApiException (org.apache.cloudstack.api.ServerApiException)11 ServerApiException (com.cloud.api.ServerApiException)5 UserResponse (com.cloud.api.response.UserResponse)5 UserResponse (org.apache.cloudstack.api.response.UserResponse)5 Domain (com.cloud.domain.Domain)4 CloudAuthenticationException (com.cloud.exception.CloudAuthenticationException)4 Account (com.cloud.user.Account)4 Pair (com.cloud.utils.Pair)3 InvalidParameterValueException (com.cloud.exception.InvalidParameterValueException)2 UserAccountVO (com.cloud.user.UserAccountVO)2 CloudRuntimeException (com.cloud.utils.exception.CloudRuntimeException)2 IOException (java.io.IOException)2 UnsupportedEncodingException (java.io.UnsupportedEncodingException)2 NoSuchAlgorithmException (java.security.NoSuchAlgorithmException)2 ArrayList (java.util.ArrayList)2 AccountResponse (org.apache.cloudstack.api.response.AccountResponse)2 LoginCmdResponse (org.apache.cloudstack.api.response.LoginCmdResponse)2 LdapUser (org.apache.cloudstack.ldap.LdapUser)2 NoLdapUserMatchingQueryException (org.apache.cloudstack.ldap.NoLdapUserMatchingQueryException)2