techcode has asked for the wisdom of the Perl Monks concerning the following question:
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...
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: How to implement user levels in web apps?
by Zaxo (Archbishop) on Sep 05, 2005 at 01:13 UTC | |
|
Re: How to implement user levels in web apps?
by rruiz (Monk) on Sep 05, 2005 at 04:53 UTC | |
|
Re: How to implement user levels in web apps?
by phaylon (Curate) on Sep 05, 2005 at 11:56 UTC | |
|
Re: How to implement user levels in web apps?
by TedPride (Priest) on Sep 05, 2005 at 09:04 UTC |