From def4948e59fe4f4eaf50b98a4aaeb3b53b11b035 Mon Sep 17 00:00:00 2001 From: hickert Date: Tue, 8 May 2007 09:30:00 +0000 Subject: [PATCH] Updated admin detection. git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@6294 594d385d-05f5-0310-b6e9-bd551577e9d8 --- setup/class_setupStep_Migrate.inc | 46 ++++++++++++++++++++++++------- 1 file changed, 36 insertions(+), 10 deletions(-) diff --git a/setup/class_setupStep_Migrate.inc b/setup/class_setupStep_Migrate.inc index 0c936fa79..c2379c230 100644 --- a/setup/class_setupStep_Migrate.inc +++ b/setup/class_setupStep_Migrate.inc @@ -750,21 +750,47 @@ class Step_Migrate extends setup_step /* Search for gosaAcls */ $ldap->cd($cv['base']); - $res = $ldap->search("(&(objectClass=gosaAccount)(|(objectClass=posixAccount)". - "(objectClass=inetOrgPerson)(objectClass=organizationalPerson)))"); + $res = $ldap->cat($cv['base']); + if(!$res){ $this->checks['acls']['STATUS'] = FALSE; $this->checks['acls']['STATUS_MSG']= _("LDAP query failed"); $this->checks['acls']['ERROR_MSG'] = _("Possibly the 'root object' is missing."); - }elseif($ldap->count()){ - $this->checks['acls']['STATUS'] = TRUE; - $this->checks['acls']['STATUS_MSG']= _("Ok"); - $this->checks['acls']['ERROR_MSG'] = ""; }else{ - $this->checks['acls']['STATUS'] = FALSE; - $this->checks['acls']['STATUS_MSG']= _("Failed"); - $this->checks['acls']['ERROR_MSG']= _("There is no GOsa administrator account inside your LDAP.")." "; - $this->checks['acls']['ERROR_MSG'].= ""; + $found = false; + $attrs = $ldap->fetch(); + if(isset($attrs['gosaAclEntry'])){ + $acls = $attrs['gosaAclEntry']; + for($i = 0 ; $i < $acls['count'] ; $i++){ + $acl = $acls[$i]; + $tmp = split(":",$acl); + + /* Only check permanent acls */ + if($tmp[1] == "psub"){ + + /* Check if acl owner is a valid GOsa user account */ + $ldap->cat(base64_decode($tmp[2]),array("objectClass")); + $ret = $ldap->fetch(); + + if(in_array("gosaAccount",$ret['objectClass']) && + in_array("organizationalPerson",$ret['objectClass']) && + in_array("inetOrgPerson",$ret['objectClass'])){ + $found = TRUE; + } + } + } + } + + if($found){ + $this->checks['acls']['STATUS'] = TRUE; + $this->checks['acls']['STATUS_MSG']= _("Ok"); + $this->checks['acls']['ERROR_MSG'] = ""; + }else{ + $this->checks['acls']['STATUS'] = FALSE; + $this->checks['acls']['STATUS_MSG']= _("Failed"); + $this->checks['acls']['ERROR_MSG']= _("There is no GOsa administrator account inside your LDAP.")." "; + $this->checks['acls']['ERROR_MSG'].= ""; + } } return($ldap->count()>=1); } -- 2.30.2