Code

Added latest patches
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Wed, 24 Feb 2010 11:51:42 +0000 (11:51 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Wed, 24 Feb 2010 11:51:42 +0000 (11:51 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/branches/2.6@15694 594d385d-05f5-0310-b6e9-bd551577e9d8

gosa-core/contrib/openldap/gosa-samba3.schema
gosa-core/include/class_ldap.inc
gosa-core/include/class_plugin.inc
gosa-core/plugins/personal/generic/class_user.inc

index f3fb8097fa9280047de4b1ddccf65f75130ff156..a8b1de34f7527bad9d80373ea59ac5945ef2830a 100644 (file)
@@ -308,7 +308,8 @@ objectclass ( 1.3.6.1.4.1.10098.1.2.1.19.3 NAME 'gosaCacheEntry' SUP top STRUCTU
 
 objectclass ( 1.3.6.1.4.1.10098.1.2.1.19.4 NAME 'gosaDepartment' SUP top AUXILIARY
         DESC 'Class to mark Departments for GOsa (v2.6.1)'
-       MUST  ( ou $ description ))
+       MUST  ( ou $ description )
+       MAY   ( manager ))
 
 objectclass ( 1.3.6.1.4.1.10098.1.2.1.19.5 NAME 'gosaMailAccount' SUP top AUXILIARY
         DESC 'Class to mark MailAccounts for GOsa (v2.6.1)'
index 80cb94f32264260ac5b108947b78c06b9f3661c2..af263e184ce2e20d7da94a5c1b93db695829b8bd 100644 (file)
@@ -1295,7 +1295,11 @@ class LDAP{
                     break;
 
           case ')': if ($name != ""){
-                      $objectclasses[$ocname][$name]= $this->value2container($value);
+                      $v = $this->value2container($value);
+                      if(in_array($name, array('MUST', 'MAY')) && !is_array($v)){
+                        $v = array($v);
+                      }
+                      $objectclasses[$ocname][$name]= $v;
                     }
                     $name= "";
                     $value= "";
@@ -1310,7 +1314,11 @@ class LDAP{
           case 'MUST':
           case 'MAY':
                     if ($name != ""){
-                      $objectclasses[$ocname][$name]= $this->value2container($value);
+                      $v = $this->value2container($value);
+                      if(in_array($name, array('MUST', 'MAY')) && !is_array($v)){
+                        $v = array($v);
+                      }
+                      $objectclasses[$ocname][$name]= $v;
                     }
                     $name= $chunk;
                     $value= "";
index 4e5f5656b7e4e61be4fd64a570695eb043bfc111..e75ced1819d36848820ffb2bf4e2184739b207e7 100644 (file)
@@ -1037,6 +1037,23 @@ class plugin
         $role->save();
       }
     }
+
+    // Update 'manager' attributes from gosaDepartment and inetOrgPerson 
+    $filter = "(&(objectClass=inetOrgPerson)(manager=".LDAP::prepare4filter(LDAP::fix($src_dn))."))";
+    $ocs = $ldap->get_objectclasses();
+    if(isset($ocs['gosaDepartment']['MAY']) && in_array('manager', $ocs['gosaDepartment']['MAY'])){
+      $filter = "(|".$filter."(&(objectClass=gosaDepartment)(manager=".LDAP::prepare4filter(LDAP::fix($src_dn)).")))";
+    }
+    $leaf_deps=  get_list($filter,array("all"),$this->config->current['BASE'], 
+        array("manager","dn","objectClass"),GL_SUBSEARCH | GL_NO_ACL_CHECK);
+    foreach($leaf_deps as $entry){
+      $update = array('manager' => $dst_dn);
+      $ldap->cd($entry['dn']);
+      $ldap->modify($update);
+      if(!$ldap->success()){
+        trigger_error(sprintf("Failed to update manager for '%s', error was '%s'", $entry['dn'], $ldap->get_error()));
+      }
+    }
  
     /* Check if there are gosa departments moved. 
        If there were deps moved, the force reload of config->deps.
index 60cc909dd0d86c2830313a22d7f44c7b639d05b4..b3ac780bf1c89ceefd4c147834b97404db938154 100644 (file)
@@ -307,6 +307,7 @@ class user extends plugin
     // Clear manager attribute if requested
     if(preg_match("/ removeManager/i", " ".implode(array_keys($_POST),' ')." ")){
       $this->manager = "";
+      $this->manager_name = "";
     }
 
     // Allow to select a new inetOrgPersion:manager