From: Michael J. Rubinsky Date: Sun, 12 Dec 2010 00:18:58 +0000 (-0500) Subject: Do away with the ignorePerms parameter, just pass null for perms instead X-Git-Url: https://git.internetallee.de/?a=commitdiff_plain;h=5c885eec082e1c1d963de0fe752e0acf254f59d1;p=horde.git Do away with the ignorePerms parameter, just pass null for perms instead --- diff --git a/framework/Share/lib/Horde/Share/Object/Sql/Hierarchical.php b/framework/Share/lib/Horde/Share/Object/Sql/Hierarchical.php index 27a858b38..ef5d74a80 100644 --- a/framework/Share/lib/Horde/Share/Object/Sql/Hierarchical.php +++ b/framework/Share/lib/Horde/Share/Object/Sql/Hierarchical.php @@ -55,8 +55,7 @@ class Horde_Share_Object_Sql_Hierarchical extends Horde_Share_Object_Sql $user, array('perm' => $perm, 'direction' => 1, 'parent' => $this, - 'all_levels' => $allLevels, - 'ignore_perms' => is_null($perm))); + 'all_levels' => $allLevels)); } /** @@ -102,10 +101,9 @@ class Horde_Share_Object_Sql_Hierarchical extends Horde_Share_Object_Sql /* If we are an existing share, check for any children */ if ($this->getId()) { $children = $this->getShareOb()->listShares(null, - array('perm' => Horde_Perms::EDIT, + array('perm' => null, 'parent' => $this, - 'all_levels' => true, - 'ignore_perms' => true)); + 'all_levels' => true)); } else { $children = array(); } diff --git a/framework/Share/lib/Horde/Share/Sql/Hierarchical.php b/framework/Share/lib/Horde/Share/Sql/Hierarchical.php index 7c35c785f..c84eaf731 100644 --- a/framework/Share/lib/Horde/Share/Sql/Hierarchical.php +++ b/framework/Share/lib/Horde/Share/Sql/Hierarchical.php @@ -43,7 +43,6 @@ class Horde_Share_Sql_Hierarchical extends Horde_Share_Sql * 'parent' Start at this share in the hierarchy. Either share_id or * Horde_Share_Object * 'all_levels' List all levels or just the direct children of parent? - * 'ignore_perms' Don't check perms. * * * @return array The shares the user has access to. @@ -58,8 +57,7 @@ class Horde_Share_Sql_Hierarchical extends Horde_Share_Sql 'sort_by' => null, 'direction' => 0, 'parent' => null, - 'all_levels' => true, - 'ignore_perms' => false), + 'all_levels' => true), $params); $key = md5(serialize(array($userid, $params))); if (!empty($this->_listcache[$key])) { @@ -75,7 +73,7 @@ class Horde_Share_Sql_Hierarchical extends Horde_Share_Sql } $query = 'SELECT DISTINCT s.* ' - . $this->getShareCriteria($userid, $params['perm'], $params['attributes'], $params['parent'], $params['all_levels'], $params['ignore_perms']) + . $this->getShareCriteria($userid, $params['perm'], $params['attributes'], $params['parent'], $params['all_levels']) . ' ORDER BY ' . $sortfield . (($params['direction'] == 0) ? ' ASC' : ' DESC'); @@ -147,11 +145,12 @@ class Horde_Share_Sql_Hierarchical extends Horde_Share_Sql /** * Returns an array of criteria for querying shares. * - * @TODO: check method visisbility, + * @TODO: * remove ignorePerms param, simply set perm to null for this * * @param string $userid The userid of the user to check access for. - * @param integer $perm The level of permissions required. + * @param integer $perm The level of permissions required. Set to null + * to skip permission filtering. * @param mixed $attributes Restrict the shares returned to those who * have these attribute values. * @param mixed $parent The share to start searching in. @@ -163,8 +162,7 @@ class Horde_Share_Sql_Hierarchical extends Horde_Share_Sql * @throws Horde_Share_Exception */ public function getShareCriteria($userid, $perm = Horde_Perms::SHOW, $attributes = null, - $parent = null, $allLevels = true, - $ignorePerms = false) + $parent = null, $allLevels = true) { static $criteria = array(); @@ -181,7 +179,7 @@ class Horde_Share_Sql_Hierarchical extends Horde_Share_Sql $query = ' FROM ' . $this->_table . ' s '; $where = ''; - if (!$ignorePerms) { + if (!is_null($perm)) { if (empty($userid)) { $where = '(' . Horde_SQL::buildClause($this->_db, 's.perm_guest', '&', $perm) . ')'; } else {