cvs: pear /LiveUser_Admin/Perm Complex.php

From: Date: Tue, 14 Dec 2004 18:03:54 +0000
Subject: cvs: pear /LiveUser_Admin/Perm Complex.php
Groups: php.pear.cvs 
Request: Send a blank email to pear-cvs+get-27384@lists.php.net to get a copy of this message
dufuz Tue Dec 14 13:03:54 2004 EDT Modified files: /pear/LiveUser_Admin/Perm Complex.php Log: un/assignSubGroups added, untested. http://cvs.php.net/diff.php/pear/LiveUser_Admin/Perm/Complex.php?r1=1.11&r2=1.12&ty=u Index: pear/LiveUser_Admin/Perm/Complex.php diff -u pear/LiveUser_Admin/Perm/Complex.php:1.11 pear/LiveUser_Admin/Perm/Complex.php:1.12 --- pear/LiveUser_Admin/Perm/Complex.php:1.11 Tue Dec 14 12:50:11 2004 +++ pear/LiveUser_Admin/Perm/Complex.php Tue Dec 14 13:03:54 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.11 2004/12/14 17:50:11 dufuz Exp $ + * @version $Id: Complex.php,v 1.12 2004/12/14 18:03:54 dufuz Exp $ * @package LiveUser */ class LiveUser_Admin_Perm_Complex extends LiveUser_Admin_Perm_Medium @@ -69,14 +69,69 @@ parent::removeArea($filters); } - function assignSubGroup($data, $filters) + function assignSubGroup($data) { + if (!isset($data['group_id']) || !is_numeric($data['group_id'])) { + $this->_stack->push( + LIVEUSER_ADMIN_ERROR_FILTER, 'exception', + array('key' => 'group_id') + ); + return false; + } + + if (!isset($data['subgroup_id']) || !is_numeric($data['subgroup_id'])) { + $this->_stack->push( + LIVEUSER_ADMIN_ERROR_FILTER, 'exception', + array('key' => 'subgroup_id') + ); + return false; + } + + if ($data['subgroup_id'] == $data['group_id']) { + $this->_stack->push( + LIVEUSER_ADMIN_ERROR, 'exception', + array('msg' => 'Parent group id is the same as the subgroup id') + ); + return false; + } + + $filter = array('subgroup_id' => $filters['subgroup_id']); + $result = $this->_storage->selectOne('group_subgroups', 'group_id', $filter); + if (!$result) { + return $result; + } + + if (!empty($result)) { + $this->_stack->push( + LIVEUSER_ADMIN_ERROR, 'exception', + array('msg' => 'Child group already has a parent group') + ); + return false; + } + if ($result['group_id'] == $data['group_id']) { + $this->_stack->push( + LIVEUSER_ADMIN_ERROR, 'exception', + array('msg' => 'This child group is already a Parent of this group') + ); + return false; + } + + $result = $this->_storage->insert('group_subgroups', $data); + return $reslult; } function unassignSubGroup($filters) { + if (!isset($filters['subgroup_id']) || !is_numeric($filters['subgroup_id'])) { + $this->_stack->push( + LIVEUSER_ADMIN_ERROR_FILTER, 'exception', + array('key' => 'subgroup_id') + ); + return false; + } + $result = $this->_storage->delete('group_subgroup', $filters); } function removeGroup($filters) @@ -99,7 +154,7 @@ if ($filters['recursive']) { $filter = array('group_id' => $filters['subgroup_id']); - $result = $this->_storage->selectCol('group_subgroup', 'group_id', $filter); + $result = $this->_storage->selectCol('group_subgroups', 'group_id', $filter); if (!$result) { return $result; } @@ -235,6 +290,7 @@ function grantUserRight($data) { parent::grantUserRight($data); + // FIXME $this->_updateLevelStatus($data['right_id']); // Job done ... @@ -244,6 +300,7 @@ function grantGroupRight($data) { parent::grantGroupRight($data); + // FIXME $this->_updateLevelStatus($data['right_id']); // Job done ...

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