You could extend your idea by simply attaching a privilege set to the user. You set up your privileges in your pre-run logic.

Whenever someone hits a run time that requires some privilege have it test for it. If it fails it can redirect to a login screen. Someone who fails a login or does not have one can simply be treated as an anonymous user.

It would be easy tie this with CGI::Session and encode all the required url parameters, redirect referers (etc) as well as the user details in that.

However, I prefer to separate admin and user functionality. So while you may have users who may do things (requiring privileges) they aren't really administrators of your site (unless your app calls for that). Most of the apps I write have this functionality in a separate program which is locked down right from the start and all attempts at use require a login via the pre_run function. In your case, I would do that.

Hope thats a useful slant on what you have.

In reply to Re: CGI::Application with access control on certain functions/run modes by simon.proctor
in thread CGI::Application with access control on certain functions/run modes by Golo

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.