Search in sources :

Example 6 with ClientUserSession

use of com.haulmont.cuba.client.ClientUserSession in project cuba by cuba-platform.

the class AppUI method updateUiTheme.

protected void updateUiTheme() {
    UserSession userSession = userSessionSource.getUserSession();
    if (userSession instanceof ClientUserSession && ((ClientUserSession) userSession).isAuthenticated()) {
        // load theme from user settings
        String themeName = userSettingsTools.loadAppWindowTheme();
        if (!Objects.equals(themeName, getTheme())) {
            // check theme support
            Set<String> supportedThemes = themeConstantsRepository.getAvailableThemes();
            if (supportedThemes.contains(themeName)) {
                app.applyTheme(themeName);
                setTheme(themeName);
            }
        }
    }
}
Also used : ClientUserSession(com.haulmont.cuba.client.ClientUserSession) ClientUserSession(com.haulmont.cuba.client.ClientUserSession) UserSession(com.haulmont.cuba.security.global.UserSession)

Aggregations

ClientUserSession (com.haulmont.cuba.client.ClientUserSession)6 UserSession (com.haulmont.cuba.security.global.UserSession)3 SecurityContext (com.haulmont.cuba.core.sys.SecurityContext)1 AuthenticationDetails (com.haulmont.cuba.security.auth.AuthenticationDetails)1 LoginException (com.haulmont.cuba.security.global.LoginException)1 UIRefreshEvent (com.haulmont.cuba.web.events.UIRefreshEvent)1 SessionHeartbeatEvent (com.haulmont.cuba.web.security.events.SessionHeartbeatEvent)1