From: hickert Date: Tue, 7 Jul 2009 08:15:47 +0000 (+0000) Subject: Updated class user X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=068e9f0010355ba0f0e16498a4cc57691f6d3658;p=gosa.git Updated class user -When a user is removed, remove it from roles too. git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@13897 594d385d-05f5-0310-b6e9-bd551577e9d8 --- diff --git a/gosa-core/plugins/personal/generic/class_user.inc b/gosa-core/plugins/personal/generic/class_user.inc index 95b0960a7..30c50e475 100644 --- a/gosa-core/plugins/personal/generic/class_user.inc +++ b/gosa-core/plugins/personal/generic/class_user.inc @@ -744,6 +744,19 @@ class user extends plugin $og->save (); } + /* Delete references to roles */ + $ldap->cd ($this->config->current['BASE']); + $ldap->search ("(&(objectClass=organizationalRole)(roleOccupant=".LDAP::prepare4filter($this->dn)."))", array("cn")); + while ($ldap->fetch()){ + $role= new roleGeneric($this->config, $ldap->getDN()); + $key = array_search($this->dn,$role->roleOccupant); + if($key !== FALSE){ + unset($role->roleOccupant[$key]); + $role->reload(); + $role->save (); + } + } + /* If needed, let the password method do some cleanup */ $tmp = new passwordMethod($this->config); $available = $tmp->get_available_methods(); @@ -863,6 +876,7 @@ class user extends plugin /* Only force save of changes .... If this attributes aren't changed, avoid saving. */ + if($this->gender=="0") $this->gender =""; if($this->preferredLanguage=="0") $this->preferredLanguage ="";