2022-11-16 01:29:01 +08:00
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
|
|
use RainLoop\Config\Plugin;
|
|
|
|
|
2022-11-29 23:51:54 +08:00
|
|
|
class LdapMailAccountsConfig
|
2022-11-16 01:29:01 +08:00
|
|
|
{
|
|
|
|
public const CONFIG_SERVER = "server";
|
|
|
|
public const CONFIG_PROTOCOL_VERSION = "server_version";
|
|
|
|
|
|
|
|
public const CONFIG_BIND_USER = "bind_user";
|
|
|
|
public const CONFIG_BIND_PASSWORD = "bind_password";
|
|
|
|
|
2022-11-25 17:42:14 +08:00
|
|
|
public const CONFIG_BASE = "base";
|
|
|
|
public const CONFIG_OBJECTCLASS = "objectclass";
|
|
|
|
public const CONFIG_FIELD_NAME = "field_name";
|
|
|
|
public const CONFIG_FIELD_SEARCH = "field_search";
|
|
|
|
public const CONFIG_FIELD_USERNAME = "field_username";
|
|
|
|
public const CONFIG_SEARCH_STRING = "search_string";
|
|
|
|
public const CONFIG_FIELD_MAIL_DOMAIN = "field_domain";
|
2023-02-17 19:01:39 +08:00
|
|
|
public const CONFIG_FIELD_MAIL_ADDRESS_ADDITIONAL_ACCOUNT = "field_mail_address_additional_account";
|
2023-02-10 18:11:24 +08:00
|
|
|
public const CONFIG_BOOL_OVERWRITE_MAIL_ADDRESS_MAIN_ACCOUNT = "bool_overwrite_mail_address_main_account";
|
2023-02-10 19:04:50 +08:00
|
|
|
public const CONFIG_FIELD_MAIL_ADDRESS_MAIN_ACCOUNT = "field_mail_address_main_account";
|
2024-05-14 23:24:26 +08:00
|
|
|
public const CONFIG_BOOL_OVERWRITE_CRYPTKEY = "bool_overwrite_cryptkey";
|
2022-11-16 01:29:01 +08:00
|
|
|
|
|
|
|
public $server;
|
|
|
|
public $protocol;
|
|
|
|
public $bind_user;
|
|
|
|
public $bind_password;
|
2022-11-25 17:42:14 +08:00
|
|
|
public $base;
|
|
|
|
public $objectclass;
|
|
|
|
public $field_name;
|
|
|
|
public $field_search;
|
|
|
|
public $field_username;
|
|
|
|
public $search_string;
|
|
|
|
public $field_domain;
|
2023-02-10 18:11:24 +08:00
|
|
|
public $field_mail_address_main_account;
|
|
|
|
public $field_mail_address_additional_account;
|
|
|
|
public $bool_overwrite_mail_address_main_account;
|
2024-05-14 23:24:26 +08:00
|
|
|
public $bool_overwrite_cryptkey;
|
2022-11-16 01:29:01 +08:00
|
|
|
|
2022-11-29 23:51:54 +08:00
|
|
|
public static function MakeConfig(Plugin $config): LdapMailAccountsConfig
|
2022-11-16 01:29:01 +08:00
|
|
|
{
|
|
|
|
$ldap = new self();
|
|
|
|
$ldap->server = trim($config->Get("plugin", self::CONFIG_SERVER));
|
|
|
|
$ldap->protocol = (int)trim($config->Get("plugin", self::CONFIG_PROTOCOL_VERSION, 3));
|
|
|
|
$ldap->bind_user = trim($config->Get("plugin", self::CONFIG_BIND_USER));
|
|
|
|
$ldap->bind_password = trim($config->Get("plugin", self::CONFIG_BIND_PASSWORD));
|
2022-11-25 17:42:14 +08:00
|
|
|
$ldap->base = trim($config->Get("plugin", self::CONFIG_BASE));
|
|
|
|
$ldap->objectclass = trim($config->Get("plugin", self::CONFIG_OBJECTCLASS));
|
|
|
|
$ldap->field_name = trim($config->Get("plugin", self::CONFIG_FIELD_NAME));
|
|
|
|
$ldap->field_search = trim($config->Get("plugin", self::CONFIG_FIELD_SEARCH));
|
|
|
|
$ldap->field_username = trim($config->Get("plugin", self::CONFIG_FIELD_USERNAME));
|
|
|
|
$ldap->search_string = trim($config->Get("plugin", self::CONFIG_SEARCH_STRING));
|
|
|
|
$ldap->field_domain = trim($config->Get("plugin", self::CONFIG_FIELD_MAIL_DOMAIN));
|
2023-02-17 19:01:39 +08:00
|
|
|
$ldap->field_mail_address_additional_account = trim($config->Get("plugin", self::CONFIG_FIELD_MAIL_ADDRESS_ADDITIONAL_ACCOUNT));
|
2023-02-10 18:11:24 +08:00
|
|
|
$ldap->bool_overwrite_mail_address_main_account = $config->Get("plugin", self::CONFIG_BOOL_OVERWRITE_MAIL_ADDRESS_MAIN_ACCOUNT);
|
|
|
|
$ldap->field_mail_address_main_account = trim($config->Get("plugin", self::CONFIG_FIELD_MAIL_ADDRESS_MAIN_ACCOUNT));
|
2024-05-14 23:24:26 +08:00
|
|
|
$ldap->bool_overwrite_cryptkey = $config->Get("plugin", self::CONFIG_BOOL_OVERWRITE_CRYPTKEY);
|
2022-11-16 01:29:01 +08:00
|
|
|
|
|
|
|
return $ldap;
|
|
|
|
}
|
|
|
|
}
|