@Override public Locale getLocale() { return getUserSession().getLocale(); } }
protected Locale getLocale() { return userSessionSource.getUserSession().getLocale(); }
protected Locale getLocale() { return userSessionSource.getUserSession().getLocale(); }
public RestUserSessionInfo(UserSession userSession) { this.id = userSession.getId(); this.locale = userSession.getLocale(); }
public NoUserSessionHandler() { super(NoUserSessionException.class.getName()); Connection connection = App.getInstance().getConnection(); //noinspection ConstantConditions locale = connection.getSession().getLocale(); }
@Override protected Locale getUserLocale() { return userSessionSource.checkCurrentUserSession() ? userSessionSource.getUserSession().getLocale() : messageTools.getDefaultLocale(); }
Date dateTime = new Date(Long.parseLong(dateTimeMillis)); sb.append(datatype.format(dateTime, userSession.getLocale())).append("\n"); sb.append(entry.getValue());
@Override protected Locale getUserLocale() { return userSessionSource.checkCurrentUserSession() ? userSessionSource.getUserSession().getLocale() : messageTools.getDefaultLocale(); }
@Override public String createConnectorId(ClientConnector connector) { if (connector instanceof Component) { Component component = (Component) connector; String id = component.getId() == null ? super.createConnectorId(connector) : component.getId(); UserSession session = getAttribute(UserSession.class); String login = null; String locale = null; if (session != null) { login = session.getCurrentOrSubstitutedUser().getLogin(); if (session.getLocale() != null) { locale = session.getLocale().toLanguageTag(); } } StringBuilder idParts = new StringBuilder(); if (login != null) { idParts.append(login); } if (locale != null) { idParts.append(locale); } idParts.append(id); return toLongNumberString(idParts.toString()); } return super.createConnectorId(connector); }
public UserInfo getUserInfo() { User user = userSessionSource.getUserSession().getCurrentOrSubstitutedUser(); UserInfo userInfo = new UserInfo(user); userInfo.setLocale(userSessionSource.getUserSession().getLocale().toString()); return userInfo; } }
protected Locale getUserLocale() { return userSessionSource.checkCurrentUserSession() ? userSessionSource.getUserSession().getLocale() : messages.getTools().getDefaultLocale(); } }
@Override protected void initNewItem(User item) { addDefaultRoles(item); item.setLanguage(messages.getTools().localeToString(userSession.getLocale())); initUserGroup(item); }
@Override public RemoteInvocation createRemoteInvocation(MethodInvocation methodInvocation) { SecurityContext securityContext = AppContext.getSecurityContext(); CubaRemoteInvocation remoteInvocation = new CubaRemoteInvocation(methodInvocation, securityContext == null ? null : securityContext.getSessionId()); if (securityContext != null) { UserSession session = securityContext.getSession(); if (session instanceof ClientBasedSession && ((ClientBasedSession) session).hasRequestScopedInfo()) { remoteInvocation.setLocale(session.getLocale() != null ? session.getLocale().toLanguageTag() : null); remoteInvocation.setTimeZone(session.getTimeZone()); remoteInvocation.setAddress(session.getAddress()); remoteInvocation.setClientInfo(session.getClientInfo()); } } return remoteInvocation; } }
/** * Create a new session from existing for another user and fill it with security data for that new user. * Must be called inside a transaction. * @param src existing session * @param user another user instance * @return new session with the same ID as existing */ public UserSession createSession(UserSession src, User user) { List<Role> roles = new ArrayList<>(); for (UserRole userRole : user.getUserRoles()) { if (userRole.getRole() != null) { roles.add(userRole.getRole()); } } UserSession session = new UserSession(src, user, roles, src.getLocale()); compilePermissions(session, roles); if (user.getGroup() == null) throw new IllegalStateException("User is not in a Group"); compileConstraints(session, user.getGroup()); compileSessionAttributes(session, user.getGroup()); return session; }
Locale loggedInLocale = connection.getSession().getLocale();
setLocale(userSession.getLocale());