cvs: pear /LiveUser/Perm Medium.php

From: Date: Wed, 22 Feb 2006 19:16:03 +0000
Subject: cvs: pear /LiveUser/Perm Medium.php
Groups: php.pear.cvs 
Request: Send a blank email to pear-cvs+get-38500@lists.php.net to get a copy of this message
lsmith Wed Feb 22 19:16:03 2006 UTC Modified files: /pear/LiveUser/Perm Medium.php Log: - fixed warning when user has no group rights http://cvs.php.net/viewcvs.cgi/pear/LiveUser/Perm/Medium.php?r1=1.23&r2=1.24&diff_format=u Index: pear/LiveUser/Perm/Medium.php diff -u pear/LiveUser/Perm/Medium.php:1.23 pear/LiveUser/Perm/Medium.php:1.24 --- pear/LiveUser/Perm/Medium.php:1.23 Wed Feb 22 18:38:11 2006 +++ pear/LiveUser/Perm/Medium.php Wed Feb 22 19:16:03 2006 @@ -40,7 +40,7 @@ * @author Bjoern Kraus <krausbn@php.net> * @copyright 2002-2005 Markus Wolff * @license http://www.gnu.org/licenses/lgpl.txt - * @version CVS: $Id: Medium.php,v 1.23 2006/02/22 18:38:11 lsmith Exp $ + * @version CVS: $Id: Medium.php,v 1.24 2006/02/22 19:16:03 lsmith Exp $ * @link http://pear.php.net/LiveUser */ @@ -129,24 +129,24 @@ return false; } - $tmpRights = $this->group_rights; + $groupRights = is_array($this->group_rights) ? $this->group_rights : array(); // Check if user has individual rights... if (is_array($this->user_rights)) { // Overwrite values from temporary array with values from userrights foreach ($this->user_rights as $right => $level) { - if (array_key_exists($right, $this->group_rights)) { - unset($tmpRights[$right]); + if (array_key_exists($right, $groupRights)) { if ($level < 0) { // Revoking rights: A negative value indicates a maximum // possible right level $max_allowed_level = LIVEUSER_MAX_LEVEL + $level; - $this->rights[$right] = min($this->group_rights[$right], $max_allowed_level); + $this->rights[$right] = min($groupRights[$right], $max_allowed_level); } elseif ($level > 0) { - $this->rights[$right] = max($this->group_rights[$right], $level); + $this->rights[$right] = max($groupRights[$right], $level); } elseif ($level == 0) { unset($this->rights[$right]); } + unset($groupRights[$right]); } elseif ($level < 0) { $this->rights[$right] = LIVEUSER_MAX_LEVEL + $level; } elseif ($level == 0) { @@ -155,7 +155,7 @@ } } - $this->rights+= $tmpRights; + $this->rights+= $groupRights; return $this->rights; }

« previous php.pear.cvs (#38500) next »