Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » U++ Library support » U++ MT-multithreading and servers » A few questions about Skylark sessions
Re: A few questions about Skylark sessions [message #38698 is a reply to message #38654] Mon, 07 January 2013 22:17 Go to previous messageGo to previous message
Peter is currently offline  Peter
Messages: 16
Registered: October 2012
Promising Member
This time I have a general problem and would like to know the best way to solve it.

As before, suppose I have a web portal. All users must log in to gain access to it. There are two types of users: admins and non-admins. Admin is able to delete any user from database or change his/her data. Let's consider the following scenario. We have two users: admin (A) and other user (B, admin or non-admin).
Both are logged in to my portal. At some point A deletes B from database while B is still logged in. What should happen next? The obvious idea is that B should get logged out as soon as he gets deleted from database, otherwise we'd have an inconsistency such that B would be still "logged in" (his session variable ".LOGGED" set to 1/true/etc.) while he'd be physically removed from database.
How can this problem be solved? My only idea is to check at the beginning of every request handler if the user is still in the database. The test would be based on a unique id value - users table primary key. Session variable would be initialized to this unique id as soon as the user logs in. The pseudocode for one of the handlers would be something like this:

SKYLARK(Handler, "handler")
{
   if(http[".LOGGED"]) // if user is logged
      if table doesn't contain user with id=http[".ID"] anymore
         ClearSession();
}


Is that a correct approach?

What about even trickier case - while B is logged in, A alters some of B's data (login, password or even unique id)? What's the expected behaviour then? Should B remain logged in or not?

 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: [Web] using of an uninitialized value in expression
Next Topic: Something wrong with post_identity()?
Goto Forum:
  


Current Time: Thu Aug 28 11:29:26 CEST 2025

Total time taken to generate the page: 0.06861 seconds