Works now with additional accounts:

The mail address is correctly set by ldap value.
But plugin needs rework: it makes no sense to let the user use the non
existing mail address "username@domain" used
only by SnappyMail. Plugin should always use a looked up mail address
This commit is contained in:
cm-schl 2023-02-15 17:57:59 +01:00
parent aa03e84c79
commit 9cfe164633
2 changed files with 44 additions and 7 deletions

View file

@ -32,6 +32,8 @@ class LdapMailAccountsPlugin extends AbstractPlugin
public function Init(): void
{
$this->addHook("login.success", 'AddAdditionalLdapMailAccounts');
$this->addHook('imap.before-login', 'MapImapCredentialsByLDAP');
$this->addHook('smtp.before-login', 'MapSmtpCredentialsByLDAP');
}
// Function gets called by RainLoop/Actions/User.php
@ -50,6 +52,32 @@ class LdapMailAccountsPlugin extends AbstractPlugin
$oldapMailAccounts->AddLdapMailAccounts($oAccount);
}
// Function gets called by Account.php
/**
* Overwrite the mailaddress of the account with the one found in LDAP by this plugin at IMAP login
*
* @param Account $oAccount
* @param ImapClient $oImapClient
* @param \MailSo\Imap\Settings $oSettings
*/
public function MapImapCredentialsByLDAP(\RainLoop\Model\Account $oAccount, \MailSo\Imap\ImapClient $oImapClient, \MailSo\Imap\Settings $oSettings)
{
//$oSettings->Login = $oAccount->IncLogin();
}
// Function gets called by Account.php
/**
* Overwrite the mailaddress of the account with the one found in LDAP by this plugin at SMTP login
*
* @param Account $oAccount
* @param SmtpClient $oSmtpClient
* @param \MailSo\Smtp\Settings $oSettings
*/
public function MapSmtpCredentialsByLDAP(\RainLoop\Model\Account $oAccount, \MailSo\Smtp\SmtpClient $oSmtpClient, \MailSo\Smtp\Settings $oSettings)
{
}
/**
* Defines the content of the plugin configuration page inside the Admin Panel of SnappyMail
*/