mirror of
				https://github.com/apache/cloudstack.git
				synced 2025-11-04 00:02:37 +01:00 
			
		
		
		
	CLOUDSTACK-7908: UserVmResponse returns userid/username information of the creator
Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
This commit is contained in:
		
							parent
							
								
									2b7073c73f
								
							
						
					
					
						commit
						2580edbcfb
					
				@ -52,6 +52,14 @@ public class UserVmResponse extends BaseResponse implements ControlledEntityResp
 | 
				
			|||||||
    @Param(description = "the account associated with the virtual machine")
 | 
					    @Param(description = "the account associated with the virtual machine")
 | 
				
			||||||
    private String accountName;
 | 
					    private String accountName;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    @SerializedName(ApiConstants.USER_ID)
 | 
				
			||||||
 | 
					    @Param(description = "the user's ID who deployed the virtual machine")
 | 
				
			||||||
 | 
					    private String userId;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    @SerializedName(ApiConstants.USERNAME)
 | 
				
			||||||
 | 
					    @Param(description = "the user's name who deployed the virtual machine")
 | 
				
			||||||
 | 
					    private String userName;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    @SerializedName(ApiConstants.PROJECT_ID)
 | 
					    @SerializedName(ApiConstants.PROJECT_ID)
 | 
				
			||||||
    @Param(description = "the project id of the vm")
 | 
					    @Param(description = "the project id of the vm")
 | 
				
			||||||
    private String projectId;
 | 
					    private String projectId;
 | 
				
			||||||
@ -315,6 +323,14 @@ public class UserVmResponse extends BaseResponse implements ControlledEntityResp
 | 
				
			|||||||
        return accountName;
 | 
					        return accountName;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public String getUserId() {
 | 
				
			||||||
 | 
					        return userId;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public String getUserName() {
 | 
				
			||||||
 | 
					        return userName;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    public String getProjectId() {
 | 
					    public String getProjectId() {
 | 
				
			||||||
        return projectId;
 | 
					        return projectId;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
@ -535,6 +551,14 @@ public class UserVmResponse extends BaseResponse implements ControlledEntityResp
 | 
				
			|||||||
        this.accountName = accountName;
 | 
					        this.accountName = accountName;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public void setUserId(String userId) {
 | 
				
			||||||
 | 
					        this.userId = userId;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public void setUserName(String userName) {
 | 
				
			||||||
 | 
					        this.userName = userName;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    @Override
 | 
					    @Override
 | 
				
			||||||
    public void setDomainId(String domainId) {
 | 
					    public void setDomainId(String domainId) {
 | 
				
			||||||
        this.domainId = domainId;
 | 
					        this.domainId = domainId;
 | 
				
			||||||
 | 
				
			|||||||
@ -48,6 +48,8 @@ import com.cloud.hypervisor.Hypervisor.HypervisorType;
 | 
				
			|||||||
import com.cloud.service.ServiceOfferingDetailsVO;
 | 
					import com.cloud.service.ServiceOfferingDetailsVO;
 | 
				
			||||||
import com.cloud.user.Account;
 | 
					import com.cloud.user.Account;
 | 
				
			||||||
import com.cloud.user.AccountManager;
 | 
					import com.cloud.user.AccountManager;
 | 
				
			||||||
 | 
					import com.cloud.user.User;
 | 
				
			||||||
 | 
					import com.cloud.user.dao.UserDao;
 | 
				
			||||||
import com.cloud.uservm.UserVm;
 | 
					import com.cloud.uservm.UserVm;
 | 
				
			||||||
import com.cloud.utils.db.GenericDaoBase;
 | 
					import com.cloud.utils.db.GenericDaoBase;
 | 
				
			||||||
import com.cloud.utils.db.SearchBuilder;
 | 
					import com.cloud.utils.db.SearchBuilder;
 | 
				
			||||||
@ -70,6 +72,8 @@ public class UserVmJoinDaoImpl extends GenericDaoBase<UserVmJoinVO, Long> implem
 | 
				
			|||||||
    public AccountManager _accountMgr;
 | 
					    public AccountManager _accountMgr;
 | 
				
			||||||
    @Inject
 | 
					    @Inject
 | 
				
			||||||
    private UserVmDetailsDao _userVmDetailsDao;
 | 
					    private UserVmDetailsDao _userVmDetailsDao;
 | 
				
			||||||
 | 
					    @Inject
 | 
				
			||||||
 | 
					    private UserDao _userDao;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    private final SearchBuilder<UserVmJoinVO> VmDetailSearch;
 | 
					    private final SearchBuilder<UserVmJoinVO> VmDetailSearch;
 | 
				
			||||||
    private final SearchBuilder<UserVmJoinVO> activeVmByIsoSearch;
 | 
					    private final SearchBuilder<UserVmJoinVO> activeVmByIsoSearch;
 | 
				
			||||||
@ -121,6 +125,11 @@ public class UserVmJoinDaoImpl extends GenericDaoBase<UserVmJoinVO, Long> implem
 | 
				
			|||||||
            userVmResponse.setAccountName(userVm.getAccountName());
 | 
					            userVmResponse.setAccountName(userVm.getAccountName());
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        User user = _userDao.getUser(userVm.getUserId());
 | 
				
			||||||
 | 
					        if (user != null) {
 | 
				
			||||||
 | 
					            userVmResponse.setUserId(user.getUuid());
 | 
				
			||||||
 | 
					            userVmResponse.setUserName(user.getUsername());
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
        userVmResponse.setDomainId(userVm.getDomainUuid());
 | 
					        userVmResponse.setDomainId(userVm.getDomainUuid());
 | 
				
			||||||
        userVmResponse.setDomainName(userVm.getDomainName());
 | 
					        userVmResponse.setDomainName(userVm.getDomainName());
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user