Search in sources :

Example 1 with UserProxy

use of org.openforis.collect.model.proxy.UserProxy in project collect by openforis.

the class UserService method save.

public UserProxy save(UserProxy user) throws UserPersistenceException {
    User u = user.toUser();
    userManager.save(u, sessionManager.getLoggedUser());
    UserProxy proxy = new UserProxy(u);
    return proxy;
}
Also used : User(org.openforis.collect.model.User) UserProxy(org.openforis.collect.model.proxy.UserProxy)

Example 2 with UserProxy

use of org.openforis.collect.model.proxy.UserProxy 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;
}
Also used : SessionState(org.openforis.collect.web.session.SessionState) User(org.openforis.collect.model.User) HashMap(java.util.HashMap) UserProxy(org.openforis.collect.model.proxy.UserProxy)

Aggregations

User (org.openforis.collect.model.User)2 UserProxy (org.openforis.collect.model.proxy.UserProxy)2 HashMap (java.util.HashMap)1 SessionState (org.openforis.collect.web.session.SessionState)1