From dc0054139e3e0a6e996ab04b275a9396a9ba15a4 Mon Sep 17 00:00:00 2001 From: hickert Date: Fri, 28 Aug 2009 07:33:54 +0000 Subject: [PATCH] Updated roleGeneric. -Members required cn attribute, which may not be present in some circumstances. git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@14153 594d385d-05f5-0310-b6e9-bd551577e9d8 --- .../admin/roleManagement/class_roleGeneric.inc | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/gosa-plugins/roleManagement/admin/roleManagement/class_roleGeneric.inc b/gosa-plugins/roleManagement/admin/roleManagement/class_roleGeneric.inc index 8c9d221b8..6f79e43d9 100644 --- a/gosa-plugins/roleManagement/admin/roleManagement/class_roleGeneric.inc +++ b/gosa-plugins/roleManagement/admin/roleManagement/class_roleGeneric.inc @@ -97,7 +97,22 @@ class roleGeneric extends plugin { if(!isset($this->roleOccCache[$dn])){ if($ldap->dn_exists($dn)){ $ldap->cat($dn, $attrs); - $this->roleOccCache[$dn] = $ldap->fetch(); + + $tmp = $ldap->fetch(); + if(!isset($tmp['cn'])){ + + // Extract the namingAttribute out of the dn. + $cn = preg_replace("/^[^=]*+=([^,]*).*$/","\\1",$tmp['dn']); + if(isset($tmp['uid'])){ + $cn = $tmp['uid'][0]; + } + if(isset($tmp['description'])){ + $cn.= " [".$tmp['description'][0]."]"; + } + $tmp['cn'][0] = $cn; + } + + $this->roleOccCache[$dn] = $tmp; } } } -- 2.30.2