From 2df02179f6c0b7d33606b4e919ecf0e06fa97f17 Mon Sep 17 00:00:00 2001 From: hickert Date: Wed, 24 Feb 2010 11:51:42 +0000 Subject: [PATCH] Added latest patches 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 | 3 ++- gosa-core/include/class_ldap.inc | 12 ++++++++++-- gosa-core/include/class_plugin.inc | 17 +++++++++++++++++ .../plugins/personal/generic/class_user.inc | 1 + 4 files changed, 30 insertions(+), 3 deletions(-) diff --git a/gosa-core/contrib/openldap/gosa-samba3.schema b/gosa-core/contrib/openldap/gosa-samba3.schema index f3fb8097f..a8b1de34f 100644 --- a/gosa-core/contrib/openldap/gosa-samba3.schema +++ b/gosa-core/contrib/openldap/gosa-samba3.schema @@ -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)' diff --git a/gosa-core/include/class_ldap.inc b/gosa-core/include/class_ldap.inc index 80cb94f32..af263e184 100644 --- a/gosa-core/include/class_ldap.inc +++ b/gosa-core/include/class_ldap.inc @@ -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= ""; diff --git a/gosa-core/include/class_plugin.inc b/gosa-core/include/class_plugin.inc index 4e5f5656b..e75ced181 100644 --- a/gosa-core/include/class_plugin.inc +++ b/gosa-core/include/class_plugin.inc @@ -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. diff --git a/gosa-core/plugins/personal/generic/class_user.inc b/gosa-core/plugins/personal/generic/class_user.inc index 60cc909dd..b3ac780bf 100644 --- a/gosa-core/plugins/personal/generic/class_user.inc +++ b/gosa-core/plugins/personal/generic/class_user.inc @@ -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 -- 2.30.2