I'm interested in general how do you people do that?

In my case, I'm using CGI::Application, CGI::Application::Dispatch, CGI::Application::Plugin::AutoRunmode and of course CGI::Session (thought it's plug-in for CGI::App) and my idea is :

When user logs in, I write it's user level in his session. As my packages go like this : CGI::App <= My CGI::App (to use CGI::Simple) <= My Main module <= All modules containing RunModes. Where <= means inheritance (use base).

I just realised that I could and probably should move 'My CGI:App' code in 'My Main module' as it only implements one method (query so it would use CGI::Simple instead of CGI.pm)

As I already have implemented cgiapp_init method in 'My Main module' - which is called before any RunMode is executed, I just need to call some method from it, say user_level() which I need to implement/override in each package with RunModes. To ease the things RunModes should be grouped into modules by user level.

Other idea would be to write down in database for each user which 'options' he (or user group he's in) can start. It seems like a better solution, but I'm not sure how to implement that ...

If anyone has better solution I would appreciate to hear it. This also seems like a nice idea for next plug-in for CGI::App - unless I'm the only one who needs this...


In reply to How to implement user levels in web apps? by techcode

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



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.