From 31f1999a7abdd18cb71d38d9d3d318727cabc3b6 Mon Sep 17 00:00:00 2001 From: hickert Date: Thu, 1 Sep 2005 06:14:13 +0000 Subject: [PATCH] Added check: If tree was moved into itself it was deleted git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@1277 594d385d-05f5-0310-b6e9-bd551577e9d8 --- plugins/admin/departments/tabs_department.inc | 10 +++++++++- plugins/admin/users/tabs_user.inc | 2 +- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/plugins/admin/departments/tabs_department.inc b/plugins/admin/departments/tabs_department.inc index de5e877d1..25cb791eb 100644 --- a/plugins/admin/departments/tabs_department.inc +++ b/plugins/admin/departments/tabs_department.inc @@ -22,7 +22,15 @@ class deptabs extends tabs $new_dn= 'ou='.$baseobject->ou.','.$baseobject->base; if ($this->dn != $new_dn && $this->dn != "new"){ - $baseobject->recursive_move($this->dn, $new_dn); + + /* if( new_dn is subtree of this->dn ) */ + $cnt1 = count(split(",",$this->dn)); + $cnt2 = count(split(",",$new_dn)); + if((strstr($new_dn,$this->dn))&&($cnt1<$cnt2)){ + print_red(_("Try to move tree failed. Destination tree is subtree of source tree.")); + }else{ + $baseobject->recursive_move($this->dn, $new_dn); + } } $this->dn= $new_dn; diff --git a/plugins/admin/users/tabs_user.inc b/plugins/admin/users/tabs_user.inc index 321537ace..899e12d18 100644 --- a/plugins/admin/users/tabs_user.inc +++ b/plugins/admin/users/tabs_user.inc @@ -90,7 +90,7 @@ class usertabs extends tabs * If you changed one of the "Name" / "Givenname" attributes to lower or upper case, like "test" to "Test", (in DNMODE=cn) * the old_dn and new dn were different. cn=test ... cn=Test ... * The following code decided to move the entry from old_dn to new_dn. (Because they differ) - * But the ldap functions are not case sensitive and so the function plugin::move() quits with + * But the ldap attribute cn is not case sensitive and the function plugin::move() quits with * an error, because source and destination dn are both the same (for ldap, but not for php). * This fix allow you to change the givenname or name attributes. */ -- 2.30.2