Missing/changed/undocumented CUBA --> Jmix stuff, Pt. 3: UserSessionsAPI

In Jmix, how can one get the count of active user sessions? In CUBA, we did:

    @Inject
    private UserSessionsAPI userSessions;

and then,

    private int getAllSessionCount() {
        return (int) userSessions.getUserSessionsStream().count();
    }

    private int getNonSystemSessionCount() {
        return (int) userSessions.getUserSessionsStream().filter(s -> !s.isSystem()).count();
    }

Obviously, in Jmix there is no UserSessionsAPI and its replacement isn’t mentioned in the migration docs.

Ideas? :slight_smile:

1 Like

Any pointers/ideas on this one?

Any ideas here? This will be a major stopping point for us, for sure.

The Audit add-on contains the UserSessions service that provides information about current user sessions. Also the add-on has a screen that displays active sessions and allows to invalidate them.

Keep in mind, that in Jmix there are no “middleware” user sessions as it was in CUBA. API and screens mentioned above leverages Spring security mechanisms and work with HTTP-sessions. Out of the box it doesn’t support clustered deployment.