Commit e40b2da0 authored by Stefan Busemann's avatar Stefan Busemann
Browse files

[FEATURE] Add flashmessages for error operations

parent b98fd1af
......@@ -74,21 +74,29 @@ class ReactivateUserHook implements \TYPO3\CMS\Backend\RecordList\RecordListGetT
*/
public function getDBlistQuery($table, $pageId, &$additionalWhereClause, &$selectedFieldsList, &$parentObject)
{
$recoverUser = (int)GeneralUtility::_GP('web_list');
$recoverUser = GeneralUtility::_GP('web_list');
if (($table === 'old_users') && $recoverUser['uid'] > 0 && $recoverUser['command'] === 'recoverOldUser') {
$this->oldUserRepository = $this->getUserRepository(OldUserRepository::class);
$oldUser = $this->oldUserRepository->findByUid($recoverUser['uid']);
if ($oldUser && $this->recoverUser($oldUser)) {
$this->oldUserRepository->remove($oldUser);
$this->persistenceManager->persistAll();
$this->addFlashMessage(
'The user is created in LDAP',
\TYPO3\CMS\Core\Messaging\FlashMessage::SUCCESS,
'Old User transfer'
);
$this->sendRecoveryMail($oldUser->getEmail(), $oldUser->getUsername());
if ($oldUser) {
if ($this->recoverUser($oldUser)) {
$this->oldUserRepository->remove($oldUser);
$this->persistenceManager->persistAll();
$this->addFlashMessage(
'The user is created in LDAP',
\TYPO3\CMS\Core\Messaging\FlashMessage::SUCCESS,
'Old User transfer'
);
$this->sendRecoveryMail($oldUser->getEmail(), $oldUser->getUsername());
} else {
$this->addFlashMessage(
'The user could not created in LDAP',
\TYPO3\CMS\Core\Messaging\FlashMessage::ERROR,
'Error in LDAP Transfer / old user transfer'
);
}
}
}
......@@ -101,13 +109,20 @@ class ReactivateUserHook implements \TYPO3\CMS\Backend\RecordList\RecordListGetT
if ($feUser) {
if (GeneralUtility::validEmail($feUser->getEmail())) {
$ldapOperation = $this->objectManager->get(FeManagerHooks::class);
$ldapOperation->createUser($feUser);
$this->sendRecoveryMail($feUser->getEmail(), $feUser->getUsername());
$this->addFlashMessage(
'The user is created in LDAP',
\TYPO3\CMS\Core\Messaging\FlashMessage::SUCCESS,
'LDAP Transfer'
);
if ($ldapOperation->createUser($feUser)) {
$this->sendRecoveryMail($feUser->getEmail(), $feUser->getUsername());
$this->addFlashMessage(
'The user is created in LDAP',
\TYPO3\CMS\Core\Messaging\FlashMessage::SUCCESS,
'LDAP Transfer'
);
} else {
$this->addFlashMessage(
'The user could not created in LDAP',
\TYPO3\CMS\Core\Messaging\FlashMessage::ERROR,
'Error in LDAP Transfer'
);
}
} else {
$this->addFlashMessage(
'This user has no valid mail',
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment