diff --git a/plugins/ldap-identities/LdapConfig.php b/plugins/ldap-identities/LdapConfig.php index 8cebd8b2c..c55f88bcb 100644 --- a/plugins/ldap-identities/LdapConfig.php +++ b/plugins/ldap-identities/LdapConfig.php @@ -8,6 +8,7 @@ class LdapConfig public const CONFIG_SERVER = "server"; public const CONFIG_PROTOCOL_VERSION = "server_version"; public const CONFIG_STARTTLS = "starttls"; + public const CONFIG_MAIL_PREFIX = "mail_prefix"; public const CONFIG_BIND_USER = "bind_user"; public const CONFIG_BIND_PASSWORD = "bind_password"; @@ -30,6 +31,7 @@ class LdapConfig public $server; public $protocol; public $starttls; + public $mail_prefix; public $bind_user; public $bind_password; public $user_base; @@ -51,6 +53,7 @@ class LdapConfig $ldap->server = trim($config->Get("plugin", self::CONFIG_SERVER)); $ldap->protocol = (int)trim($config->Get("plugin", self::CONFIG_PROTOCOL_VERSION, 3)); $ldap->starttls = (bool)trim($config->Get("plugin", self::CONFIG_STARTTLS)); + $ldap->mail_prefix = trim($config->Get("plugin", self::CONFIG_MAIL_PREFIX)); $ldap->bind_user = trim($config->Get("plugin", self::CONFIG_BIND_USER)); $ldap->bind_password = trim($config->Get("plugin", self::CONFIG_BIND_PASSWORD)); $ldap->user_base = trim($config->Get("plugin", self::CONFIG_USER_BASE)); diff --git a/plugins/ldap-identities/index.php b/plugins/ldap-identities/index.php index 19e7a1503..121d0261b 100644 --- a/plugins/ldap-identities/index.php +++ b/plugins/ldap-identities/index.php @@ -57,13 +57,19 @@ class LdapIdentitiesPlugin extends AbstractPlugin ->SetLabel("LDAP Protocol Version") ->SetType(PluginPropertyType::SELECTION) ->SetDefaultValue([2, 3]), - + Property::NewInstance(LdapConfig::CONFIG_STARTTLS) ->SetLabel("Use StartTLS") ->SetType(PluginPropertyType::BOOL) ->SetDescription("Whether or not to use TLS encrypted connection") ->SetDefaultValue(true), + Property::NewInstance(LdapConfig::CONFIG_MAIL_PREFIX) + ->SetLabel("Email prefix") + ->SetType(PluginPropertyType::STRING) + ->SetDescription("Only addresses with this prefix will be used as identity. The prefix is removed from the identity list.\nThis is useful for example to import identities from Exchange, which stores mail addresses in the ProxyAddresses attribut of Active Directory with \"smtp:\" as prefix. \(e.g. \"smtp:john.doe@topsecret.info\"\)\n-> To use addresses set by Exchange use \"smtp:\" as prefix.") + ->SetDefaultValue(""), + Property::NewInstance(LdapConfig::CONFIG_BIND_USER) ->SetLabel("Bind User DN") ->SetDescription("The user to use for binding to the LDAP server. Should be a DN or RDN. Leave empty for anonymous bind")