示例#1
0
 /**
  * Stores the given keypair under the returned UUID.
  *
  * @param \TYPO3\FLOW3\Security\Cryptography\OpenSslRsaKey $publicKey The public key
  * @param \TYPO3\FLOW3\Security\Cryptography\OpenSslRsaKey $privateKey The private key
  * @param boolean $usedForPasswords TRUE if this keypair should be used to encrypt passwords (then decryption won't be allowed!).
  * @return string The UUID used for storing
  */
 private function storeKeyPair($publicKey, $privateKey, $usedForPasswords)
 {
     $keyPairUUID = str_replace('-', '_', \TYPO3\FLOW3\Utility\Algorithms::generateUUID());
     $keyPair = array();
     $keyPair['publicKey'] = $publicKey;
     $keyPair['privateKey'] = $privateKey;
     $keyPair['usedForPasswords'] = $usedForPasswords;
     $this->keys[$keyPairUUID] = $keyPair;
     $this->saveKeysOnShutdown = TRUE;
     return $keyPairUUID;
 }
 /**
  * Create a user for administration
  *
  * The user will get the SystemAdministrator role to manage all data and users.
  *
  * @param string $emailAddress E-mail address (account identifier) of the new user
  * @return void
  */
 public function createUserCommand($emailAddress)
 {
     $uuid = \TYPO3\FLOW3\Utility\Algorithms::generateUUID();
     $password = substr($uuid, 0, 10);
     $user = new \Planetflow3\Domain\Model\User();
     $user->setEmailAddress($emailAddress);
     $user->setPassword($password);
     $user->setRole('SystemAdministrator');
     $this->userRepository->add($user);
     echo "Password: {$password}" . PHP_EOL;
 }
示例#3
0
 /**
  * After returning advice, making sure we have an UUID for each and every entity.
  *
  * @param \TYPO3\FLOW3\Aop\JoinPointInterface $joinPoint The current join point
  * @return void
  * @FLOW3\Before("TYPO3\FLOW3\Persistence\Aspect\PersistenceMagicAspect->isEntity && method(.*->(__construct|__clone)())")
  */
 public function generateUuid(\TYPO3\FLOW3\Aop\JoinPointInterface $joinPoint)
 {
     $proxy = $joinPoint->getProxy();
     \TYPO3\FLOW3\Reflection\ObjectAccess::setProperty($proxy, 'FLOW3_Persistence_Identifier', \TYPO3\FLOW3\Utility\Algorithms::generateUUID(), TRUE);
     $this->persistenceManager->registerNewObject($proxy);
 }