use of org.openforis.collect.model.User in project collect by openforis.
the class ClientUserManager method insertUser.
@Override
public User insertUser(String name, String rawPassword, UserRole role, User createdByUser) throws UserPersistenceException {
User user = new User(name);
user.setRawPassword(rawPassword);
user.addRole(role);
save(user, createdByUser);
return user;
}
use of org.openforis.collect.model.User in project collect by openforis.
the class RandomRecordGenerator method generate.
@Transactional
public CollectRecord generate(int surveyId, NewRecordParameters parameters) {
CollectSurvey survey = surveyManager.getById(surveyId);
User user = loadUser(parameters.getUserId(), parameters.getUsername());
RecordKey recordKey = provideRandomRecordKey(survey, user, parameters.isOnlyUnanalyzedSamplingPoints());
if (recordKey == null) {
return null;
}
return this.generate(surveyId, parameters, recordKey);
}
use of org.openforis.collect.model.User in project collect by openforis.
the class SurveySelectVM method performSurveyPublishing.
protected void performSurveyPublishing(CollectSurvey survey, Binder binder) {
try {
User loggedUser = getLoggedUser();
surveyManager.publish(survey, loggedUser);
selectedSurvey = null;
notifyChange("selectedSurvey");
reloadSurveySummaries(binder);
MessageUtil.showInfo("survey.successfully_published", survey.getName());
surveyManager.validateRecords(survey.getId(), loggedUser);
} catch (SurveyStoreException e) {
throw new RuntimeException(e);
}
}
use of org.openforis.collect.model.User in project collect by openforis.
the class LocalUserManager method insertUser.
/**
* Inserts a new user with name, password and role as specified.
* @return
*
* @throws UserPersistenceException
*/
@Override
@Transactional(readOnly = false, propagation = REQUIRED)
public User insertUser(String name, String password, UserRole role, User createdByUser) throws UserPersistenceException {
User user = new User(name);
user.setRawPassword(password);
user.addRole(role);
save(user, createdByUser);
return user;
}
use of org.openforis.collect.model.User in project collect by openforis.
the class LocalUserManager method verifyPassword.
@Override
public boolean verifyPassword(String username, String password) {
User user = userDao.loadByUserName(username, true);
String encodedPassword = encodePassword(password);
return user.getPassword().equals(encodedPassword);
}
Aggregations