use of com.autentia.tnt.businessobject.User in project TNTConcept by autentia.
the class RequestHolidayBean method getUserRequests.
// Getters to list possible values of related entities
/**
* Get the list of all userRequests
*
* @return the list of all userRequests
*/
public List<SelectItem> getUserRequests() {
List<User> refs = UserManager.getDefault().getAllEntities(null, new SortCriteria("name"));
ArrayList<SelectItem> ret = new ArrayList<SelectItem>();
for (User ref : refs) {
ret.add(new SelectItem(ref, ref.getName()));
}
return ret;
}
use of com.autentia.tnt.businessobject.User in project TNTConcept by autentia.
the class UserHolidaysStateBean method getAll.
public List<UserHolidaysState> getAll() {
List<UserHolidaysState> ret = new ArrayList<UserHolidaysState>();
if (chargeYear == null)
return ret;
UserManager userManager = UserManager.getDefault();
UserSearch searchUser = new UserSearch();
searchUser.setActive(true);
List<User> users = userManager.getAllEntities(searchUser, new SortCriteria(sortColumn, sortAscending));
for (User us : users) {
ret.add(manager.calculateUserHolidaysState(us, this.getChargeYear()));
}
return ret;
}
use of com.autentia.tnt.businessobject.User in project TNTConcept by autentia.
the class ContactBean method getAllUsers.
public List<SelectItem> getAllUsers() {
final List<User> refs = UserManager.getDefault().getAllEntities(null, new SortCriteria("name"));
final List<SelectItem> ret = new ArrayList<SelectItem>();
for (User ref : refs) {
ret.add(new SelectItem(ref, ref.getName()));
}
return ret;
}
use of com.autentia.tnt.businessobject.User in project TNTConcept by autentia.
the class LinkBeanTest method shouldProcessPasswordResetRequest.
@Test
public void shouldProcessPasswordResetRequest() {
User testUser = new User();
testUser.setLogin("testName");
testUser.setActive(true);
testUser.setEmail("test@mail.com");
sutMock.setName("testName");
Link testLink = new Link();
testLink.setLink("randomLink");
doReturn(testUser).when(sutMock).getUserByName("testName");
doReturn(externalContext).when(sutMock).getFacesExternalContext();
doReturn(testLink).when(sutMock).generateLink("testName");
String result = sutMock.passwordResetRequest();
verify(sutMock).sendMail(testLink, "test@mail.com");
assertThat(result, equalTo("emailSent"));
}
use of com.autentia.tnt.businessobject.User in project TNTConcept by autentia.
the class LinkBeanTest method shouldResetPasswordWithLdap.
@Test
public void shouldResetPasswordWithLdap() {
User testUser = new User();
testUser.setPassword("test");
String[] x = new String[] { "x" };
String[] y = new String[] { "y" };
String[] z = new String[] { "z" };
String[] v = new String[] { "v" };
String[] w = new String[] { "w" };
doReturn(x).when(sutMock).callFacesUtilsFormatMessage("AuthenticationManager.randomWords0");
doReturn(y).when(sutMock).callFacesUtilsFormatMessage("AuthenticationManager.randomWords1");
doReturn(z).when(sutMock).callFacesUtilsFormatMessage("AuthenticationManager.randomWords2");
doReturn(v).when(sutMock).callFacesUtilsFormatMessage("AuthenticationManager.randomWords3");
doReturn(w).when(sutMock).callFacesUtilsFormatMessage("AuthenticationManager.randomWords4");
doReturn("changed").when(authManager).resetPasswordExternal(testUser, x, y, z, v, w);
doReturn(false).when(configurationUtil).isLdapProviderEnabled();
String changedPassword = sutMock.resetPassword(testUser);
verify(userManager).updateEntity(testUser, true);
assertThat(changedPassword, equalTo("changed"));
}
Aggregations