mirror of
https://git.code.sf.net/p/seeddms/code
synced 2024-11-26 07:22:11 +00:00
field for storing email in ldap can be configured
This commit is contained in:
parent
9e899d0064
commit
5c7ef9dfd2
|
@ -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
|
||||
---------
|
||||
|
||||
|
|
|
@ -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]);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -364,6 +364,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
|
||||
|
@ -688,6 +690,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"))
|
||||
{
|
||||
|
@ -700,6 +703,7 @@ class Settings { /* {{{ */
|
|||
$this->_ldapFilter = strVal($connectorNode["filter"]);
|
||||
$this->_ldapAccountDomainName = strVal($connectorNode["accountDomainName"]);
|
||||
$this->_ldapGroupField = strVal($connectorNode["groupField"]);
|
||||
$this->_ldapMailField = strVal($connectorNode["mailField"]);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user