cvs: pear /LiveUser/Perm Complex.php
| From: | Lukas Smith | Date: | Thu, 07 Apr 2005 16:38:28 +0000 |
| Subject: | cvs: pear /LiveUser/Perm Complex.php | ||
| Groups: | php.pear.cvs | ||
| Request: | Send a blank email to pear-cvs+get-31023@lists.php.net to get a copy of this message | ||
lsmith Thu Apr 7 12:38:28 2005 EDT
Modified files:
/pear/LiveUser/Perm Complex.php
Log:
- cleaned up _readImpliedRights()
- fixed bug in readUserRights() that would lead to overwriting the proper right keys
http://cvs.php.net/diff.php/pear/LiveUser/Perm/Complex.php?r1=1.10&r2=1.11&ty=u
Index: pear/LiveUser/Perm/Complex.php
diff -u pear/LiveUser/Perm/Complex.php:1.10 pear/LiveUser/Perm/Complex.php:1.11
--- pear/LiveUser/Perm/Complex.php:1.10 Wed Apr 6 13:16:40 2005
+++ pear/LiveUser/Perm/Complex.php Thu Apr 7 12:38:28 2005
@@ -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: Complex.php,v 1.10 2005/04/06 17:16:40 lsmith Exp $
+ * @version CVS: $Id: Complex.php,v 1.11 2005/04/07 16:38:28 lsmith Exp $
* @link http://pear.php.net/LiveUser
*/
@@ -58,7 +58,7 @@
* @package LiveUser
* @author Lukas Smith <smith@backendmedia.com>
* @author Bjoern Kraus <krausbn@php.net>
- * @version $Id: Complex.php,v 1.10 2005/04/06 17:16:40 lsmith Exp $
+ * @version $Id: Complex.php,v 1.11 2005/04/07 16:38:28 lsmith Exp $
* @copyright 2002-2005 Markus Wolff
* @license http://www.gnu.org/licenses/lgpl.txt
* @version Release: @package_version@
@@ -83,14 +83,12 @@
return null;
}
- $queue = array();
$result = $this->_storage->readImplyingRights($rightIds, $table);
-
- if (!is_array($result) || !count($result)) {
+ if (!is_array($result)) {
return false;
}
- $queue = $result;
+ $queue = $result;
while (count($queue)) {
$currentRights = reset($queue);
$currentLevel = key($queue);
@@ -104,8 +102,8 @@
// only store the implied right if the right wasn't stored before
// or if the level is higher
if (!isset($rightIds[$val['right_id']]) ||
- $rightIds[$val['right_id']] < $val['right_level'])
- {
+ $rightIds[$val['right_id']] < $val['right_level']
+ ) {
$rightIds[$val['right_id']] = $val['right_level'];
if ($val['has_implied']) {
$queue[$val['right_level']][] = $val['right_id'];
@@ -130,10 +128,8 @@
function readUserRights($permUserId)
{
$userRights = parent::readUserRights($permUserId);
- $result = $this->_readImpliedRights($userRights, 'user');
- if ($result) {
- $this->userRights = array_merge($this->userRights, $result);
- }
+ $this->userRights = $this->_readImpliedRights($userRights, 'user');
+
return $this->userRights;
} // end func readUserRights
@@ -194,11 +190,8 @@
function readGroupRights($groupIds)
{
$groupRights = parent::readGroupRights($groupIds);
+ $this->groupRights = $this->_readImpliedRights($groupRights, 'group');
- $result = $this->_readImpliedRights($groupRights, 'group');
- if ($result) {
- $this->groupRights = $result;
- }
return $this->groupRights;
} // end func readGroupRights