use of org.jivesoftware.openfire.user.User in project Openfire by igniterealtime.
the class UserServiceController method updateUser.
/**
* Update user.
*
* @param username
* the username
* @param userEntity
* the user entity
* @throws ServiceException
* the service exception
*/
public void updateUser(String username, UserEntity userEntity) throws ServiceException {
if (userEntity != null && !username.isEmpty()) {
// parameter
if (userEntity.getUsername() != null) {
if (!userEntity.getUsername().equals(username)) {
JustMarriedController.changeName(username, userEntity.getUsername(), true, userEntity.getEmail(), userEntity.getName());
addProperties(userEntity.getUsername(), userEntity.getProperties());
return;
}
}
User user = getAndCheckUser(username);
if (userEntity.getPassword() != null) {
user.setPassword(userEntity.getPassword());
}
if (userEntity.getName() != null) {
user.setName(userEntity.getName());
}
if (userEntity.getEmail() != null) {
user.setEmail(userEntity.getEmail());
}
addProperties(username, userEntity.getProperties());
}
}
use of org.jivesoftware.openfire.user.User in project Openfire by igniterealtime.
the class UserServiceLegacyController method deleteUser.
/**
* Delete user.
*
* @param username the username
* @throws UserNotFoundException the user not found exception
* @throws SharedGroupException the shared group exception
*/
public void deleteUser(String username) throws UserNotFoundException, SharedGroupException {
User user = getUser(username);
userManager.deleteUser(user);
rosterManager.deleteRoster(server.createJID(username, null));
}
use of org.jivesoftware.openfire.user.User in project Openfire by igniterealtime.
the class UserServiceLegacyController method getUserGroups.
/**
* Returns all group names or an empty collection for specific user.
*
* @param username the username
* @return the user groups
* @throws UserNotFoundException the user not found exception
*/
public Collection<String> getUserGroups(String username) throws UserNotFoundException {
User user = getUser(username);
Collection<Group> groups = GroupManager.getInstance().getGroups(user);
Collection<String> groupNames = new ArrayList<String>();
for (Group group : groups) {
groupNames.add(group.getName());
}
return groupNames;
}
Aggregations