[TYPO3-50-general] Security: Extend the Account Model

Julian Kleinhans typo3 at kj187.de
Mon Nov 22 21:42:40 CET 2010


Hey guys,

i will extend the F3\FLOW3\Security\Account Model with more informations 
like Realname, email, Paypal Account and so on..

My current solution is this:

i create a new Model in my Package

F3\MyPackage\Domain\Model\Account

This Model extends the basic model F3\FLOW3\Security\Account
Here i defined all the new information i need with his getter and setter.

The next step is to create a new AccountRepository thats extends the 
repository \F3\FLOW3\Security\AccountRepository

The constructor was changend to

public function __construct() {
	
	$this->addedObjects = new \SplObjectStorage();
	$this->removedObjects = new \SplObjectStorage();
	if ($this->objectType === NULL) {
		$this->objectType = str_replace(array('\\Repository\\', 'Repository'), 
array('\\Model\\', ''), $this->FLOW3_AOP_Proxy_getProxyTargetClassName());
	}
		
	$this->objectType = 'F3\MyPackage\Domain\Model\Account';
}	

To tell the Security Framework that he work with the new Model i created 
a Configuration/Objects.yaml with this content

F3\FLOW3\Security\Account:
   autowiring: on
   className: F3\Tutorials\Domain\Model\Account


Now, i create a new User like

$roles = array();
$roles[] = $this->objectManager->create('F3\FLOW3\Security\Policy\Role', 
'Administrator');
		
$account = $this->objectManager->create('F3\MyPacke\Domain\Model\Account');
$account->setAccountIdentifier('test');
$account->setName('Julian Kleinhans');
$account->setEmail('typo3 at kj187.de');
$account->setPaypal('xxx at kj187.de');
	 
$account->setCredentialsSource($this->hashService->generateSaltedMd5('test'));
$account->setAuthenticationProviderName('DefaultProvider');
$account->setRoles($roles);		
		
$this->accountRepository->add($account);



The user is created, but, i cant authentificate with this new user :-(
Any ideas or hints ?

cheers
Julian


More information about the TYPO3-project-5_0-general mailing list