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

User access controlled by subroutine attribute.

by rlb3 (Deacon)
on Aug 14, 2006 at 17:03 UTC ( [id://567336]=perlquestion: print w/replies, xml ) Need Help??

This is an archived low-energy page for bots and other anonmyous visitors. Please sign up if you are a human and want to interact.

rlb3 has asked for the wisdom of the Perl Monks concerning the following question:

Hello monks,

I think I just need someone to smack me on the head and tell me this is a bad idea so I can move on. What I've been thinking about is an Attribute::Handler that controls user access to a subroutine or method. It would look some thing like this:

read_log('failed'); slurp_shadow(); sub read_log :access_list('rlb3','root') { ... } sub slurp_shadow :access_root { ... }

Is this as dumb an idea as I think or is there some hope?

Thanks,

Replies are listed 'Best First'.
Re: User access controlled by subroutine attribute.
by chromatic (Archbishop) on Aug 14, 2006 at 17:25 UTC

    Perl Hacks has an example of that. I used a similar method to add access control to objects accessible through web services. It worked wonderfully.

      Thanks for replying.

      It's funny, I was listening to your talk on PDX.pm that got me thinking about Attribute::Handler. And I agree that your access control to objects works but I'm having this nagging feeling that using it for user access will have weird problems for users. Like a user getting so far into a program before they get an access denied. That may not be a bad thing. I'm just not sure.

        You could check permissions up front, and check it again at the function level as a failsafe. That way, your users won't normally get "far into a program" before getting an error.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://567336]
Approved by Paladin
help
Sections?
Information?
Find Nodes?
Leftovers?
    Notices?
    hippoepoptai's answer Re: how do I set a cookie and redirect was blessed by hippo!
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.