From cea4dca578884eebcc5e957a03d2928ab3b21bd9 Mon Sep 17 00:00:00 2001 From: hickert Date: Mon, 14 May 2007 08:16:46 +0000 Subject: [PATCH] Added logging to complete git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@6364 594d385d-05f5-0310-b6e9-bd551577e9d8 --- .../connectivity/class_intranetAccount.inc | 25 ++++++++++++++++--- .../connectivity/class_kolabAccount.inc | 15 +++++++++++ .../connectivity/class_opengwAccount.inc | 10 ++++++++ .../connectivity/class_oxchangeAccount.inc | 15 +++++++++++ .../connectivity/class_phpgwAccount.inc | 13 ++++++++++ .../class_phpscheduleitAccount.inc | 13 ++++++++++ .../connectivity/class_pptpAccount.inc | 15 +++++++++++ .../connectivity/class_proxyAccount.inc | 14 +++++++++++ .../connectivity/class_pureftpdAccount.inc | 14 +++++++++++ .../connectivity/class_webdavAccount.inc | 14 +++++++++++ .../environment/class_environment.inc | 3 ++- plugins/personal/generic/class_user.inc | 8 +++--- plugins/personal/mail/class_mailAccount.inc | 15 +++++++++++ .../personal/nagios/class_nagiosAccount.inc | 13 ++++++++++ plugins/personal/netatalk/class_netatalk.inc | 12 +++++++++ plugins/personal/posix/class_posixAccount.inc | 11 +++++--- plugins/personal/samba/class_sambaAccount.inc | 12 +++++++++ 17 files changed, 210 insertions(+), 12 deletions(-) diff --git a/plugins/personal/connectivity/class_intranetAccount.inc b/plugins/personal/connectivity/class_intranetAccount.inc index 367903914..845ab01bb 100644 --- a/plugins/personal/connectivity/class_intranetAccount.inc +++ b/plugins/personal/connectivity/class_intranetAccount.inc @@ -1,5 +1,7 @@ \version 1.00 @@ -35,10 +37,15 @@ class intranetAccount extends plugin { plugin::plugin ($config, $dn,$parent); - /* Setting uid to default */ - if(isset($this->attrs['uid'][0])){ - $this->uid = $this->attrs['uid'][0]; - } + /* Setting uid to default */ + if(isset($this->attrs['uid'][0])){ + $this->uid = $this->attrs['uid'][0]; + } + + /* Log view */ + if($this->is_account){ + @log::log("view","users/".get_class($this),$this->dn); + } } /*! @@ -105,6 +112,9 @@ class intranetAccount extends plugin $this->cleanup(); $ldap->modify ($this->attrs); + /* Log last action */ + @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/intranet account with dn '%s' failed."),$this->dn)); /* Optionally execute a command after we're done */ @@ -163,6 +173,13 @@ class intranetAccount extends plugin $this->cleanup(); $ldap->modify ($this->attrs); + /* Log last action */ + if($this->initially_was_account){ + @log::log("modify","users/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error()); + }else{ + @log::log("create","users/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error()); + } + show_ldap_error($ldap->get_error(), sprintf(_("Saving of user/intranet account with dn '%s' failed."),$this->dn)); /* Optionally execute a command after we're done */ diff --git a/plugins/personal/connectivity/class_kolabAccount.inc b/plugins/personal/connectivity/class_kolabAccount.inc index b038cd9c7..0b09fdc51 100644 --- a/plugins/personal/connectivity/class_kolabAccount.inc +++ b/plugins/personal/connectivity/class_kolabAccount.inc @@ -68,6 +68,11 @@ class kolabAccount extends plugin $this->is_account = false; $this->mail_Account = false; } + + /* Log view */ + if($this->is_account){ + @log::log("view","users/".get_class($this),$this->dn); + } } @@ -285,6 +290,9 @@ class kolabAccount extends plugin $ldap->cd ($this->dn); $ldap->modify($this->attrs); + /* Log last action */ + @log::log("remove","users/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error()); + $this->handle_post_events('remove',array("uid" => $this->uid)); show_ldap_error($ldap->get_error(), sprintf(_("Removing of user/kolab account with dn '%s' failed."),$this->dn)); } @@ -408,6 +416,13 @@ class kolabAccount extends plugin $this->cleanup(); $ldap->modify ($this->attrs); + /* Log last action */ + if($this->initially_was_account){ + @log::log("modify","users/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error()); + }else{ + @log::log("create","users/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error()); + } + show_ldap_error($ldap->get_error(), sprintf(_("Saving of user/kolab account with dn '%s' failed."),$this->dn)); /* Optionally execute a command after we're done */ diff --git a/plugins/personal/connectivity/class_opengwAccount.inc b/plugins/personal/connectivity/class_opengwAccount.inc index 5f6058e5a..9be419d92 100644 --- a/plugins/personal/connectivity/class_opengwAccount.inc +++ b/plugins/personal/connectivity/class_opengwAccount.inc @@ -118,6 +118,12 @@ class opengwAccount extends plugin /* Transmit data back to ogw handle */ $this->handle->SetInfos($this->info); } + + /* Log view */ + if($this->is_account){ + @log::log("view","users/".get_class($this),$this->dn); + } + } function execute() @@ -225,6 +231,8 @@ class opengwAccount extends plugin $this->handle = new ogw($this->serverCon['LOGIN'],$this->serverCon['PASSWORD'],$this->serverCon['SERVER'],$this->serverCon['DB']); $this->handle->SetInfos($this->info); $this->handle->Perform("REMOVE"); + + @log::log("remove","users/".get_class($this),$this->dn); } } @@ -290,8 +298,10 @@ class opengwAccount extends plugin $this->handle->checkInfos(); if($this->initialy_was_account){ $this->handle->Perform("EDIT"); + @log::log("modify","users/".get_class($this),$this->dn); }else{ $this->handle->Perform("ADD"); + @log::log("create","users/".get_class($this),$this->dn); } } diff --git a/plugins/personal/connectivity/class_oxchangeAccount.inc b/plugins/personal/connectivity/class_oxchangeAccount.inc index ca660a8ac..7445985a2 100644 --- a/plugins/personal/connectivity/class_oxchangeAccount.inc +++ b/plugins/personal/connectivity/class_oxchangeAccount.inc @@ -598,6 +598,12 @@ class oxchangeAccount extends plugin if(isset($this->attrs[$this->dnmode][0])){ $this->dnModeValue = $this->attrs[$this->dnmode][0]; } + + /* Log view */ + if($this->is_account){ + @log::log("view","users/".get_class($this),$this->dn); + } + } function execute() @@ -739,6 +745,9 @@ class oxchangeAccount extends plugin $this->attributes, "Save"); $this->cleanup(); $ldap->modify ($this->attrs); + + @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/oxchange addressbook account with dn '%s' failed."),$this->dn)); /* Optionally execute a command after we're done */ @@ -842,6 +851,12 @@ class oxchangeAccount extends plugin $this->cleanup(); $ldap->modify ($this->attrs); + if($this->initially_was_account){ + @log::log("modify","users/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error()); + }else{ + @log::log("create","users/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error()); + } + show_ldap_error($ldap->get_error(), sprintf(_("Saving of user/oxchange account with dn '%s' failed."),$this->dn)); /* Optionally execute a command after we're done */ diff --git a/plugins/personal/connectivity/class_phpgwAccount.inc b/plugins/personal/connectivity/class_phpgwAccount.inc index ce14d589c..4a1745f43 100644 --- a/plugins/personal/connectivity/class_phpgwAccount.inc +++ b/plugins/personal/connectivity/class_phpgwAccount.inc @@ -26,6 +26,10 @@ class phpgwAccount extends plugin $this->uid = $this->attrs['uid'][0]; } + + if($this->is_account){ + @log::log("view","users/".get_class($this),$this->dn); + } } function execute() @@ -78,6 +82,8 @@ class phpgwAccount extends plugin show_ldap_error($ldap->get_error(), sprintf(_("Removing of user/PHPgw account with dn '%s' failed."),$this->dn)); + @log::log("remove","users/".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',array("uid" => $this->uid)); } @@ -122,6 +128,12 @@ class phpgwAccount extends plugin $this->cleanup(); $ldap->modify ($this->attrs); + if($this->initially_was_account){ + @log::log("modify","users/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error()); + }else{ + @log::log("create","users/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error()); + } + show_ldap_error($ldap->get_error(), sprintf(_("Saving of user/PHPgw account with dn '%s' failed."),$this->dn)); /* Optionally execute a command after we're done */ @@ -132,6 +144,7 @@ class phpgwAccount extends plugin } else { $this->handle_post_events("add",array("uid" => $this->uid)); } + } diff --git a/plugins/personal/connectivity/class_phpscheduleitAccount.inc b/plugins/personal/connectivity/class_phpscheduleitAccount.inc index a744b2dae..56cd7fc78 100644 --- a/plugins/personal/connectivity/class_phpscheduleitAccount.inc +++ b/plugins/personal/connectivity/class_phpscheduleitAccount.inc @@ -35,6 +35,10 @@ class phpscheduleitAccount extends plugin function phpscheduleitAccount ($config, $dn= NULL) { plugin::plugin ($config, $dn); + + if($this->is_account){ + @log::log("view","users/".get_class($this),$this->dn); + } } function execute() @@ -77,6 +81,9 @@ class phpscheduleitAccount extends plugin $ldap->modify ($this->attrs); show_ldap_error($ldap->get_error(), sprintf(_("Removing of user/PHPscheduleit account with dn '%s' failed."),$this->dn)); + if($this->is_account){ + @log::log("remove","users/".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',array("uid" => $this->uid)); } @@ -121,6 +128,12 @@ class phpscheduleitAccount extends plugin $this->cleanup(); $ldap->modify ($this->attrs); + if($this->initially_was_account){ + @log::log("modify","users/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error()); + }else{ + @log::log("create","users/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error()); + } + show_ldap_error($ldap->get_error(), sprintf(_("Saving of user/PHPscheduleit account with dn '%s' failed."),$this->dn)); /* Optionally execute a command after we're done */ diff --git a/plugins/personal/connectivity/class_pptpAccount.inc b/plugins/personal/connectivity/class_pptpAccount.inc index 96c8dea6c..3a0e15f60 100644 --- a/plugins/personal/connectivity/class_pptpAccount.inc +++ b/plugins/personal/connectivity/class_pptpAccount.inc @@ -43,6 +43,11 @@ class pptpAccount extends plugin $this->uid = $this->attrs['uid'][0]; } + /* Log view */ + if($this->is_account){ + @log::log("view","users/".get_class($this),$this->dn); + } + } function execute() @@ -90,6 +95,9 @@ class pptpAccount extends plugin $this->cleanup(); $ldap->modify ($this->attrs); + /* Log last action */ + @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/PPTP account with dn '%s' failed."),$this->dn)); /* Optionally execute a command after we're done */ @@ -137,6 +145,13 @@ class pptpAccount extends plugin $this->cleanup(); $ldap->modify ($this->attrs); + /* Log last action */ + if($this->initially_was_account){ + @log::log("modify","users/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error()); + }else{ + @log::log("create","users/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error()); + } + show_ldap_error($ldap->get_error(), sprintf(_("Saving of user/PPTP account with dn '%s' failed."),$this->dn)); /* Optionally execute a command after we're done */ diff --git a/plugins/personal/connectivity/class_proxyAccount.inc b/plugins/personal/connectivity/class_proxyAccount.inc index dbb0f7935..497166060 100644 --- a/plugins/personal/connectivity/class_proxyAccount.inc +++ b/plugins/personal/connectivity/class_proxyAccount.inc @@ -31,6 +31,10 @@ class proxyAccount extends plugin $this->uid = $this->attrs['uid'][0]; } + /* Log view */ + if($this->is_account){ + @log::log("view","users/".get_class($this),$this->dn); + } } function execute() @@ -155,6 +159,9 @@ class proxyAccount extends plugin $this->cleanup(); $ldap->modify ($this->attrs); + /* Log last action */ + @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/proxy account with dn '%s' failed."),$this->dn)); /* Optionally execute a command after we're done */ @@ -270,6 +277,13 @@ class proxyAccount extends plugin $this->cleanup(); $ldap->modify ($this->attrs); + /* Log last action */ + if($this->initially_was_account){ + @log::log("modify","users/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error()); + }else{ + @log::log("create","users/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error()); + } + show_ldap_error($ldap->get_error(), sprintf(_("Saving of user/proxy account with dn '%s' failed."),$this->dn)); /* Optionally execute a command after we're done */ diff --git a/plugins/personal/connectivity/class_pureftpdAccount.inc b/plugins/personal/connectivity/class_pureftpdAccount.inc index 1069f60c9..b9abfbf64 100644 --- a/plugins/personal/connectivity/class_pureftpdAccount.inc +++ b/plugins/personal/connectivity/class_pureftpdAccount.inc @@ -34,6 +34,10 @@ class pureftpdAccount extends plugin $this->uid = $this->attrs['uid'][0]; } + /* Log view */ + if($this->is_account){ + @log::log("view","users/".get_class($this),$this->dn); + } } function execute() @@ -104,6 +108,9 @@ class pureftpdAccount extends plugin $this->cleanup(); $ldap->modify ($this->attrs); + /* Log last action */ + @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/pureftpd account with dn '%s' failed."),$this->dn)); /* Optionally execute a command after we're done */ @@ -195,6 +202,13 @@ class pureftpdAccount extends plugin $ldap->cd($this->dn); $this->cleanup(); $ldap->modify ($this->attrs); + + /* Log last action */ + if($this->initially_was_account){ + @log::log("modify","users/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error()); + }else{ + @log::log("create","users/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error()); + } show_ldap_error($ldap->get_error(), sprintf(_("Saving of user/pureftpd account with dn '%s' failed."),$this->dn)); diff --git a/plugins/personal/connectivity/class_webdavAccount.inc b/plugins/personal/connectivity/class_webdavAccount.inc index dfc9352be..de2202873 100644 --- a/plugins/personal/connectivity/class_webdavAccount.inc +++ b/plugins/personal/connectivity/class_webdavAccount.inc @@ -22,6 +22,10 @@ class webdavAccount extends plugin $this->uid = $this->attrs['uid'][0]; } + /* Log view */ + if($this->is_account){ + @log::log("view","users/".get_class($this),$this->dn); + } } function execute() @@ -73,6 +77,9 @@ class webdavAccount extends plugin $this->cleanup(); $ldap->modify ($this->attrs); + /* Log last action */ + @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/webDAV account with dn '%s' failed."),$this->dn)); /* Optionally execute a command after we're done */ @@ -120,6 +127,13 @@ class webdavAccount extends plugin $this->cleanup(); $ldap->modify ($this->attrs); + /* Log last action */ + if($this->initially_was_account){ + @log::log("modify","users/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error()); + }else{ + @log::log("create","users/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error()); + } + show_ldap_error($ldap->get_error(), sprintf(_("Saving of user/webDAV account with dn '%s' failed."),$this->dn)); /* Optionally execute a command after we're done */ diff --git a/plugins/personal/environment/class_environment.inc b/plugins/personal/environment/class_environment.inc index 0f3d93059..f8ad1f0b1 100644 --- a/plugins/personal/environment/class_environment.inc +++ b/plugins/personal/environment/class_environment.inc @@ -1193,7 +1193,8 @@ class environment extends plugin $this->cleanup(); $ldap->$mode($this->attrs); - if($mode == "modify"){ + /* Log last action */ + if($this->initially_was_account){ @log::log("modify","users/environment",$this->dn,array_keys($this->attrs),$ldap->get_error()); }else{ @log::log("create","users/environment",$this->dn,array_keys($this->attrs),$ldap->get_error()); diff --git a/plugins/personal/generic/class_user.inc b/plugins/personal/generic/class_user.inc index 71e11b99f..193143566 100644 --- a/plugins/personal/generic/class_user.inc +++ b/plugins/personal/generic/class_user.inc @@ -137,7 +137,7 @@ class user extends plugin if ($dn == "new"){ $this->is_account= TRUE; }else{ - @log::log("view","users/user",$dn); + @log::log("view","users/".get_class($this),$this->dn); } /* Make hash default to md5 if not set in config */ @@ -592,7 +592,7 @@ class user extends plugin $ldap->rmdir ($this->dn); show_ldap_error($ldap->get_error(), sprintf(_("Removing of user/generic account with dn '%s' failed."),$this->dn)); - @log::log("remove","users/user",$dn,$this->attributes,$ldap->get_error()); + @log::log("remove","users/".get_class($this),$this->dn,$this->attributes,$ldap->get_error()); /* Delete references to groups */ $ldap->cd ($this->config->current['BASE']); @@ -944,9 +944,9 @@ class user extends plugin } if($mode == "modify"){ - @log::log("modify","users/user",$this->dn,array_keys($this->attrs),$ldap->get_error()); + @log::log("modify","users/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error()); }else{ - @log::log("create","users/user",$this->dn,array_keys($this->attrs),$ldap->get_error()); + @log::log("create","users/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error()); } /* Remove cert? diff --git a/plugins/personal/mail/class_mailAccount.inc b/plugins/personal/mail/class_mailAccount.inc index 9c5dfddc9..0221fd4e0 100644 --- a/plugins/personal/mail/class_mailAccount.inc +++ b/plugins/personal/mail/class_mailAccount.inc @@ -198,6 +198,11 @@ class mailAccount extends plugin "regex" => "*"); register_global("mailfilter", $mailfilter); } + + /* Add "view" to logging class */ + if($this->is_account){ + @log::log("view","users/".get_class($this),$this->dn); + } } @@ -675,6 +680,9 @@ class mailAccount extends plugin $ldap->modify ($this->attrs); + /* Add "view" to logging class */ + @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/mail account with dn '%s' failed."),$this->dn)); /* Connect to IMAP server for account deletion */ @@ -831,6 +839,13 @@ class mailAccount extends plugin show_ldap_error($ldap->get_error(), sprintf(_("Saving of user/mail account with dn '%s' failed."),$this->dn)); + /* Log last action */ + if($this->initially_was_account){ + @log::log("modify","users/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error()); + }else{ + @log::log("create","users/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error()); + } + /* Only do IMAP actions if we are not a template */ if (!$this->is_template){ diff --git a/plugins/personal/nagios/class_nagiosAccount.inc b/plugins/personal/nagios/class_nagiosAccount.inc index 9f32138a1..0e0a09d47 100644 --- a/plugins/personal/nagios/class_nagiosAccount.inc +++ b/plugins/personal/nagios/class_nagiosAccount.inc @@ -77,6 +77,10 @@ class nagiosAccount extends plugin /* Save initial account state */ $this->initially_was_account= $this->is_account; + + if($this->is_account){ + @log::log("view","users/".get_class($this),$this->dn); + } } function execute() @@ -161,6 +165,13 @@ class nagiosAccount extends plugin $this->cleanup(); $ldap->modify ($this->attrs); + /* Log last action */ + if($this->initially_was_account){ + @log::log("modify","users/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error()); + }else{ + @log::log("create","users/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error()); + } + show_ldap_error($ldap->get_error(), sprintf(_("Saving of user/nagios account with dn '%s' failed."),$this->dn)); /* Optionally execute a command after we're done */ @@ -242,6 +253,8 @@ class nagiosAccount extends plugin $this->cleanup(); $ldap->modify ($this->attrs); + @log::log("view","users/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error()); + show_ldap_error($ldap->get_error(), sprintf(_("Removing of user/nagios account with dn '%s' failed."),$this->dn)); /* remove the entry from LDAP */ diff --git a/plugins/personal/netatalk/class_netatalk.inc b/plugins/personal/netatalk/class_netatalk.inc index 1d06faac4..4d772a8c2 100644 --- a/plugins/personal/netatalk/class_netatalk.inc +++ b/plugins/personal/netatalk/class_netatalk.inc @@ -102,6 +102,10 @@ class netatalk extends plugin { /* Save initial account state */ $this->initially_was_account = $this->is_account; + + if($this->is_account){ + @log::log("view","users/".get_class($this),$this->dn); + } } @@ -278,6 +282,12 @@ class netatalk extends plugin { $this->cleanup(); $ldap->modify($this->attrs); + if($this->initially_was_account){ + @log::log("modify","users/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error()); + }else{ + @log::log("create","users/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error()); + } + show_ldap_error($ldap->get_error(), sprintf(_("Saving of user/netatalk account with dn '%s' failed."),$this->dn)); /* Optionally execute a command after we're done */ @@ -338,6 +348,8 @@ class netatalk extends plugin { $this->cleanup(); $ldap->modify($this->attrs); + @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/netatalk account with dn '%s' failed."),$this->dn)); /* remove the entry from LDAP */ diff --git a/plugins/personal/posix/class_posixAccount.inc b/plugins/personal/posix/class_posixAccount.inc index 4dece52c5..f8068ce63 100644 --- a/plugins/personal/posix/class_posixAccount.inc +++ b/plugins/personal/posix/class_posixAccount.inc @@ -97,7 +97,7 @@ class posixAccount extends plugin $ldap= $this->config->get_ldap_link(); if($this->is_account){ - @log::log("view","users/posix",$this->dn); + @log::log("view","users/".get_class($this),$this->dn); } if ($dn != NULL){ @@ -615,7 +615,7 @@ class posixAccount extends plugin $this->cleanup(); $ldap->modify ($this->attrs); - @log::log("remove","users/posix",$this->dn,array_keys($this->attrs),$ldap->get_error()); + @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/posix account with dn '%s' failed."),$this->dn)); @@ -854,7 +854,12 @@ class posixAccount extends plugin unset($this->attrs['uid']); $ldap->modify ($this->attrs); - @log::log("modify","users/posix",$this->dn,array_keys($this->attrs),$ldap->get_error()); + /* Log last action */ + if($this->initially_was_account){ + @log::log("modify","users/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error()); + }else{ + @log::log("create","users/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error()); + } show_ldap_error($ldap->get_error(), sprintf(_("Saving of user/posix account with dn '%s' failed."),$this->dn)); diff --git a/plugins/personal/samba/class_sambaAccount.inc b/plugins/personal/samba/class_sambaAccount.inc index 879f4e6ba..c9b266719 100644 --- a/plugins/personal/samba/class_sambaAccount.inc +++ b/plugins/personal/samba/class_sambaAccount.inc @@ -188,6 +188,10 @@ class sambaAccount extends plugin /* Save initial account state */ $this->initially_was_account= $this->is_account; + + if($this->is_account){ + @log::log("view","users/".get_class($this),$this->dn); + } } function execute() @@ -662,6 +666,8 @@ class sambaAccount extends plugin $this->cleanup(); $ldap->modify ($this->attrs); + @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/samba account with dn '%s' failed."),$this->dn)); /* Optionally execute a command after we're done */ @@ -1010,6 +1016,12 @@ class sambaAccount extends plugin $this->cleanup(); $ldap->modify ($this->attrs); + if($this->initially_was_account){ + @log::log("modify","users/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error()); + }else{ + @log::log("create","users/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error()); + } + show_ldap_error($ldap->get_error(), sprintf(_("Saving of user/samba account with dn '%s' failed."),$this->dn)); /* Optionally execute a command after we're done */ -- 2.30.2