Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

User access controlled by subroutine attribute.

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

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 21: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
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others sharing their wisdom with the Monastery: (6)
As of 2024-04-24 11:34 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found