At 05:34 PM 04/02/2002, Benjamin wrote:
>You hardcoded the modename in every runmode, but if you put the 
>check into cgiapp_init, then you could do something like this (of 
>course you could use the same code in every runmode, or write a 
>subroutine, like Greg suggested, but if the code is placed into 
>cgiapp_init, you have to maintain the permission checking code only 
>in one place ... don't forget TIMTOWTDI ;)
>
>   my $q = $self->query();
>   my $modename = $q->param('rm');
>   unless ($admin->checkPermission("ModuleName_$modename"))
>   {
>         # They do not have permission so send them to the error 
> runmode
>         $q->param('rm', 'error_rm');
>   }

The reason I didn't use something like this is that I have multiple 
run modes that map to the same permission setting.  I have 
permissions like "Edit Event" which covers run modes 
"event_edit_form", "event_edit", "event_cancel", etc.

-- 
Greg Marr
[EMAIL PROTECTED]
"We thought you were dead."
"I was, but I'm better now." - Sheridan, "The Summoning"


---------------------------------------------------------------------
Web Archive:  http://www.mail-archive.com/[email protected]/
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to