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;
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.