[Flow] how to make active connection to initialize roles for user registration

Rémy DANIEL dogawaf at no-log.org
Tue Apr 15 14:44:45 CEST 2014


Hi,

I had this strange behaviour yesterday.
I had to do a migration (doctrine:migrate) to see the new role synchronized
between policy.yaml and the database...


--
Rémy


2014-04-15 12:56 GMT+02:00 Rocky <rockysynergy at gmail.com>:

> Hi,
>
> I am making registration form for my TYPO3 Flow application.
> In Policy.yaml I have:
> roles:
>   subscriber: []
>
> In the RegisterController's I have below code:
> public function createAction($identifier, $pass, $pass2) {
>       $roles = array('Package.Key:subscriber');
>             ......
>       $account = $this->accountFactory->createAccountWithPassword($name,
> $pass, $roles);
>       $this->accountRepository->add($account);
>       $this->flashMessageContainer->addMessage(new
> \TYPO3\Flow\Error\Error('Account created. Please login.'));
>       $this->redirect('index');
> }
>
> But I got Exception saying #1353085860: The role with identifier
> "Package.Key:subscriber" is unknown
>
> It seems when creating the account, PolicyService will skip
> initializeRolesFromPolicy if there is no active database connection.
>
> How can I set up the active database for roleRepository to make the role I
> defined in policy.yaml get synchronized into the database when registering
> the user?
> _______________________________________________
> Flow mailing list
> Flow at lists.typo3.org
> http://lists.typo3.org/cgi-bin/mailman/listinfo/flow
>


More information about the Flow mailing list