Merge branch 'seeddms-5.1.x' into seeddms-6.0.x

This commit is contained in:
Uwe Steinmann 2024-05-14 15:34:41 +02:00
commit 8870ca5c5d
4 changed files with 18 additions and 3 deletions

View File

@ -296,6 +296,7 @@
- allow to set expiration dates in the past again
- fix authentication with ldap if AD is used
- fix progress bar in list of users if quota is active
- field storing email in ldap can be configured
--------------------------------------------------------------------------------
Changes in version 5.1.34

View File

@ -35,6 +35,14 @@ is set to false. In that case the common name (cn) and email address is taken
from ldap. An already existing account in SeedDMS will be updated with data from
ldap.
Since version 5.1.35 and 6.0.28 the field name of the email address in ldap
can be set with the attribute `mailField`. If it is not set it defaults to `mail`.
Since version 5.1.34 and 6.0.27 the groups of a user stored in the ldap directory
can be synchronised with the groups in SeedDMS. The ldap field storing
the groups can be configured with the attribute `mailField`. This will add
new groups in SeedDMS and aѕsign them to the user.
Examples
---------

View File

@ -29,15 +29,17 @@ class SeedDMS_LdapAuthentication extends SeedDMS_Authentication {
var $settings;
protected function addUser($username, $info) {
return $this->dms->addUser($username, null, $info['cn'][0], isset($info['mail']) ? $info['mail'][0] : '', $this->settings->_language, $this->settings->_theme, "User was added from LDAP");
$mailfield = !empty($settings->_ldapMailField) ? $settings->_ldapMailField : 'mail';
return $this->dms->addUser($username, null, $info['cn'][0], isset($info[$mailfield]) ? $info[$mailfield][0] : '', $this->settings->_language, $this->settings->_theme, "User was added from LDAP");
}
protected function updateUser($user, $info) {
$mailfield = !empty($settings->_ldapMailField) ? $settings->_ldapMailField : 'mail';
if(isset($info['cn'][0]) && ($info['cn'][0] != $user->getFullName())) {
$user->setFullName($info['cn'][0]);
}
if(isset($info['mail'][0]) && ($info['mail'][0] != $user->getEmail())) {
$user->setEmail($info['mail'][0]);
if(isset($info[$mailfield][0]) && ($info[$mailfield][0] != $user->getEmail())) {
$user->setEmail($info[$mailfield][0]);
}
}

View File

@ -404,6 +404,8 @@ class Settings { /* {{{ */
// Name of the ldap field containing the groups of the user, e.g. memeberOf
// This field must contain the DN of the groups
var $_ldapGroupField = "";
// Name of the ldap field containing the email of the user, e.g. mail, or mailprimaryaddress
var $_ldapMailField = "";
// Type of Ldap server: 0 = ldap; 1 = AD
var $_ldapType = 1;
// Additional filter when searching for the user. If not set, the user will be searched
@ -744,6 +746,7 @@ class Settings { /* {{{ */
$this->_ldapType = 0;
$this->_ldapFilter = strVal($connectorNode["filter"]);
$this->_ldapGroupField = strVal($connectorNode["groupField"]);
$this->_ldapMailField = strVal($connectorNode["mailField"]);
}
else if ($params['enable'] && ($typeConn == "AD"))
{
@ -756,6 +759,7 @@ class Settings { /* {{{ */
$this->_ldapFilter = strVal($connectorNode["filter"]);
$this->_ldapAccountDomainName = strVal($connectorNode["accountDomainName"]);
$this->_ldapGroupField = strVal($connectorNode["groupField"]);
$this->_ldapMailField = strVal($connectorNode["mailField"]);
}
}