From ac936dd34ad69a53d8c2d60cec77147fcbc28aa9 Mon Sep 17 00:00:00 2001 From: Roland Gruber Date: Wed, 16 Jan 2019 20:52:59 +0100 Subject: [PATCH] added mailLocalAddress and proxyAddresses as self service fields --- lam/HISTORY | 2 ++ .../manual-sources/chapter-selfService.xml | 20 ++++++++++++++- lam/lib/modules/inetLocalMailRecipient.inc | 25 ++++++++++++++++++- lam/lib/modules/windowsUser.inc | 14 ++++++++++- 4 files changed, 58 insertions(+), 3 deletions(-) diff --git a/lam/HISTORY b/lam/HISTORY index e9ab58e5..d41e9b39 100644 --- a/lam/HISTORY +++ b/lam/HISTORY @@ -1,5 +1,7 @@ March 2019 - Added YubiKey as 2-factor authentication provider + - LAM Pro: + - New self service fields: Mail routing (Local address) and Windows (Proxy-Addresses) 28.12.2018 6.6 - New import/export in tools menu diff --git a/lam/docs/manual-sources/chapter-selfService.xml b/lam/docs/manual-sources/chapter-selfService.xml index dba51c2b..d6106436 100644 --- a/lam/docs/manual-sources/chapter-selfService.xml +++ b/lam/docs/manual-sources/chapter-selfService.xml @@ -685,6 +685,18 @@ + + + + + + Mail routing + + Local address (read-only) + + + + @@ -741,7 +753,7 @@ - + @@ -776,6 +788,12 @@ + + Proxy-Addresses (read-only) + + + + State diff --git a/lam/lib/modules/inetLocalMailRecipient.inc b/lam/lib/modules/inetLocalMailRecipient.inc index 890c3377..2cea6fe8 100644 --- a/lam/lib/modules/inetLocalMailRecipient.inc +++ b/lam/lib/modules/inetLocalMailRecipient.inc @@ -2,7 +2,7 @@ /* This code is part of LDAP Account Manager (http://www.ldap-account-manager.org/) - Copyright (C) 2004 - 2018 Roland Gruber + Copyright (C) 2004 - 2019 Roland Gruber This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -135,6 +135,10 @@ class inetLocalMailRecipient extends baseModule { 'localAdr' => _('Local address list'), 'host' => _('Mail server') ); + // self service + $return['selfServiceFieldSettings'] = array( + 'mailLocalAddress' => _('Local address (read-only)'), + ); return $return; } @@ -354,6 +358,25 @@ class inetLocalMailRecipient extends baseModule { return $return; } + function getSelfServiceOptions($fields, $attributes, $passwordChangeOnly, $readOnlyFields) { + if ($passwordChangeOnly) { + return array(); // no processing as long no LDAP content can be read + } + $return = array(); + if (in_array('mailLocalAddress', $fields)) { + $mailLocalAddress = array(); + if (isset($attributes['mailLocalAddress'])) { + $mailLocalAddress = $attributes['mailLocalAddress']; + } + array_map('htmlspecialchars', $mailLocalAddress); + $row = new htmlResponsiveRow(); + $row->addLabel(new htmlOutputText($this->getSelfServiceLabel('mailLocalAddress', _('Local address')))); + $row->addField(new htmlOutputText(implode('
', $mailLocalAddress), false)); + $return['mailLocalAddress'] = $row; + } + return $return; + } + } diff --git a/lam/lib/modules/windowsUser.inc b/lam/lib/modules/windowsUser.inc index b985c725..434598a8 100644 --- a/lam/lib/modules/windowsUser.inc +++ b/lam/lib/modules/windowsUser.inc @@ -5,7 +5,7 @@ use LAM\ImageUtils\ImageManipulationFactory; /* This code is part of LDAP Account Manager (http://www.ldap-account-manager.org/) - Copyright (C) 2013 - 2018 Roland Gruber + Copyright (C) 2013 - 2019 Roland Gruber This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -952,6 +952,7 @@ class windowsUser extends baseModule implements passwordService { 'accountExpires' => _('Account expiration date (read-only)'), 'department' => _('Department'), 'departmentNumber' => _('Department number'), + 'proxyAddresses' => _('Proxy-Addresses (read-only)'), ); // possible self service read-only fields $return['selfServiceReadOnlyFields'] = array('physicalDeliveryOfficeName', 'telephoneNumber', @@ -2924,6 +2925,17 @@ class windowsUser extends baseModule implements passwordService { $row->addLabel(new htmlOutputText($this->getSelfServiceLabel('accountExpires', _('Account expiration date')))); $row->addField(new htmlOutputText($this->formatAccountExpires($attributes))); $return['accountExpires'] = $row; + if (in_array('proxyAddresses', $fields)) { + $proxyAddresses = array(); + if (isset($attributes['proxyAddresses'])) { + $proxyAddresses = $attributes['proxyAddresses']; + } + array_map('htmlspecialchars', $proxyAddresses); + $row = new htmlResponsiveRow(); + $row->addLabel(new htmlOutputText($this->getSelfServiceLabel('proxyAddresses', _('Proxy-Addresses')))); + $row->addField(new htmlOutputText(implode('
', $proxyAddresses), false)); + $return['proxyAddresses'] = $row; + } return $return; }