views:

22

answers:

1

Hi,

In our project, we have a situation where the administrator needs to 'force log off' a particular user under certain conditions. In other words, the admin user needs to have the ability to kill any other user's session.

Is this possible? By using the session properties, we can kill the current session (the current user's session) but is it possible (for the admin user) to kill some other user's session?

+1  A: 

You could add a boolean value to the user table in your database (or wherever you store usernames/passwords). Then write a conditional statement in the part of the code that checks if a user is authorized to perform his current requested action.

In the conditional statement, if the boolean flag is true, then delete his session. If false continue as normal.

Then all you have to do is set the user's boolean flag to true and the next action he takes will log him out.

Stephen