in reply to Hide Data based on account
It appears to me that you want to use some form of grouping. Normally group based permissions are most easily handled in a database by building a permissions table which is actually a join table. With the appropriate fields, you can give each user different accesses based upon what site/login they are using.
Something like this can be emulated with lookup hashes.
# Untested my %permissions_for = ('adam' => {'alpha' => 1, 'beta' => 1, }, 'bart' => {'alpha' => 1, 'beta' => 0, }, 'cece' => {'alpha' => 0, 'beta' => 1, ), ); { my $account = 'adam'; my $access = 'beta'; if ($permissions_for{$account}{$access}) { showcontent(1); showcontent(2); } }
In other words, you have a session so you have a user and can store some form of user state. Where you maintain that state lookup table (separate .pl code, database row, current code block) is up to you. You can also add flags for each condition so that you have full control over exactly what is shown each account.
Because this can get complex very fast, some sort of account management software should be created for the admin. You will also want tools to modify account accesses based upon session state. Say, the user wishes to turn on certain alerts, or turn them off.
Initially, you can do this by hand, but at some point you will want more options and a simple way to manage them.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Hide Data based on account
by grashoper (Monk) on Sep 18, 2007 at 21:22 UTC | |
by snopal (Pilgrim) on Sep 19, 2007 at 02:28 UTC | |
by grashoper (Monk) on Sep 19, 2007 at 17:42 UTC | |
by snopal (Pilgrim) on Sep 20, 2007 at 14:44 UTC | |
by grashoper (Monk) on Oct 02, 2007 at 10:11 UTC | |
by snopal (Pilgrim) on Oct 02, 2007 at 15:35 UTC |