Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
I don't use Apache::Session, but I do use CGI::Session which is very similar.

There is no method for retrieving what you want, as others have said. But I have done it using my own code. THese remarks assume you are using a serialisation or storage API which you can easily gain access to. In my case I use MySQL. Here is an outline.

  1. Make sure you have the users id or username saved in the session, NOT IN THE COOKIE!.
  2. Write something which will check for orphan sessions, those which have expired but not deleted, and delete them.
  3. Either:
    • Make sure your code checks the user privileges, which must have been updated somewhere else in the system, each time an access is attempted to a privileged page. or:
    • Store a privileges code in the session (but this should be an unecessary duplicate of info stored elsewhere).

      In my case I also store a '_IS_LOGGED_IN' flag in the session so on each page access I can check users status easily. In essence you want the code to check 'is the user logged in' and 'does he have sufficient privilege for this page' as part of the access to each page.
These features are certainly some which could be included in a session manager, but it does depend on just HOW you want to use the session manager. As I said earlier, I don't use Apache::Session, in CGI::Session everything you need to implement these additional features is stored in the session record. Such may not be the case in Apache::Session, you will need to check, but the two modules are closely related.

jdtoronto


In reply to Re: Listing active sessions in Apache::Session? by jdtoronto
in thread Listing active sessions in Apache::Session? by Jeppe

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others surveying the Monastery: (2)
As of 2024-04-19 20:45 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found