[dev] Customising Auth::isAdmin()

Jan Schneider jan at horde.org
Wed Aug 27 03:08:52 PDT 2003


Zitat von Vijay Mahrra <vijay.mahrra at es.easynet.net>:

> My reasoning was that this way of extending capabilities doesn't require
> having to alter the capabilities array in any other drivers or the parent
> class.  Calling empty($this->capabilities[$capability])
> assumes that $capability actually exists as a key in the
> $this->capabilities
> array.  I was thinking that if a programmer extended the capabilities in
> a
> custom driver, for example added the 'isadmin' capability I suggested,
> and
> 'isadmin' isn't listed in Auth.php's isAdmin() capabilities array an
> error
> could occur (because the array key doesn't exist).

Did you actually try this out? I don't think it would cause an error. And if
it does, just use:

if (isset($this->capabilities[$capability]) &&
    !empty($this->capabilities[$capability]))

Jan.

--
http://www.horde.org - The Horde Project
http://www.ammma.de - discover your knowledge
http://www.tip4all.de - Deine private Tippgemeinschaft


More information about the dev mailing list