Added config fields for mail prefix

Mail prefix is needed to filter mailidentities. For example suche set by Exchange in the ProxyAddresses field, which can hold different address types
This commit is contained in:
S-A-L13 2024-02-26 15:47:57 +01:00
parent 8dac28e1a2
commit 12cbb9f07e
2 changed files with 10 additions and 1 deletions

View file

@ -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));

View file

@ -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")