Re: ACL howto

From: Date: Mon, 16 Jun 2003 14:34:21 +0000
Subject: Re: ACL howto
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-151666@lists.php.net to get a copy of this message
At 06:11 16.06.2003, Sn!per said: --------------------[snip]-------------------- >I have several admin modules for my portal. And I have also several admin >users who are supposed to have access only to certain modules. > >Say, the superadmin can access ALL modules (modA, modB, modC, modD) and >admin-A can only access modA and modB >admin-B can only access modA and modD >... >... > >How can I setup my ACL that do bit (XOR) checking ? --------------------[snip]-------------------- You don't want to XOR but you want to OR (set bits) or to AND (test bits): define('AUTH_APP_A', 0x0001); define('AUTH_APP_B', 0x0002); define('AUTH_APP_C', 0x0004); define('AUTH_APP_D', 0x0008); $adminA->SetAccountRights(AUTH_APP_A | AUTH_APP_B); $adminA->SetAccountRights(AUTH_APP_A | AUTH_APP_D); // on top of AppA if (!($admin->GetAccountRights() & AUTH_APP_A) header('Location: main_menu.php'); // on top of AppB if (!($admin->GetAccountRights() & AUTH_APP_B) header('Location: main_menu.php'); // on top of AppC if (!($admin->GetAccountRights() & AUTH_APP_C) header('Location: main_menu.php'); // on top of AppD if (!($admin->GetAccountRights() & AUTH_APP_D) header('Location: main_menu.php'); This is fairly crude but quite efficient. -- >O Ernest E. Vogelsinger (\) ICQ #13394035 ^ http://www.vogelsinger.at/

« previous php.general (#151666) next »