Exemple #1
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);
 }
Exemple #2
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;
 }
Exemple #3
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;
 }
Exemple #4
0
 public function createEntity($data)
 {
     $entity = parent::createEntity($data);
     return $entity;
 }
Exemple #5
0
 public function createEntity($data)
 {
     $entity = parent::createEntity($data);
     if ($entity && $entity->get('status') == 'Sending') {
         $this->send($entity);
     }
     return $entity;
 }