summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 6eb8458)
raw | patch | inline | side by side (parent: 6eb8458)
author | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Fri, 19 May 2006 05:53:40 +0000 (05:53 +0000) | ||
committer | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Fri, 19 May 2006 05:53:40 +0000 (05:53 +0000) |
k=kolab was removed if a server was edited, which wasn't member of kolabHosts
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@3439 594d385d-05f5-0310-b6e9-bd551577e9d8
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@3439 594d385d-05f5-0310-b6e9-bd551577e9d8
plugins/admin/systems/class_servKolab.inc | patch | blob | history |
index c124abfaa44f9cf5c14cccb43242569068540f5c..78e3ab87759513b375084aa5c71d2220c61fcb35 100644 (file)
function servkolab($config, $dn = NULL)
{
/* Setting the hostname and tell this Plugin that we are the kolab extension*/
- $this->hostname= preg_replace('/^cn=([^,]+),.*$/', '\1', $dn);
- $this->dn = "k=kolab,".$config->current['BASE'];
+ $this->hostname = preg_replace('/^cn=([^,]+),.*$/', '\1', $dn);
+ $this->dn = "k=kolab,".$config->current['BASE'];
/* Load variables, if given*/
plugin::plugin($config, $this->dn);
}
/* Toggle relayhost */
- $this->postfix_mxrelayenabled= preg_match('/^\[/', $this->postfix_relayhost);
- $this->postfix_relayhost = preg_replace("/[\[\]]/","",$this->postfix_relayhost);
+ $this->postfix_mxrelayenabled = preg_match('/^\[/', $this->postfix_relayhost);
+ $this->postfix_relayhost = preg_replace("/[\[\]]/","",$this->postfix_relayhost);
/* Is this Server a member of the Kolab extension or not ?*/
if(isset($this->attrs['kolabHost'])) {
$this->kolabHost= $this->attrs['kolabHost'];
unset($this->kolabHost['count']);
}
-
- $this->is_in_there=false;
- $this->is_account=false;
+ $this->is_in_there = false;
+ $this->is_account = false;
+ $this->initially_was_account = false;
foreach($this->kolabHost as $host){
if(preg_match("/".$this->hostname.".*/i",$host)){
- $this->is_account=true;
- $this->is_in_there=true;
+ $this->is_account = true;
+ $this->is_in_there = true;
+ $this->initially_was_account = true;
}
}
function remove_from_parent()
{
- $ldap= $this->config->get_ldap_link();
+ /* Only walk through following code, if this host
+ was a member of the kolab hosts, else skip this */
+ if(!$this->initially_was_account){
+ return;
+ }
+
+ $ldap = $this->config->get_ldap_link();
$this->dn = "k=kolab,".$this->config->current['BASE'];
- if (count($this->kolabHost) == 0){
+
+ /* We can't simply remove the whole entry, it is possible that there are
+ some other hosts assigned to this object.
+ So, first of all check if we are the last host entry within the host
+ : Remove k=kolab entry
+ if we aren't alone, only remove host name from hosts entry and save */
+ /* Are we alone? Remove complete entry... */
+
+ /* Check if we are definitly in kolabHosts */
+ if(!in_array_ics($this->cn,$this->kolabHost)) {
return;
}
- /* Are we alone? Remove complete entry... */
- if (count($this->kolabHost) == 1){
+ /* Integration check, not translatet because they can't pop up at all, only for debug */
+ if(count($this->kolabHost) == 0){
+ print_red("Server - Kolab tab : This is not possible, we can't remove an account which doesn't exists.");
+ return;
+ }
+ if(!isset($this->cn) || (empty($this->cn))){
+ print_red("The required attribute cn seams to empty.");
+ }
+ /* Our hostname is in kolabHosts and there is a only one entry
+ = we are the last host entry, delete k=kolab entry */
+ if (count($this->kolabHost) == 1){
+
/* Remove complete entry */
$ldap->rmdir ($this->dn);
show_ldap_error($ldap->get_error(), _("Removing kolab host entry failed"));
-
+ gosa_log("k=kolab entry removed, ".$this->cn." was the last kolabHost entry.");
+
} else {
/* Only modify kolabHost */
$hosts= array();
foreach ($this->kolabHost as $host){
-
- if (isset($this->cn)&&($host != $this->cn)){
+ if($host != $this->cn){
$hosts[]= $host;
}
}
$ldap->cd($this->dn);
$this->cleanup();
$ldap->modify ($attrs);
-
show_ldap_error($ldap->get_error(), _("Removing server from kolab object failed"));
+ gosa_log("Removing ".$this->cn." from list of kolabHosts");
}
/* Optionally execute a command after we're done */