[Flow] Policy and Command Controller

Bastian Waidelich bastian at typo3.org
Wed Dec 17 10:41:19 CET 2014


Beat Guggisberg wrote:

Hi Beat,

> I startet yesterday to create Policy settings.
> That works great for the webfrontend and blocks modifications for users without permission.
> Now i have a Command Controller that modifies some objects where the policy is active.
> When ever i run a such a command i get this:
> (#27 Efkk\System\Domain\Model\Druckauftrag::setBenutzername() is where the policy is active)
>
> Uncaught Exception: TYPO3\Flow\Exception
>
> Message
>    The security Context cannot be initialized yet. [...]

That's probably related to https://forge.typo3.org/issues/48419

IMO we should disable authorization for CLI commands (as suggested in 
the tickets).. In the meantime you can probably work around this 
yourself like that:


$this->securityContext->withoutAuthorizationChecks(function(Druckauftrag 
$druckauftrag) use ($) {
	$druckauftrag->setBenutzername('xyz');
});

HTH

-- 
Bastian Waidelich


More information about the Flow mailing list