Greeting Monks,
I'm writing account synchronization scripts, and I'm not sure how to allow plugins.
Each account has flags stating which queries it was a part of, so someone might be part of a staff_ft query and a student query or whatever. I have a file that lists the queries and then lists the permissions granted by the queries (i.e, login, email, wireless access). I now need to write the logic to set and unset the actual LDAP permissions.
I have an idea, but it seems horribly ugly and wrong, so I'd really like a better one.
Create a package, AccountPermission with something like:
sub new {
my $class = shift();
my $self = bless( { }, $class );
return( $self );
}
To add a permission type, such as login, one would create a login.pm file that would inherit AccountPermission. One would then create two subs, run_if_permission_present and run_if_permission_absent.
All of these would be a in a local lib directory. From the main program, I'd get the directory contents to get the list of all permission plugins and put it into a Set::Scalar.
For each of them, I'd load them in an exec to catch any dies and then create a new of each and then can both function names. I _think_ that this would make sure that the files were reasonably well behaved.
And then do a:
$permissions_to_be_set = $set_of_known_permissions->intersection($permissions);
$permissions_to_be_unset = $set_of_known_permissions->difference($permissions);
Then then run the applicable methods.
I don't see any reason for it not to work. The main part that makes most of my ideas fail is that I need a complete list of plugins, as I need to be able to make sure that if login permissions are removed, the login plugin gets to know that and removes the applicable ldap flags.
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.