Hello,
I want to implement a feature that allows the Admin to view all logged-in users, regardless of the device they're using. The Admin should also have the ability to log out specific users from the portal and send them a notification.
Can anyone share relevant resources or a working example for this scenario in ODC?
Thanks in advance!
Shashi Mishra
Hi Shashi,
Based on my knowledge, the only "standard" available action is the User_Logout action. You can create custom logic to log out users by calling this action. However, be cautious, as it logs out the current user session, which means you need to ensure it doesn’t inadvertently log out the admin.
There is an idea to allow passing the user ID to this function, but it is currently on the “Outsystems Radar.” I encourage you to cast your vote for this idea to help prioritize its implementation.
In the absence of a native solution, there is a post with an example that offers an alternative. Please check out this post: How to log out a specific user.
Additionally, you can refer to this detailed article on Medium: How to log out a specific user in OutSystems 11 for more insights on the implementation. Is for Outsystems 11, but is easily adapted to ODC.
Let me know if you need any further assistance!
Best regards,
Gonçalo Ferraria
thank you for quick reply.
i tried with provided logout action, but there is no option to send userID.
What I thick first we have to check logged in user condition,After go for logout.
I will check link you shared and back to you for further assistance if required.
Hello Gonçalo Ferraria ,
I reviewed the link you shared, but neither solution works for ODC since the server action (User_Logout) isn't available.
Could you suggest an alternative approach for ODC?
Thanks in advance.
To implement this feature in OutSystems:
Track Active Sessions: Create a UserSessions entity to store user session details (e.g., UserID, SessionID, device info). Record a session when users log in.
Log Out Specific Users: Provide an Admin interface to view active users from the UserSessions entity. Use the "Logout" action to invalidate a user’s session.
Send Notifications: Use OutSystems built-in notification mechanisms (email, in-app, or push) to notify users when they are logged out.
Hello lokesh,
Thank you for reply , I thought in your way but in ODC i stuck. Could you provide more detail?
It is not possible for one user to access another user's session and force a logout. Apart from what @Gonçalo Ferraria has shared, you might consider using websockets. All connected devices could subscribe to a channel and listen for messages. When a logout message is received, a client action to log out could be triggered. On the server side, you could build an interface to look up and list subscribed clients from the channel and send messages to log them out. You might use Pusher channels (https://pusher.com/channels/) for this. I don't have a ready-to-use solution implemented, but theoretically, it should work.
Hi,
Please check the link below, it will give you an idea.
https://www.outsystems.com/forums/discussion/35093/how-to-log-out-a-specific-user/