use of com.autentia.tnt.businessobject.User in project TNTConcept by autentia.
the class AdminHolidayBean 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 RequestHolidayBean method validateHasEnoughAvailableFreeHoliday.
private boolean validateHasEnoughAvailableFreeHoliday() {
User user = AuthenticationManager.getDefault().getCurrentPrincipal().getUser();
int requestedDays = UserHolidaysStateManager.getDefault().getWorkingDays(this.getBeginDate(), this.getFinalDate());
int freeDays = UserHolidaysStateManager.getDefault().getFreeDays(user, this.getChargeYear());
if (log.isDebugEnabled()) {
log.debug("Solicito " + requestedDays + " dias. Le quedan libres " + freeDays + " dias");
}
return (requestedDays <= freeDays);
}
use of com.autentia.tnt.businessobject.User in project TNTConcept by autentia.
the class AvailabilityBean method getAll.
public List<Availability> getAll() {
List<Availability> ret = new ArrayList<Availability>();
UserSearch searchUser = new UserSearch();
searchUser.setActive(true);
SortCriteria sCriteria = new SortCriteria("name");
List<User> users = userMgr.getAllEntities(searchUser, sCriteria);
for (User user : users) {
OcupationModelImpl model = new OcupationModelImpl();
Availability availability = new Availability();
availability.setUser(user);
availability.setModel(model);
fillModelHolidays(user, model);
fillAvailability(user, model);
ret.add(availability);
}
return ret;
}
use of com.autentia.tnt.businessobject.User in project TNTConcept by autentia.
the class LdapCustomAuthenticationProviderTest method shouldNotSetExpiredPasswordWhenPwdGraceUseTimeIsActive.
@Test
public void shouldNotSetExpiredPasswordWhenPwdGraceUseTimeIsActive() {
Attribute noPwdGrace = new BasicAttribute("noPwdGrace");
Attributes attributes = new BasicAttributes();
attributes.put(noPwdGrace);
when(ldapUserDetails.getAttributes()).thenReturn(attributes);
User userForTest = getUserForTest();
Boolean passExpired = sut.checkExpiredPassword(ldapUserDetails.getAttributes());
userForTest.setPasswordExpired(passExpired);
assertThat(passExpired, is(false));
}
use of com.autentia.tnt.businessobject.User in project TNTConcept by autentia.
the class LdapCustomAuthenticationProviderTest method shouldMergeDbUserWithLdapCredentialsWhenMigrationTest.
@Test
public void shouldMergeDbUserWithLdapCredentialsWhenMigrationTest() {
Attribute pwdGraceUseTime = new BasicAttribute("pwdGraceUseTime");
pwdGraceUseTime.add(new Date());
Attributes attributes = new BasicAttributes();
attributes.put(pwdGraceUseTime);
when(ldapUserDetails.getAttributes()).thenReturn(attributes);
User user = getUserForTest();
Principal principal = new Principal(user, new GrantedAuthority[] {});
principal.dto = null;
final String ldapPassword = "ldapPassword";
final Principal ldapPrincipal = sut.mergeUsers(ldapUserDetails, principal, ldapPassword);
assertThat(ldapPrincipal.getId(), is(999));
assertThat(ldapPrincipal.getPassword(), is(ldapPassword));
}
Aggregations