use of com.agiletec.aps.system.services.user.User in project entando-core by entando.
the class UserControllerUnitTest method mockUserDetails.
private UserDetails mockUserDetails() {
User user1 = new User();
user1.setUsername("user");
user1.setDisabled(false);
user1.setLastAccess(new Date());
user1.setLastPasswordChange(new Date());
user1.setMaxMonthsSinceLastAccess(2);
user1.setMaxMonthsSinceLastPasswordChange(1);
String password;
try {
password = this.getEncrypter().encrypt("password");
} catch (ApsSystemException ex) {
password = "plain_password";
}
user1.setPassword(password);
return user1;
}
use of com.agiletec.aps.system.services.user.User in project entando-core by entando.
the class UserControllerUnitTest method mockUser.
private UserDto mockUser() {
User user1 = new User();
user1.setUsername("user");
user1.setDisabled(false);
user1.setLastAccess(new Date());
user1.setLastPasswordChange(new Date());
user1.setMaxMonthsSinceLastAccess(2);
user1.setMaxMonthsSinceLastPasswordChange(1);
String password;
try {
password = this.getEncrypter().encrypt("password");
} catch (ApsSystemException ex) {
password = "plain_password";
}
user1.setPassword(password);
return new UserDto(user1);
}
use of com.agiletec.aps.system.services.user.User in project entando-core by entando.
the class TestCurrentUserProfileAction method init.
private void init() throws Exception {
try {
this._userManager = (IUserManager) this.getService(SystemConstants.USER_MANAGER);
this._authorizationManager = (IAuthorizationManager) this.getService(SystemConstants.AUTHORIZATION_SERVICE);
User user = this.createUserForTest(USERNAME_FOR_TEST);
this._userManager.addUser(user);
this._authorizationManager.addUserAuthorization(USERNAME_FOR_TEST, Group.FREE_GROUP_NAME, "editor");
} catch (Throwable t) {
throw new Exception(t);
}
}
use of com.agiletec.aps.system.services.user.User in project entando-core by entando.
the class TestCurrentUserProfileAction method createUserForTest.
protected User createUserForTest(String username) {
User user = new User();
user.setUsername(username);
user.setPassword(username);
return user;
}
use of com.agiletec.aps.system.services.user.User in project entando-core by entando.
the class TestUserAction method testResetUser.
public void testResetUser() throws Throwable {
String username = "username";
String password = "password";
String datePattern = "ddMMyyyy";
String today = DateConverter.getFormattedDate(new Date(), datePattern);
try {
this.addUser(username, password);
User extracted = (User) this._userManager.getUser(username, password);
assertEquals(today, DateConverter.getFormattedDate(extracted.getCreationDate(), datePattern));
assertNull(extracted.getLastAccess());
assertNull(extracted.getLastPasswordChange());
this.setUserOnSession("admin");
this.initAction("/do/User", "save");
this.addParameter("strutsAction", String.valueOf(ApsAdminSystemConstants.EDIT));
this.addParameter("username", username);
this.addParameter("reset", "true");
String result = this.executeAction();
assertEquals(Action.SUCCESS, result);
extracted = (User) this._userManager.getUser(username, password);
assertNotNull(extracted);
assertEquals(today, DateConverter.getFormattedDate(extracted.getCreationDate(), datePattern));
assertEquals(today, DateConverter.getFormattedDate(extracted.getLastAccess(), datePattern));
assertEquals(today, DateConverter.getFormattedDate(extracted.getLastPasswordChange(), datePattern));
} catch (Throwable t) {
throw t;
} finally {
this._userManager.removeUser(username);
}
}
Aggregations