Beefy Boxes and Bandwidth Generously Provided by pair Networks
Come for the quick hacks, stay for the epiphanies.
 
PerlMonks  

Re: Bitmask or Named permissions

by IOrdy (Friar)
on Oct 07, 2003 at 03:25 UTC ( [id://297166]=note: print w/replies, xml ) Need Help??


in reply to Bitmask or Named permissions

I could be wrong but couldn't you store a seperate permission int for each componenent giving 64 possible permissions per component. That way you still only store an int but a user may have X amount of permission int's depending on the number of components.

You could extend the basic permissions class when you create a component to provide methods(aliases) for your permissions that return a boolean value for each permission. I'm thinking along the lines of Class::DBI for your construction of objects, that way your classes/code need only grab the permissions for the components they are interested in.

some psuedo perl.
package main; use User::Permissions; use User::Permissions::Node; use User::Permissions::Page; my $up = User::Permissions->new(user_id => 1); my $up_page = User::Permissions::Page->new; warn "can read nodes" if User::Permissions::Node->read; # package call warn "can read pages" if $up_page->read; # object call # ... later ... package Foo; use User::Permissions; use User::Permissions::Baz; my $up = User::Permissions->new(user_id => 1); warn "can write baz" if User::Permissions::Baz->write;

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://297166]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others studying the Monastery: (6)
As of 2024-03-28 11:50 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found