System Administrator DevOps Developer Jahia 8

Check if a user is connected

Question

How can we check if a user is connected or not?

Answer

The module distributed-sessions, freely available, introduces the possibility of retrieving the list of the connected users thanks to GraphQL.

Here is an example on how to check if a user with a specific email is connected:

{
  admin{
    jahia{
      distributedSessions{
        sessions(fieldFilter:{filters: {evaluation: EQUAL, fieldName: "user.email", value:"USER@DOMAIN.COM"}}){
          nodes{
            user{
              email
              displayName
              property(name:"j:email")
            }
          }
        }
      }
    }
  }
}