[TYPO3-mvc] initializeAction and forward to a specific view
Steffen Ritter
info at rs-websystems.de
Tue Aug 31 12:43:28 CEST 2010
Am 31.08.2010 10:33, schrieb Daniel Dimitrov:
> Hey Guys,
> In my controller I'm checking if the user is logged in or not and I want
> to redirect him to the same controller, but in another action.
>
> I thought that this would be an easy task - just check if the user has
> the rights to view the resource in the initializeAction() function and
> redirect him
> to public function youDontHavePermissions().
>
> Now the problem that I encountered is the following
> if I do the check in initializeAction and use forward or redirect =>
> then the controller is called over and over again till either firefox or
> extbase kill the action.
>
> Is there any method that I can use in initializeAction to redirect to a
> specific view?
>
> Kind Regards,
> Daniel
you should use initializeProtectedAction, when the the secured action is
called protectedAction
or:
public function callActionMethod() {
if($this->actionMethodName == 'protectedAction' && notAllowed($myUser)) {
$this->actionMethodName = 'anotherAction';
}
parent::callActionMethod();
}
The first one is better, the second one is needed if you like to "throw
an error" or validate request arguments which are not present of an
object (like double passwords)
regards
Steffen
More information about the TYPO3-project-typo3v4mvc
mailing list