示例#1
0
 /**
  * Status action: Admin refused profile creation (normal or silent)
  *
  * @param User $user
  * @param $hash
  * @param $status
  * @return bool allow further functions
  * @throws IllegalObjectTypeException
  */
 protected function statusAdminConfirmationRefused(User $user, $hash, $status)
 {
     if (HashUtility::validHash($hash, $user)) {
         LogUtility::log(Log::STATUS_REGISTRATIONREFUSEDADMIN, $user);
         $this->addFlashMessage(LocalizationUtility::translate('createProfileDeleted'));
         if ($status !== 'adminConfirmationRefusedSilent') {
             $this->sendMailService->send('CreateUserNotifyRefused', StringUtility::makeEmailArray($user->getEmail(), $user->getFirstName() . ' ' . $user->getLastName()), ['*****@*****.**' => 'Sender Name'], 'Your profile was refused', ['user' => $user], $this->config['new.']['email.']['createUserNotifyRefused.']);
         }
         $this->userRepository->remove($user);
     } else {
         $this->addFlashMessage(LocalizationUtility::translate('createFailedProfile'), '', FlashMessage::ERROR);
         return false;
     }
     return true;
 }
示例#2
0
 /**
  * action delete
  *
  * @param int $user User UID
  * @param string $hash
  * @return void
  */
 public function deleteAction($user, $hash = null)
 {
     $user = $this->userRepository->findByUid($user);
     if (HashUtility::validHash($hash, $user)) {
         LogUtility::log(Log::STATUS_PROFILEDELETE, $user);
         $this->addFlashMessage(LocalizationUtility::translateByState(Log::STATUS_INVITATIONPROFILEDELETEDUSER));
         // send notify email to admin
         if ($this->settings['invitation']['notifyAdminStep1']) {
             $this->sendMailService->send('invitationRefused', StringUtility::makeEmailArray($this->settings['invitation']['notifyAdminStep1'], $this->settings['invitation']['email']['invitationRefused']['receiver']['name']['value']), StringUtility::makeEmailArray($user->getEmail(), $user->getUsername()), 'Profile deleted from User after invitation - Step 1', ['user' => $user, 'settings' => $this->settings], $this->config['invitation.']['email.']['invitationRefused.']);
         }
         $this->userRepository->remove($user);
         $this->redirectByAction('invitation', 'redirectDelete');
         $this->redirect('status');
     } else {
         $this->addFlashMessage(LocalizationUtility::translateByState(Log::STATUS_INVITATIONHASHERROR), '', FlashMessage::ERROR);
         $this->redirect('status');
     }
 }
示例#3
0
 /**
  * Update if hash is ok
  *
  * @param User $user User object
  * @param string $hash
  * @param string $status could be "confirm", "refuse", "silentRefuse"
  * @return void
  */
 public function confirmUpdateRequestAction(User $user, $hash, $status = 'confirm')
 {
     $this->view->assign('user', $user);
     if (!HashUtility::validHash($hash, $user) || !$user->getTxFemanagerChangerequest()) {
         $this->addFlashMessage(LocalizationUtility::translate('updateFailedProfile'), '', FlashMessage::ERROR);
         return;
     }
     switch ($status) {
         case 'confirm':
             $this->statusConfirm($user);
             break;
         case 'refuse':
             $this->statusRefuse($user);
             break;
         case 'silentRefuse':
             LogUtility::log(Log::STATUS_PROFILEUPDATEREFUSEDADMIN, $user);
             $this->addFlashMessage(LocalizationUtility::translateByState(Log::STATUS_PROFILEUPDATEREFUSEDADMIN));
             break;
         default:
     }
     $user->setTxFemanagerChangerequest('');
     $this->userRepository->update($user);
     $this->signalSlotDispatcher->dispatch(__CLASS__, __FUNCTION__ . 'AfterPersist', [$user, $hash, $status, $this]);
 }