use of com.agiletec.aps.system.services.user.User in project entando-core by entando.
the class UserService method updateUser.
private UserDetails updateUser(UserDetails oldUser, UserRequest userRequest) {
User user = new User();
user.setUsername(userRequest.getUsername());
user.setPassword(userRequest.getPassword());
user.setDisabled(userRequest.getStatus() != null && !userRequest.getStatus().equals(IUserService.STATUS_ACTIVE));
if (oldUser.isEntandoUser()) {
User userToClone = (User) oldUser;
user.setLastAccess(userToClone.getLastAccess());
user.setLastPasswordChange(userToClone.getLastPasswordChange());
}
return user;
}
use of com.agiletec.aps.system.services.user.User in project entando-core by entando.
the class UserService method createUser.
private UserDetails createUser(UserRequest userRequest) {
User user = new User();
user.setUsername(userRequest.getUsername());
user.setPassword(userRequest.getPassword());
user.setDisabled(userRequest.getStatus() != null && !userRequest.getStatus().equals(IUserService.STATUS_ACTIVE));
return user;
}
use of com.agiletec.aps.system.services.user.User in project entando-core by entando.
the class UserAction method executeSave.
protected String executeSave(boolean editProfile) {
User user = null;
boolean hasProfile = false;
try {
if (this.getStrutsAction() == ApsAdminSystemConstants.ADD) {
user = new User();
user.setUsername(this.getUsername());
user.setPassword(this.getPassword());
} else if (this.getStrutsAction() == ApsAdminSystemConstants.EDIT) {
user = (User) this.getUserManager().getUser(this.getUsername());
if (null != this.getPassword() && this.getPassword().trim().length() > 0) {
user.setPassword(this.getPassword());
}
hasProfile = this.checkUserProfile(this.getUsername(), null);
}
user.setDisabled(!this.isActive());
if (this.isReset()) {
user.setLastAccess(new Date());
user.setLastPasswordChange(new Date());
}
if (this.getStrutsAction() == ApsAdminSystemConstants.ADD) {
this.getUserManager().addUser(user);
hasProfile = this.checkUserProfile(this.getUsername(), this.getProfileTypeCode());
} else if (this.getStrutsAction() == ApsAdminSystemConstants.EDIT) {
this.getUserManager().updateUser(user);
if (null != this.getPassword() && this.getPassword().trim().length() > 0) {
this.getUserManager().changePassword(this.getUsername(), this.getPassword());
}
}
if (editProfile && hasProfile) {
return "editProfile";
}
} catch (Throwable t) {
_logger.error("error in executeSave", t);
return FAILURE;
}
return SUCCESS;
}
use of com.agiletec.aps.system.services.user.User in project entando-core by entando.
the class TestUserAuthorizationAction method addTestUserAndAuthorities.
private void addTestUserAndAuthorities() throws ApsSystemException {
Group groupForTest = new Group();
groupForTest.setName(TEST_GROUP_NAME);
groupForTest.setDescription("group test description");
this._groupManager.addGroup(groupForTest);
Role roleForTest = new Role();
roleForTest.setName(TEST_ROLE_NAME);
roleForTest.setDescription("role test description");
this._roleManager.addRole(roleForTest);
User user = new User();
user.setUsername(TEST_USER_NAME);
user.setPassword(TEST_USER_PASSWORD);
this._userManager.addUser(user);
this._authorizationManager.addUserAuthorization(TEST_USER_NAME, Group.FREE_GROUP_NAME, TEST_ROLE_NAME);
this._authorizationManager.addUserAuthorization(TEST_USER_NAME, TEST_GROUP_NAME, "admin");
}
use of com.agiletec.aps.system.services.user.User in project entando-core by entando.
the class TestUserProfileAction method createUserForTest.
protected User createUserForTest(String username) {
User user = new User();
user.setUsername(username);
user.setPassword(username);
return user;
}
Aggregations