- pass the user how removes a group or user to remove()

This commit is contained in:
steinm 2010-12-22 19:47:08 +00:00
parent 17dae3a432
commit 985a1f3915
4 changed files with 13 additions and 10 deletions

View File

@ -161,14 +161,16 @@ class LetoDMS_Group {
} /* }}} */ } /* }}} */
/** /**
* Entfernt die Gruppe aus dem System. * Delete user group
* Dies ist jedoch nicht mit einem Löschen des entsprechenden Eintrags aus tblGroups geschehen - vielmehr * This function deletes the user group and all it references, like access
* muss dafür gesorgt werden, dass die Gruppe nirgendwo mehr auftaucht. D.h. auch die Tabellen tblACLs, * control lists, notifications, as a child of other groups, etc.
* tblNotify und tblGroupMembers müssen berücksichtigt werden. *
* @param object $user the user doing the removal (needed for entry in
* review log.
* @return boolean true on success or false in case of an error
*/ */
function remove() { /* {{{ */ function remove($user) { /* {{{ */
$db = $this->_dms->getDB(); $db = $this->_dms->getDB();
$user = $this->_dms->user;
$queryStr = "DELETE FROM tblGroups WHERE id = " . $this->_id; $queryStr = "DELETE FROM tblGroups WHERE id = " . $this->_id;
if (!$db->getResult($queryStr)) if (!$db->getResult($queryStr))

View File

@ -284,13 +284,14 @@ class LetoDMS_User {
* Do not remove folders and documents of the user, but assign them * Do not remove folders and documents of the user, but assign them
* to a different user. * to a different user.
* *
* @param object $user the user doing the removal (needed for entry in
* review log.
* @param object $assignToUser the user who is new owner of folders and * @param object $assignToUser the user who is new owner of folders and
* documents which previously were owned by the delete user. * documents which previously were owned by the delete user.
* @return boolean true on success or false in case of an error * @return boolean true on success or false in case of an error
*/ */
function remove( $assignToUser=null ) { /* {{{ */ function remove($user, $assignToUser=null) { /* {{{ */
$db = $this->_dms->getDB(); $db = $this->_dms->getDB();
$user = $this->_dms->user;
/* Records like folders and documents that formely have belonged to /* Records like folders and documents that formely have belonged to
* the user will assign to another user. If no such user is set, * the user will assign to another user. If no such user is set,

View File

@ -67,7 +67,7 @@ else if ($action == "removegroup") {
UI::exitError(getMLText("admin_tools"),getMLText("invalid_group_id")); UI::exitError(getMLText("admin_tools"),getMLText("invalid_group_id"));
} }
if (!$group->remove()) { if (!$group->remove($user)) {
UI::exitError(getMLText("admin_tools"),getMLText("error_occured")); UI::exitError(getMLText("admin_tools"),getMLText("error_occured"));
} }

View File

@ -123,7 +123,7 @@ else if ($action == "removeuser") {
} }
$userToAssign = $dms->getUser($_POST["assignTo"]); $userToAssign = $dms->getUser($_POST["assignTo"]);
if (!$userToRemove->remove($userToAssign)) { if (!$userToRemove->remove($user, $userToAssign)) {
UI::exitError(getMLText("admin_tools"),getMLText("error_occured")); UI::exitError(getMLText("admin_tools"),getMLText("error_occured"));
} }