@Override public UserAccount getUserAccountById(Long userId) { return _userAccountDao.findById(userId); }
@Override public void logoutUser(long userId) { UserAccount userAcct = _userAccountDao.findById(userId); if (userAcct != null) { ActionEventUtils.onActionEvent(userId, userAcct.getAccountId(), userAcct.getDomainId(), EventTypes.EVENT_USER_LOGOUT, "user has logged out"); } // else log some kind of error event? This likely means the user doesn't exist, or has been deleted... }
@Override @ActionEvent(eventType = EventTypes.EVENT_USER_UPDATE, eventDescription = "Updating User") public UserAccount updateUser(UpdateUserCmd updateUserCmd) { UserVO user = retrieveAndValidateUser(updateUserCmd); s_logger.debug("Updating user with Id: " + user.getUuid()); validateAndUpdateApiAndSecretKeyIfNeeded(updateUserCmd, user); Account account = retrieveAndValidateAccount(user); validateAndUpdateFirstNameIfNeeded(updateUserCmd, user); validateAndUpdateLastNameIfNeeded(updateUserCmd, user); validateAndUpdateUsernameIfNeeded(updateUserCmd, user, account); validateUserPasswordAndUpdateIfNeeded(updateUserCmd.getPassword(), user, updateUserCmd.getCurrentPassword()); String email = updateUserCmd.getEmail(); if (StringUtils.isNotBlank(email)) { user.setEmail(email); } String timezone = updateUserCmd.getTimezone(); if (StringUtils.isNotBlank(timezone)) { user.setTimezone(timezone); } _userDao.update(user.getId(), user); return _userAccountDao.findById(user.getId()); }
return _userAccountDao.findById(userId);
if (user.getState().equals(State.locked)) { return _userAccountDao.findById(userId); } else if (user.getState().equals(State.enabled)) { success = doSetUserStatus(user.getId(), State.locked); return _userAccountDao.findById(userId); } else { throw new CloudRuntimeException("Unable to lock user " + userId);
return _userAccountDao.findById(userId); } else { throw new CloudRuntimeException("Unable to disable user " + userId);
return _userAccountDao.findById(userId); } else { throw new CloudRuntimeException("Unable to enable user " + userId);