diff --git a/lam/HISTORY b/lam/HISTORY index 2381fb86..f1582c2e 100644 --- a/lam/HISTORY +++ b/lam/HISTORY @@ -6,6 +6,7 @@ March 2019 -> New self service fields: Mail routing (Local address) and Windows (Proxy-Addresses) -> Bind DLZ: support DNAME+XFR records and descriptions in records (requires latest LDAP schema) -> Cron jobs: added Shadow account expiration notification jobs + -> New self service fields: Shadow account expiration date - Fixed bugs: -> Allow tree-only configurations without any other tab diff --git a/lam/lib/modules/shadowAccount.inc b/lam/lib/modules/shadowAccount.inc index 39aec47b..113a0a89 100644 --- a/lam/lib/modules/shadowAccount.inc +++ b/lam/lib/modules/shadowAccount.inc @@ -97,9 +97,15 @@ class shadowAccount extends baseModule implements passwordService { 'shadowInactive', 'shadowExpire', 'shadowFlag'); // lists for expiration date $day = array('-'); $mon = array('-'); $year = array('-'); - for ( $i=1; $i<=31; $i++ ) $day[] = $i; - for ( $i=1; $i<=12; $i++ ) $mon[] = $i; - for ( $i=2003; $i<=2030; $i++ ) $year[] = $i; + for ( $i=1; $i<=31; $i++ ) { + $day[] = $i; + } + for ( $i=1; $i<=12; $i++ ) { + $mon[] = $i; + } + for ( $i=2003; $i<=2030; $i++ ) { + $year[] = $i; + } $profileOptionsTable = new htmlResponsiveRow(); // auto add extension $profileOptionsTable->add(new htmlResponsiveInputCheckbox('shadowAccount_addExt', false, _('Automatically add this extension'), 'autoAdd'), 12); @@ -231,7 +237,10 @@ class shadowAccount extends baseModule implements passwordService { ) ); // self service fields - $return['selfServiceFieldSettings'] = array('shadowLastChange' => _('Last password change (read-only)')); + $return['selfServiceFieldSettings'] = array( + 'shadowLastChange' => _('Last password change (read-only)'), + 'shadowExpire' => _('Account expiration date (read-only)') + ); return $return; } @@ -750,6 +759,17 @@ class shadowAccount extends baseModule implements passwordService { $row->addField(new htmlOutputText($shadowLastChange)); $return['shadowLastChange'] = $row; } + if (in_array('shadowExpire', $fields)) { + $shadowExpire = ''; + if (isset($attributes['shadowExpire'][0])) { + $date = new DateTime('@' . $attributes['shadowExpire'][0] * 3600 * 24, new DateTimeZone('UTC')); + $shadowExpire = $date->format('d.m.Y'); + } + $row = new htmlResponsiveRow(); + $row->addLabel(new htmlOutputText($this->getSelfServiceLabel('shadowExpire', _('Account expiration date')))); + $row->addField(new htmlOutputText($shadowExpire)); + $return['shadowExpire'] = $row; + } return $return; }