cvs: pear /LiveUser_Admin/Perm Complex.php
| From: | Helgi �ormar �orbj�rnsson | Date: | Tue, 14 Dec 2004 17:50:15 +0000 |
| Subject: | cvs: pear /LiveUser_Admin/Perm Complex.php | ||
| Groups: | php.pear.cvs | ||
| Request: | Send a blank email to pear-cvs+get-27383@lists.php.net to get a copy of this message | ||
dufuz Tue Dec 14 12:50:15 2004 EDT
Modified files:
/pear/LiveUser_Admin/Perm Complex.php
Log:
Should be a fairly complete implant of removeGroup
http://cvs.php.net/diff.php/pear/LiveUser_Admin/Perm/Complex.php?r1=1.10&r2=1.11&ty=u
Index: pear/LiveUser_Admin/Perm/Complex.php
diff -u pear/LiveUser_Admin/Perm/Complex.php:1.10 pear/LiveUser_Admin/Perm/Complex.php:1.11
--- pear/LiveUser_Admin/Perm/Complex.php:1.10 Tue Dec 14 12:21:48 2004
+++ pear/LiveUser_Admin/Perm/Complex.php Tue Dec 14 12:50:11 2004
@@ -36,7 +36,7 @@
* @author Christian Dickmann <dickmann@php.net>
* @author Markus Wolff <wolff@21st.de>
* @author Matt Scifo <mscifo@php.net>
- * @version $Id: Complex.php,v 1.10 2004/12/14 17:21:48 dufuz Exp $
+ * @version $Id: Complex.php,v 1.11 2004/12/14 17:50:11 dufuz Exp $
* @package LiveUser
*/
class LiveUser_Admin_Perm_Complex extends LiveUser_Admin_Perm_Medium
@@ -81,6 +81,39 @@
function removeGroup($filters)
{
+ if (!isset($filters['group_id']) || !is_numeric($filters['group_id']))
{
+ $this->_stack->push(
+ LIVEUSER_ADMIN_ERROR_FILTER, 'exception',
+ array('key' => 'group_id')
+ );
+ return false;
+ }
+
+ if (!isset($filters['subgroup_id']) ||
!is_numeric($filters['subgroup_id'])) {
+ $this->_stack->push(
+ LIVEUSER_ADMIN_ERROR_FILTER, 'exception',
+ array('key' => 'subgroup_id')
+ );
+ return false;
+ }
+
+ if ($filters['recursive']) {
+ $filter = array('group_id' => $filters['subgroup_id']);
+ $result = $this->_storage->selectCol('group_subgroup',
'group_id', $filter);
+ if (!$result) {
+ return $result;
+ }
+
+ foreach ($result as $subGroupId) {
+ $filter = array('group_id' => $subGroupId, 'recursive'
=> true);
+ $res = $this->removeGroup($filter);
+ if (!$res) {
+ return $res;
+ }
+ }
+ }
+
+ $this->_storage->delete('group_subgroups', $filters);
parent::removeGroup($filters);
}