From 2fc90affc08419192e76d2c45195e28c35d4d8e9 Mon Sep 17 00:00:00 2001 From: cajus Date: Thu, 19 Oct 2006 06:24:47 +0000 Subject: [PATCH] Fixed bug #20 git-svn-id: https://oss.gonicus.de/repositories/gosa/branches/2.5@4901 594d385d-05f5-0310-b6e9-bd551577e9d8 --- Changelog | 2 ++ plugins/personal/posix/class_posixAccount.inc | 36 +++++++++++-------- 2 files changed, 24 insertions(+), 14 deletions(-) diff --git a/Changelog b/Changelog index 13644928e..d4dea3fa0 100644 --- a/Changelog +++ b/Changelog @@ -9,6 +9,8 @@ GOsa2 changelog inherited from object groups. - Show error messages from password dialog - Fixed a set of W3C problems + - Fixed multiple savings in addressbook (Closes: #23) + - Fixed shadow expire when using templates (Closes: #20) * gosa 2.5.4 - Included patch to choose the addressbook base diff --git a/plugins/personal/posix/class_posixAccount.inc b/plugins/personal/posix/class_posixAccount.inc index ff4cef179..7ae5503f2 100644 --- a/plugins/personal/posix/class_posixAccount.inc +++ b/plugins/personal/posix/class_posixAccount.inc @@ -171,12 +171,7 @@ class posixAccount extends plugin } /* Convert to seconds */ - if ($this->shadowExpire != 0){ - $this->shadowExpire*= 60 * 60 * 24; - } else { - $date= getdate(); - $this->shadowExpire= floor($date[0] / (60*60*24)) * 60 * 60 * 24; - } + $this->shadowExpire= $this->convertToSeconds($this->shadowExpire); /* Generate shell list from /etc/gosa/shells */ if (file_exists('/etc/gosa/shells')){ @@ -1048,15 +1043,15 @@ class posixAccount extends plugin $this->primaryGroup= $this->gidNumber; } - $ldap->cd($this->config->current['BASE']); - $ldap->search("(&(objectClass=gosaUserTemplate)(uid=".$template.")(accessTo=*))", array("cn","accessTo")); + $ldap->cd($this->config->current['BASE']); + $ldap->search("(&(objectClass=gosaUserTemplate)(uid=".$template.")(accessTo=*))", array("cn","accessTo")); + + while($attr = $ldap->fetch()){ + $tmp = $attr['accessTo']; + unset ($tmp['count']); + $this->accessTo = $tmp; + } - while($attr = $ldap->fetch()){ - $tmp = $attr['accessTo']; - unset ($tmp['count']); - $this->accessTo = $tmp; - } - /* Adjust shadow checkboxes */ foreach (array("shadowMin", "shadowMax", "shadowWarning", "shadowInactive", "shadowExpire") as $val){ @@ -1066,6 +1061,8 @@ class posixAccount extends plugin $this->$oval= "1"; } } + + $this->shadowExpire= $this->convertToSeconds($this->shadowExpire); } function get_next_id($attrib) @@ -1231,6 +1228,17 @@ class posixAccount extends plugin return($ret); } + + function convertToSeconds($val) + { + if ($val != 0){ + $val*= 60 * 60 * 24; + } else { + $date= getdate(); + $val= floor($date[0] / (60*60*24)) * 60 * 60 * 24; + } + } + } // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler: -- 2.30.2