From c3c34615d2b1780db5f6d5f0f6d7ec7d93454180 Mon Sep 17 00:00:00 2001 From: hickert Date: Wed, 16 May 2007 10:22:20 +0000 Subject: [PATCH] Added logging to ogroup git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@6395 594d385d-05f5-0310-b6e9-bd551577e9d8 --- plugins/admin/ogroups/class_mailogroup.inc | 12 ++++++++++++ plugins/admin/ogroups/class_ogroup.inc | 13 +++++++++++++ plugins/admin/ogroups/class_phonequeue.inc | 11 +++++++++++ plugins/admin/ogroups/class_termgroup.inc | 11 ++++++++++- 4 files changed, 46 insertions(+), 1 deletion(-) diff --git a/plugins/admin/ogroups/class_mailogroup.inc b/plugins/admin/ogroups/class_mailogroup.inc index 769b913cf..7ffe77da6 100644 --- a/plugins/admin/ogroups/class_mailogroup.inc +++ b/plugins/admin/ogroups/class_mailogroup.inc @@ -21,6 +21,10 @@ class mailogroup extends plugin /* Save initial account state */ $this->initially_was_account= $this->is_account; + + if($this->is_account){ + @log::log("view","ogroups/".get_class($this),$this->dn); + } } @@ -103,6 +107,12 @@ class mailogroup extends plugin $this->cleanup(); $ldap->modify ($this->attrs); + if($this->initially_was_account){ + @log::log("modify","ogroups/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error()); + }else{ + @log::log("create","ogroups/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error()); + } + show_ldap_error($ldap->get_error(), sprintf(_("Saving of object group/mail with dn '%s' failed."),$this->dn)); /* Optionally execute a command after we're done */ @@ -136,6 +146,8 @@ class mailogroup extends plugin $this->cleanup(); $ldap->modify ($this->attrs); + @log::log("remove","ogroups/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error()); + show_ldap_error($ldap->get_error(), sprintf(_("Removing of object group/mail with dn '%s' failed."),$this->dn)); } diff --git a/plugins/admin/ogroups/class_ogroup.inc b/plugins/admin/ogroups/class_ogroup.inc index 09219dfe1..9a17773cf 100644 --- a/plugins/admin/ogroups/class_ogroup.inc +++ b/plugins/admin/ogroups/class_ogroup.inc @@ -94,6 +94,10 @@ class ogroup extends plugin $this->base= preg_replace("/^[^,]+,".get_groups_ou()."/","",$this->dn); } + if($this->is_account){ + @log::log("view","ogroup/".get_class($this),$this->dn); + } + /* Load member data */ $this->reload(); } @@ -636,6 +640,7 @@ class ogroup extends plugin $this->attrs['member']= array(); } $mode= "modify"; + } else { $mode= "add"; $ldap->cd($this->config->current['BASE']); @@ -647,6 +652,12 @@ class ogroup extends plugin $this->cleanup(); $ldap->$mode($this->attrs); + if($mode == "add"){ + @log::log("create","ogroups/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error()); + }else{ + @log::log("modify","ogroups/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error()); + } + /* Trigger post signal */ $this->handle_post_events($mode); @@ -666,6 +677,8 @@ class ogroup extends plugin $ldap->rmdir($this->dn); show_ldap_error($ldap->get_error(), sprintf(_("Removing of object group/generic with dn '%s' failed."),$this->dn)); + @log::log("remove","ogroups/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error()); + /* Trigger remove signal */ $this->handle_post_events("remove"); } diff --git a/plugins/admin/ogroups/class_phonequeue.inc b/plugins/admin/ogroups/class_phonequeue.inc index 6355f05b7..c47bd3ce3 100644 --- a/plugins/admin/ogroups/class_phonequeue.inc +++ b/plugins/admin/ogroups/class_phonequeue.inc @@ -135,6 +135,10 @@ class phonequeue extends plugin $this->goFonQueueStrategy= $tmp[$this->goFonQueueStrategy]; $this->old_cn = $this->cn; $this->old_phone_numbers = $this->telephoneNumber; + + if($this->is_account){ + @log::log("view","ogroups/".get_class($this),$this->dn); + } } @@ -827,6 +831,12 @@ class phonequeue extends plugin $this->cleanup(); $ldap->modify ($this->attrs); + if($this->initially_was_account){ + @log::log("modify","ogroups/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error()); + }else{ + @log::log("modify","ogroups/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error()); + } + show_ldap_error($ldap->get_error(), _("Saving phone queue failed")); /* Optionally execute a command after we're done */ @@ -879,6 +889,7 @@ class phonequeue extends plugin $ldap->cd($this->dn); $this->cleanup(); $ldap->modify ($this->attrs); + @log::log("remove","ogroups/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error()); show_ldap_error($ldap->get_error(), _("Removing phone queue failed")); } diff --git a/plugins/admin/ogroups/class_termgroup.inc b/plugins/admin/ogroups/class_termgroup.inc index 3d9a69b56..ece1d495c 100644 --- a/plugins/admin/ogroups/class_termgroup.inc +++ b/plugins/admin/ogroups/class_termgroup.inc @@ -96,7 +96,9 @@ class termgroup extends plugin } } - + if($this->is_account){ + @log::log("view","ogroups/".get_class($this),$this->dn); + } } function check() @@ -129,6 +131,7 @@ class termgroup extends plugin $ldap->cd($this->orig_dn); $ldap->modify($this->attrs); $this->handle_post_events("remove"); + @log::log("remove","ogroups/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error()); } @@ -369,6 +372,12 @@ class termgroup extends plugin $this->cleanup(); $ldap->modify ($this->attrs); + if($this->initially_was_account){ + @log::log("modify","ogroups/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error()); + }else{ + @log::log("create","ogroups/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error()); + } + if(!$this->didAction){ $this->handle_post_events("modify"); } -- 2.30.2