use of org.openforis.collect.web.session.SessionState in project collect by openforis.
the class SessionService method initSession.
/**
* Set a locale (language, country) into the session state object
*
* @return map with user, sessionId
* @throws DatabaseVersionNotCompatibleException
*/
// @Secured("isAuthenticated()")
public Map<String, Object> initSession(String locale) throws DatabaseVersionNotCompatibleException {
databaseVersionManager.checkIsVersionCompatible();
sessionManager.setLocale(locale);
SessionState sessionState = sessionManager.getSessionState();
User user = sessionState.getUser();
UserProxy userProxy = new UserProxy(user);
String sessionId = sessionState.getSessionId();
Map<String, Object> result = new HashMap<String, Object>();
result.put("user", userProxy);
result.put("sessionId", sessionId);
return result;
}
use of org.openforis.collect.web.session.SessionState in project collect by openforis.
the class SessionService method setActiveSurvey.
protected SurveyProxy setActiveSurvey(CollectSurvey survey, boolean work) {
SessionState sessionState = sessionManager.getSessionState();
sessionState.setActiveSurvey(survey);
sessionState.setActiveSurveyWork(work);
SurveyProxy proxy = new SurveyProxy(survey);
return proxy;
}
use of org.openforis.collect.web.session.SessionState in project collect by openforis.
the class UserSessionService method changePassword.
public OperationResult changePassword(String oldPassword, String newPassword) throws UserPersistenceException {
SessionState sessionState = sessionManager.getSessionState();
User currentUser = sessionState.getUser();
return userManager.changePassword(currentUser.getUsername(), oldPassword, newPassword);
}
use of org.openforis.collect.web.session.SessionState in project collect by openforis.
the class BackupRestoreController method createRecordFilter.
private RecordFilter createRecordFilter(CollectSurvey survey, Integer rootEntityId, boolean onlyOwnedRecords, String[] rootEntityKeyValues) {
RecordFilter recordFilter = new RecordFilter(survey, rootEntityId);
// filter by record owner
if (onlyOwnedRecords) {
SessionState sessionState = sessionManager.getSessionState();
User user = sessionState.getUser();
recordFilter.setOwnerId(user.getId());
}
// filter by root entity keys
recordFilter.setKeyValues(rootEntityKeyValues);
return recordFilter;
}
use of org.openforis.collect.web.session.SessionState in project collect by openforis.
the class SessionManager method setLocale.
public void setLocale(String localeStr) {
Locale locale = toLocale(localeStr);
SessionState sessionState = getSessionState();
sessionState.setLocale(locale);
}
Aggregations