Code

Added check: If tree was moved into itself it was deleted
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Thu, 1 Sep 2005 06:14:13 +0000 (06:14 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Thu, 1 Sep 2005 06:14:13 +0000 (06:14 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@1277 594d385d-05f5-0310-b6e9-bd551577e9d8

plugins/admin/departments/tabs_department.inc
plugins/admin/users/tabs_user.inc

index de5e877d1703d1793cc030851b0d7d8a62053004..25cb791ebcb05dc544eeb42e6bd21315a573fa98 100644 (file)
@@ -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;
 
index 321537acebf160145032f1d928377d69e3cd9831..899e12d18a1acb7f42e7e44bb7fb36e4578a2ada 100644 (file)
@@ -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.
        */