Example #1
0
 public function createEntity($data)
 {
     $entity = parent::createEntity($data);
     if ($entity) {
         $entity->set('assignedUserId', $this->getUser()->id);
         $this->getEntityManager()->saveEntity($entity);
     }
     return $entity;
 }
Example #2
0
 public function createEntity($data)
 {
     if (!empty($data['parentType']) && !empty($data['parentId'])) {
         $entity = $this->getEntityManager()->getEntity($data['parentType'], $data['parentId']);
         if ($entity) {
             if (!$this->getAcl()->check($entity, 'read')) {
                 throw new Forbidden();
             }
         }
     }
     return parent::createEntity($data);
 }
Example #3
0
 public function createEntity($data)
 {
     $newPassword = null;
     if (array_key_exists('password', $data)) {
         $newPassword = $data['password'];
         $data['password'] = $this->hashPassword($data['password']);
     }
     $user = parent::createEntity($data);
     if (!is_null($newPassword)) {
         $this->sendPassword($user, $newPassword);
     }
     return $user;
 }
Example #4
0
 public function createEntity($data)
 {
     $entity = parent::createEntity($data);
     if ($entity && $entity->get('status') == 'Sending') {
         $emailSender = $this->getMailSender();
         if (strtolower($this->getUser()->get('emailAddress')) == strtolower($entity->get('from'))) {
             $smtpParams = $this->getPreferences()->getSmtpParams();
             if ($smtpParams) {
                 $smtpParams['fromName'] = $this->getUser()->get('name');
                 $emailSender->useSmtp($smtpParams);
             }
         } else {
             if (!$this->getConfig()->get('outboundEmailIsShared')) {
                 throw new Error('Can not use system smtp. outboundEmailIsShared is false.');
             }
         }
         $emailSender->send($entity);
         $this->getEntityManager()->saveEntity($entity);
     }
     return $entity;
 }
Example #5
0
 public function createEntity($data)
 {
     $entity = parent::createEntity($data);
     if ($entity && $entity->get('status') == 'Sending') {
         $this->send($entity);
     }
     return $entity;
 }
Example #6
0
 public function createEntity($data)
 {
     $entity = parent::createEntity($data);
     $entity->clear('password');
     return $entity;
 }
Example #7
0
 public function createEntity($data)
 {
     $entity = parent::createEntity($data);
     return $entity;
 }
Example #8
0
 public function createEntity($data)
 {
     if (!$this->getUser()->isAdmin()) {
         $count = $this->getEntityManager()->getRepository('EmailAccount')->where(array('assignedUserId' => $this->getUser()->id))->count();
         if ($count >= $this->getConfig()->get('maxEmailAccountCount', \PHP_INT_MAX)) {
             throw new Forbidden();
         }
     }
     $entity = parent::createEntity($data);
     if ($entity) {
         if (!$this->getUser()->isAdmin()) {
             $entity->set('assignedUserId', $this->getUser()->id);
         }
         $this->getEntityManager()->saveEntity($entity);
     }
     return $entity;
 }
Example #9
0
 public function createEntity($data)
 {
     $newPassword = null;
     if (array_key_exists('password', $data)) {
         $newPassword = $data['password'];
         $data['password'] = $this->hashPassword($data['password']);
     }
     if (!$this->getUser()->get('isSuperAdmin')) {
         unset($data['isSuperAdmin']);
     }
     $user = parent::createEntity($data);
     if (!is_null($newPassword)) {
         if ($user->isActive()) {
             $this->sendPassword($user, $newPassword);
         }
     }
     return $user;
 }