I am a novice php programmer building a multiuser application in codeigniter.

Now, my boss has told me to look into the ability to log out people based on their changed user access privileges.

Fx. A guy is logged in as a semi admin, but has just been demoted by a real admin to regular user status. Now the semi admin should supposivly be logged out when that happens but this is where my problem occurs.

I can think of a few ways to do this but they all revolve around doing checks that will be redundant in most cases (this is a rare situation but it has occured, i have been told)

My best bet at the moment is to log all the active users in a session db and force them to relog in if their user role changes.

This however is going to generate a lot of trafic on the server for a rare "problem" as the user session data is more fittingly put into a regular session.

So my question in short is, how can i log out a user when his user privileges are changed, without working my server too hard.

Thanks in advance!