cvs: pear /LiveUser_Admin Admin.php
| From: | Lukas Smith | Date: | Tue, 07 Feb 2006 10:54:40 +0000 |
| Subject: | cvs: pear /LiveUser_Admin Admin.php | ||
| Groups: | php.pear.cvs | ||
| Request: | Send a blank email to pear-cvs+get-38031@lists.php.net to get a copy of this message | ||
lsmith Tue Feb 7 10:54:40 2006 UTC
Modified files:
/pear/LiveUser_Admin Admin.php
Log:
- made LiveUser_Admin::getUsers() API as flexible as in the containers
http://cvs.php.net/viewcvs.cgi/pear/LiveUser_Admin/Admin.php?r1=1.56&r2=1.57&diff_format=u
Index: pear/LiveUser_Admin/Admin.php
diff -u pear/LiveUser_Admin/Admin.php:1.56 pear/LiveUser_Admin/Admin.php:1.57
--- pear/LiveUser_Admin/Admin.php:1.56 Sun Dec 18 12:42:28 2005
+++ pear/LiveUser_Admin/Admin.php Tue Feb 7 10:54:40 2006
@@ -57,7 +57,7 @@
* @author Bjoern Kraus <krausbn@php.net>
* @copyright 2002-2005 Markus Wolff
* @license http://www.gnu.org/licenses/lgpl.txt
- * @version CVS: $Id: Admin.php,v 1.56 2005/12/18 12:42:28 lsmith Exp $
+ * @version CVS: $Id: Admin.php,v 1.57 2006/02/07 10:54:40 lsmith Exp $
* @link http://pear.php.net/LiveUser_Admin
*/
@@ -514,30 +514,38 @@
*
* @param string either 'auth' or 'perm' to determine if users should
first
* be searched in the 'auth' or 'perm' container
- * @param array filters (as for getUsers()
- * @param bool if only one row should be returned
+ * @param array params (as for getUsers()
* @return array|bool array with userinfo if found on success or false otherwise
*
* @access public
*/
- function getUsers($container = 'perm', $filter = array(), $first = false)
+ function getUsers($container = 'perm', $param = array())
{
+ if (array_key_exists('select', $param)) {
+ if ($param['select'] != 'row' && $param['select']
!= 'all') {
+ $this->_stack->push(LIVEUSER_ADMIN_ERROR, 'exception',
+ array('msg' => 'Select must be "row" or
"all"'));
+ return false;
+ }
+ } else {
+ $param['select'] = 'all';
+ }
+
if ($container == 'perm') {
- return $this->_getUsersByPerm($filter, $first);
+ return $this->_getUsersByPerm($param);
}
- return $this->_getUsersByAuth($filter, $first);
+ return $this->_getUsersByAuth($param);
}
/**
* Finds and gets full userinfo by filtering inside the perm container
*
- * @param array perm filters (as for getUsers() from the perm container
- * @param bool if only one row should be returned
+ * @param array perm params (as for getUsers() from the perm container
* @return array|bool Array with userinfo if found on success or false otherwise
*
* @access private
*/
- function _getUsersByPerm($permFilter = array(), $first = false)
+ function _getUsersByPerm($permParam = array())
{
if (!is_object($this->perm)) {
$this->_stack->push(LIVEUSER_ADMIN_ERROR, 'exception',
@@ -545,9 +553,8 @@
return false;
}
- $permFilter = array('filters' => $permFilter);
- $permFilter['select'] = $first ? 'row' : 'all';
- $permUsers = $this->perm->getUsers($permFilter);
+ $first = ($permParam['select'] == 'row');
+ $permUsers = $this->perm->getUsers($permParam);
if (!$permUsers) {
return $permUsers;
}
@@ -583,13 +590,12 @@
/**
* Finds and gets full userinfo by filtering inside the auth container
*
- * @param array auth filters (as for getUsers() from the auth container
- * @param bool if only one row should be returned
+ * @param array auth params (as for getUsers() from the auth container
* @return array|bool Array with userinfo if found on success or false otherwise
*
* @access private
*/
- function _getUsersByAuth($authFilter = array(), $first = false)
+ function _getUsersByAuth($authParam = array(), $first = false)
{
if (!is_object($this->auth) || !is_object($this->perm)) {
$this->_stack->push(LIVEUSER_ADMIN_ERROR, 'exception',
@@ -597,9 +603,8 @@
return false;
}
- $authFilter = array('filters' => $authFilter);
- $authFilter['select'] = $first ? 'row' : 'all';
- $authUsers = $this->auth->getUsers($authFilter);
+ $first = ($permParam['select'] == 'row');
+ $authUsers = $this->auth->getUsers($authParam);
if (!$authUsers) {
return $authUsers;
}