femanager icon indicating copy to clipboard operation
femanager copied to clipboard

ForwardResponse in allowedUserForInvitationNewAndCreate doesn't work.

Open maciejszklarczyk opened this issue 2 years ago • 0 comments

If invitation plugin is restricted for specific usergroup in settings.invitation.allowedUserGroups and non-logged user enters the page $this->allowedUserForInvitationNewAndCreate(); is fired and it returns new ForwardResponse('status'); but no response is happenning. NewAction just continue executing and shows form with FlashMessage that its restricted.

What i've already checked is that ForwardResponse won't work properly if its called in function which is not an action. For example:

protected function quickForward(){
    return new ForwardResponse('second');
}

public function firstAction(){
    $this->quickForward();
    return $this->htmlResponse();
}

public function secondAction(){
    die;
}

This code will still render htmlResponse instead of just die.

In InvitationController if i change $this->allowedUserForInvitationNewAndCreate(); to return false instead of ForwardResponse and then change newAction to:

    public function newAction(): ResponseInterface
    {
        $allowed = $this->allowedUserForInvitationNewAndCreate();
        $this->view->assign('allUserGroups', $this->allUserGroups);
        $this->assignForAll();
        if ($allowed) {
            return $this->htmlResponse();
        } else {
            return new ForwardResponse('status');
        }
    }

everything works flawlessly.

I've checked that on different project with different extensions and return of ForwardResponse from outside action just wont work for me.

Typo3 ver is 11.5.24 Femanager ver is 7.1.0

maciejszklarczyk avatar Mar 10 '23 15:03 maciejszklarczyk