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 ...@@ -74,21 +74,29 @@ class ReactivateUserHook implements \TYPO3\CMS\Backend\RecordList\RecordListGetT
*/ */
public function getDBlistQuery($table, $pageId, &$additionalWhereClause, &$selectedFieldsList, &$parentObject) 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') { if (($table === 'old_users') && $recoverUser['uid'] > 0 && $recoverUser['command'] === 'recoverOldUser') {
$this->oldUserRepository = $this->getUserRepository(OldUserRepository::class); $this->oldUserRepository = $this->getUserRepository(OldUserRepository::class);
$oldUser = $this->oldUserRepository->findByUid($recoverUser['uid']); $oldUser = $this->oldUserRepository->findByUid($recoverUser['uid']);
if ($oldUser && $this->recoverUser($oldUser)) { if ($oldUser) {
$this->oldUserRepository->remove($oldUser); if ($this->recoverUser($oldUser)) {
$this->persistenceManager->persistAll(); $this->oldUserRepository->remove($oldUser);
$this->addFlashMessage( $this->persistenceManager->persistAll();
'The user is created in LDAP', $this->addFlashMessage(
\TYPO3\CMS\Core\Messaging\FlashMessage::SUCCESS, 'The user is created in LDAP',
'Old User transfer' \TYPO3\CMS\Core\Messaging\FlashMessage::SUCCESS,
); 'Old User transfer'
$this->sendRecoveryMail($oldUser->getEmail(), $oldUser->getUsername()); );
$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 ...@@ -101,13 +109,20 @@ class ReactivateUserHook implements \TYPO3\CMS\Backend\RecordList\RecordListGetT
if ($feUser) { if ($feUser) {
if (GeneralUtility::validEmail($feUser->getEmail())) { if (GeneralUtility::validEmail($feUser->getEmail())) {
$ldapOperation = $this->objectManager->get(FeManagerHooks::class); $ldapOperation = $this->objectManager->get(FeManagerHooks::class);
$ldapOperation->createUser($feUser); if ($ldapOperation->createUser($feUser)) {
$this->sendRecoveryMail($feUser->getEmail(), $feUser->getUsername()); $this->sendRecoveryMail($feUser->getEmail(), $feUser->getUsername());
$this->addFlashMessage( $this->addFlashMessage(
'The user is created in LDAP', 'The user is created in LDAP',
\TYPO3\CMS\Core\Messaging\FlashMessage::SUCCESS, \TYPO3\CMS\Core\Messaging\FlashMessage::SUCCESS,
'LDAP Transfer' 'LDAP Transfer'
); );
} else {
$this->addFlashMessage(
'The user could not created in LDAP',
\TYPO3\CMS\Core\Messaging\FlashMessage::ERROR,
'Error in LDAP Transfer'
);
}
} else { } else {
$this->addFlashMessage( $this->addFlashMessage(
'This user has no valid mail', 'This user has no valid mail',
......
Supports Markdown
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