Re: User/ACL management class update
| From: | Markus Wolff | Date: | Mon, 08 Jul 2002 13:22:19 +0000 |
| Subject: | Re: User/ACL management class update | ||
| References: | 1 2 | Groups: | php.pear.dev |
| Request: | Send a blank email to pear-dev+get-7559@lists.php.net to get a copy of this message | ||
Am Mon, 08 Jul 2002 11:26:25 +0200 schrieb Bertrand Mansion <bmansion@mamasam.com>:
> In liveUser :
>
> if (is_array($this->groupRights)) {
> while(list($currentGroup, $groupAreas) = each($this->groupRights)) {
> while(list($currentArea, $areaRights) = each($groupAreas)) {
> while(list($currentRight, $rightName) = each($areaRights)) {
> $tmpRights[$currentArea][$rightName] = 1;
> }
> }
> }
> } else {
> $this->groupRights = FALSE;
> }
>
> Maybe you could use 'bit bashing' here to make it lighter ?
> Going through the rights array every time you need to know a user has the
> right to be here is a bit heavy.
Hi Bertrand,
thanks for your feedback! This is a little misunderstanding: These loops
are only used once for building the rights structure after reading it
from a database (in 99% of all cases, thats at login time). After that,
the arrays remain untouched and are stored in the session as a part of
the user object.
The actual checkRight() method doesn´t loop through the entire rights
array, that indeed would be overkill.
> You might also want to extend PEAR in order to make use of pear error
> handling. I would also suggest you use constants to define your login error
> codes like in Auth.
I´m unsure if it´s a good idea to extend PEAR as the user object is
stored in the session, so it probably shouldn´t be bigger than it
already is.
It´s definitely a good idea to implement a more standardized error
handling (now I finally remember what I forgot to mention in the todo
list) - but again I´m unsure if this is the right time to implement this
as there seem to be some changes to raiseError() on the way and also
there´s going to be Zend Engine 2 with those fancy try/throw/catch
mechanisms that I can´t wait to get my hands on :-)
Okay okay, I realize this thing´s not going to be around for another few
months...
Maybe Stig can give some more information (if he has everything planned
through already) what changes exactly are being made to raiseError and
what his plans are on assuring backwards compatibility?
Regards,
Markus
--
*21st Media* | Consulting, Konzeption, Produktion für die Bereiche:
Markus Wolff | Internet, Intranet, eCommerce, Content Management,
Hamburg,Germany | Softwareentwicklung, 3D-Animation, Videostreaming
http://21st.de | Tel. [+49](0)40/6887949-0, Fax: [+49](0)40/6887949-1