Example #1
0
 /**
  * Prefix method to createAction(): Create must be confirmed by Admin or User
  *
  * @param User $user
  * @return void
  */
 public function createRequest(\Gigabonus\Gbfemanager\Domain\Model\User $user)
 {
     $this->userRepository->add($user);
     $this->persistenceManager->persistAll();
     $this->addFlashMessage(LocalizationUtility::translate('create'));
     LogUtility::log(Log::STATUS_NEWREGISTRATION, $user);
     if (!empty($this->settings['new']['confirmByUser'])) {
         $this->createUserConfirmationRequest($user);
     }
     $this->finalCreate($user, 'new', 'createStatus');
 }
 /**
  * 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');
     }
 }
Example #3
0
 /**
  * Check if user is authenticated
  *
  * @param User $user
  * @param int $uid Given fe_users uid
  * @return void
  */
 protected function testSpoof($user, $uid)
 {
     if ($user->getUid() !== (int) $uid && $uid > 0) {
         LogUtility::log(Log::STATUS_PROFILEUPDATEREFUSEDSECURITY, $user);
         $this->addFlashMessage(LocalizationUtility::translateByState(Log::STATUS_PROFILEUPDATEREFUSEDSECURITY), '', FlashMessage::ERROR);
         $this->forward('edit');
     }
 }
Example #4
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;
 }
Example #5
0
 /**
  * action delete
  *
  * @param User $user
  * @return void
  */
 public function deleteAction(User $user)
 {
     LogUtility::log(Log::STATUS_PROFILEDELETE, $user);
     $this->addFlashMessage(LocalizationUtility::translateByState(Log::STATUS_PROFILEDELETE));
     $this->userRepository->remove($user);
     $this->redirectByAction('delete');
     $this->redirect('edit');
 }