From: hickert Date: Wed, 16 May 2007 09:47:38 +0000 (+0000) Subject: Added logging X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=2eadfd8a6b013002c7edc74d85d736ffa690b5ce;p=gosa.git Added logging git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@6392 594d385d-05f5-0310-b6e9-bd551577e9d8 --- diff --git a/plugins/admin/departments/class_departmentGeneric.inc b/plugins/admin/departments/class_departmentGeneric.inc index da4c101b7..9f96a555a 100644 --- a/plugins/admin/departments/class_departmentGeneric.inc +++ b/plugins/admin/departments/class_departmentGeneric.inc @@ -90,6 +90,10 @@ class department extends plugin $this->is_administrational_unit= true; $this->initially_was_tagged = true; } + + if($this->is_account && $dn != "new"){ + @log::log("view","department/".get_class($this),$this->dn); + } } function execute() @@ -187,6 +191,7 @@ class department extends plugin $ldap= $this->config->get_ldap_link(); $ldap->cd ($this->dn); $ldap->recursive_remove(); + @log::log("remove","department/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error()); show_ldap_error($ldap->get_error(), sprintf(_("Removing of department with dn '%s' failed."),$this->dn)); /* Optionally execute a command after we're done */ @@ -356,14 +361,17 @@ class department extends plugin $a= $ldap->fetch(); $ldap->cd($this->dn); + print_a(debug_backtrace()); + if (count($a)){ $this->cleanup(); $ldap->modify ($this->attrs); - + @log::log("modify","department/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error()); $this->handle_post_events('modify'); } else { $ldap->add($this->attrs); $this->handle_post_events('add'); + @log::log("create","department/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error()); } show_ldap_error($ldap->get_error(), sprintf(_("Saving of department with dn '%s' failed."),$this->dn)); diff --git a/plugins/admin/departments/class_departmentManagement.inc b/plugins/admin/departments/class_departmentManagement.inc index 3524b15f4..a6e2fd902 100644 --- a/plugins/admin/departments/class_departmentManagement.inc +++ b/plugins/admin/departments/class_departmentManagement.inc @@ -238,6 +238,7 @@ class departmentManagement extends plugin } else { add_lock ($this->dn, $this->ui->dn); $smarty->assign("info", sprintf(_("You're about to delete the whole LDAP subtree placed under '%s'."), @LDAP::fix($this->dn))); + $smarty->assign("multiple", false); $display.= $smarty->fetch (get_template_path('remove.tpl', TRUE)); return ($display); } diff --git a/plugins/admin/groups/class_groupApplication.inc b/plugins/admin/groups/class_groupApplication.inc index e883208da..b66f40e85 100644 --- a/plugins/admin/groups/class_groupApplication.inc +++ b/plugins/admin/groups/class_groupApplication.inc @@ -156,6 +156,10 @@ class appgroup extends plugin $this->InitialFAIrelease = $this->FAIrelease; $this->Releases = $this->getReleases(); } + + if($this->is_account){ + @log::log("view","groups/".get_class($this),$this->dn); + } } @@ -912,7 +916,7 @@ class appgroup extends plugin $this->cleanup(); $ldap->modify ($this->attrs); - + @log::log("remove","group/".get_class($this),$use_dn,array_keys($this->attrs),$ldap->get_error()); show_ldap_error($ldap->get_error(), sprintf(_("Removing of groups/applications with dn '%s' failed."),$this->dn)); /* Optionally execute a command after we're done */ @@ -966,6 +970,12 @@ class appgroup extends plugin $this->cleanup(); $ldap->modify ($this->attrs); + if($this->initially_was_account){ + @log::log("modify","group/".get_class($this),$use_dn,array_keys($this->attrs),$ldap->get_error()); + }else{ + @log::log("create","group/".get_class($this),$use_dn,array_keys($this->attrs),$ldap->get_error()); + } + show_ldap_error($ldap->get_error(), sprintf(_("Saving of groups/applications with dn '%s' failed."),$this->dn)); /* Optionally execute a command after we're done */ diff --git a/plugins/admin/groups/class_groupGeneric.inc b/plugins/admin/groups/class_groupGeneric.inc index 1d2bc1b75..aa5ed9884 100644 --- a/plugins/admin/groups/class_groupGeneric.inc +++ b/plugins/admin/groups/class_groupGeneric.inc @@ -171,6 +171,10 @@ class group extends plugin $this->base =preg_replace ("/^[^,]+,".normalizePreg(get_groups_ou())."/","",$this->dn); } + if($this->dn != "new"){ + @log::log("view","groups/".get_class($this),$this->dn); + } + /* This is always an account */ $this->is_account= TRUE; $this->reload(); @@ -514,6 +518,8 @@ class group extends plugin $ldap->rmdir($this->dn); show_ldap_error($ldap->get_error(), sprintf(_("Removing of groups/generic with dn '%s' failed."),$this->dn)); + @log::log("remove","groups/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error()); + /* Delete references to object groups */ $ldap->cd ($this->config->current['BASE']); $ldap->search ("(&(objectClass=gosaGroupOfNames)(member=".$this->dn."))", array("cn")); @@ -738,6 +744,12 @@ class group extends plugin $this->cleanup(); $ldap->$mode($this->attrs); + if($this->initially_was_account){ + @log::log("modify","groups/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error()); + }else{ + @log::log("create","groups/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error()); + } + $ret= 0; if ( show_ldap_error($ldap->get_error(), sprintf(_("Removing of groups/generic with dn '%s' failed."),$this->dn))){ $ret= 1; diff --git a/plugins/admin/groups/class_groupMail.inc b/plugins/admin/groups/class_groupMail.inc index a3c43e5d5..3c9b0feff 100644 --- a/plugins/admin/groups/class_groupMail.inc +++ b/plugins/admin/groups/class_groupMail.inc @@ -292,6 +292,10 @@ class mailgroup extends plugin $this->perms["lrswipcd"]= _("write"); $this->perms["lrswipcda"]= _("admin"); $this->perms[""]= _("none"); + + if($this->is_account){ + @log::log("view","groups/".get_class($this),$this->dn); + } } function execute() @@ -643,6 +647,10 @@ class mailgroup extends plugin /* remove object from parent */ function remove_from_parent() { + if(!$this->initially_was_account){ + return; + } + /* Added these ObjectClass and Attributes, because they were not removed correctly, only in case of kolab ... */ @@ -680,6 +688,9 @@ class mailgroup extends plugin $ldap->modify ($this->attrs); show_ldap_error($ldap->get_error(), sprintf(_("Removing of groups/mail with dn '%s' failed."),$this->dn)); + + @log::log("remove","groups/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error()); + /* Optionally execute a command after we're done */ $this->handle_post_events("remove"); } @@ -875,6 +886,13 @@ I: Only insider delivery */ $this->cleanup(); $ldap->modify ($this->attrs); show_ldap_error($ldap->get_error(), sprintf(_("Saving of groups/mail with dn '%s' failed."),$this->dn)); + + if($this->initially_was_account){ + @log::log("modify","groups/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error()); + }else{ + @log::log("create","groups/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error()); + } + /* Optionally execute a command after we're done */ if ($this->initially_was_account == $this->is_account){ diff --git a/plugins/personal/environment/class_environment.inc b/plugins/personal/environment/class_environment.inc index f8ad1f0b1..7c18c08ef 100644 --- a/plugins/personal/environment/class_environment.inc +++ b/plugins/personal/environment/class_environment.inc @@ -81,11 +81,6 @@ class environment extends plugin { plugin::plugin ($config, $dn); - if($this->is_account){ - @log::log("view","users/environment",$this->dn); - } - - /* Setting uid to default */ if(isset($this->attrs['uid'][0])){ $this->uid = $this->attrs['uid'][0]; @@ -240,6 +235,14 @@ class environment extends plugin $this->gotoShareSelections= $config->getShareList(true); $this->gotoAvailableShares= $config->getShareList(false); + if($this->is_account){ + + if(in_array("gosaAccount",$this->attrs['objectClass'])){ + @log::log("view","users/".get_class($this),$this->dn); + }else{ + @log::log("view","groups/".get_class($this),$this->dn); + } + } } @@ -938,7 +941,12 @@ class environment extends plugin $this->cleanup(); $ldap->modify ($this->attrs); - @log::log("remove","users/environment",$this->dn,array_keys($this->attrs),$ldap->get_error()); + if($this->is_group){ + @log::log("remove","groups/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error()); + }else{ + @log::log("remove","users/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error()); + } + show_ldap_error($ldap->get_error(), sprintf(_("Removing of user/environment account with dn '%s' failed."),$this->dn)); /* Optionally execute a command after we're done */ @@ -1193,11 +1201,16 @@ class environment extends plugin $this->cleanup(); $ldap->$mode($this->attrs); + $cat = "users"; + if($this->is_group){ + $cat = "groups"; + } + /* Log last action */ if($this->initially_was_account){ - @log::log("modify","users/environment",$this->dn,array_keys($this->attrs),$ldap->get_error()); + @log::log("modify",$cat."/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error()); }else{ - @log::log("create","users/environment",$this->dn,array_keys($this->attrs),$ldap->get_error()); + @log::log("create",$cat."/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error()); } show_ldap_error($ldap->get_error(), sprintf(_("Saving of user/environment account with dn '%s' failed."),$this->dn));