/**
  * @inheritdoc
  */
 public function createRightTo($action, $object)
 {
     Assertion::string($action);
     Assertion::string($object);
     if ($this->existsRight($action, $object)) {
         throw new RightAlreadyExistsException();
     }
     $ormRight = new ORMRight();
     $ormRight->setAction($action);
     $ormRight->setObject($object);
     $ormRight->save($this->transactionManager->getWriteConnectionOfCurrentTransaction(ORMRightTableMap::DATABASE_NAME));
     return $this->ormRightToRight($ormRight);
 }
 /**
  * @inheritdoc
  */
 public function createUser($identifier, $passwordHash)
 {
     Assertion::string($identifier);
     Assertion::string($passwordHash);
     if ($this->existsUserByIdentifier($identifier)) {
         throw new UserAlreadyExistsException();
     }
     $ormUser = new ORMUser();
     $ormUser->setIdentifier($identifier);
     $ormUser->setPasswordHash($passwordHash);
     $ormUser->save($this->transactionManager->getWriteConnectionOfCurrentTransaction(ORMUserTableMap::DATABASE_NAME));
     return $this->ormUserToUser($ormUser);
 }
 public function createUserRight($userId, $rightId, $forObject, $withId)
 {
     //Pre-Assertions and exists-checks are asserted to be done in existsUserRight
     if ($this->existsUserRight($userId, $rightId, $forObject, $withId)) {
         throw new UserRightAlreadyExistsException();
     }
     $ormUserRight = new ORMUserRight();
     $ormUserRight->setUserId($userId);
     $ormUserRight->setRightId($rightId);
     $ormUserRight->setForObject($forObject);
     $ormUserRight->setWithId($withId);
     $ormUserRight->save($this->transactionManager->getWriteConnectionOfCurrentTransaction(ORMUserRightTableMap::DATABASE_NAME));
     return $this->ormUserRightToUserRight($ormUserRight);
 }