From: hickert Date: Wed, 14 Jan 2009 13:32:15 +0000 (+0000) Subject: Updated samba tab X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=777d0b2366088daa53a8210b498cea58601da89c;p=gosa.git Updated samba tab - Added pasword expiry informations git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@13348 594d385d-05f5-0310-b6e9-bd551577e9d8 --- diff --git a/gosa-plugins/samba/personal/samba/class_sambaAccount.inc b/gosa-plugins/samba/personal/samba/class_sambaAccount.inc index 2f3df17e3..83cfce312 100644 --- a/gosa-plugins/samba/personal/samba/class_sambaAccount.inc +++ b/gosa-plugins/samba/personal/samba/class_sambaAccount.inc @@ -691,6 +691,45 @@ class sambaAccount extends plugin $smarty->assign("tsloginstate",""); } + /* Create additional info for sambaKickOffTime and sambaPwdMustChange. + e.g. Display effective kickoff time. Domain policy + user settings. + */ + $additional_info_KickoffTime = ""; + $additional_info_PwdMustChange = ""; + + /* Calculate effective max Password Age + This can only be calculated if sambaPwdLastSet ist set. + */ + $this->attrs['sambaPwdLastSet'][0] = time() - (60 *60); + if(isset($this->attrs['sambaPwdLastSet'][0])){ + $last = $this->attrs['sambaPwdLastSet'][0]; + + $sid = $this->get_domain_info(); + if(isset($sid['sambaMaxPwdAge'][0])){ + $d = ($last + $sid['sambaMaxPwdAge'][0]) - time(); + + /* A negative value means the password is outdated + */ + if($d < 0){ + $additional_info_PwdMustChange = sprintf(_("Invalid by domain policiy, since %s."), + date("d.m.Y H:i:s",$last + $sid['sambaMaxPwdAge'][0])); + }else{ + if($this->password_expires && ($last + $sid['sambaMaxPwdAge'][0]) > $this->sambaPwdMustChange){ + $additional_info_PwdMustChange = sprintf(_("Invalid by user policiy, on %s."), + date("d.m.Y H:i:s", $this->sambaPwdMustChange)); + }else{ + $additional_info_PwdMustChange = sprintf(_("Invalid by domain policiy, on %s."), + date("d.m.Y H:i:s", ($last + $sid['sambaMaxPwdAge'][0]))); + } + } + } + } + + $additional_info_KickoffTime = "asdf"; + + $smarty->assign("additional_info_KickoffTime",$additional_info_KickoffTime); + $smarty->assign("additional_info_PwdMustChange",$additional_info_PwdMustChange); + /* Show main page */ $smarty->assign("multiple_support",$this->multiple_support_active); if ($this->samba3){ @@ -710,6 +749,29 @@ class sambaAccount extends plugin } + /*! \brief Returns the samba Domain object, selected in the samba tab. + */ + function get_domain_info() + { + /* Only search once, return last result if available + */ + if(!isset($this->cache['DOMAIN'][$this->sambaDomainName])){ + $this->cache['DOMAIN'][$this->sambaDomainName] = array(); + if(!empty($this->sambaDomainName) && isset($this->config->data['SERVERS']['SAMBA'][$this->sambaDomainName])){ + $cfg = $this->config->data['SERVERS']['SAMBA'][$this->sambaDomainName]; + $ldap = $this->config->get_ldap_link(); + $ldap->cd($this->config->current['BASE']); + $ldap->search("(&(objectClass=sambaDomain)(sambaSID=".$cfg['SID']."))",array("*")); + if($ldap->count()){ + $this->cache['DOMAIN'][$this->sambaDomainName] = $ldap->fetch(); + } + } + } + return($this->cache['DOMAIN'][$this->sambaDomainName]); + } + + + function get_samba_information() { diff --git a/gosa-plugins/samba/personal/samba/samba3.tpl b/gosa-plugins/samba/personal/samba/samba3.tpl index 250639b85..c58cdbc11 100644 --- a/gosa-plugins/samba/personal/samba/samba3.tpl +++ b/gosa-plugins/samba/personal/samba/samba3.tpl @@ -374,6 +374,7 @@ {html_options values=$years output=$years selected=$year} {/render} +
{$additional_info_PwdMustChange} @@ -402,6 +403,7 @@ +
{$additional_info_KickoffTime}