Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The render levels failure, Forward flow to controller #17

Closed
dreamsxin opened this issue Jun 27, 2012 · 7 comments
Closed

The render levels failure, Forward flow to controller #17

dreamsxin opened this issue Jun 27, 2012 · 7 comments

Comments

@dreamsxin
Copy link
Contributor

_getAcl(); $user = $this->_getUser(); if (!$acl->isAllowed($user["Profile"], $controllerName, $actionName)) { $this->_forward("welcome/index"); return false; } } ``` view->setRenderLevel(Phalcon_View::LEVEL_ACTION_VIEW); } ``` }
@phalcon
Copy link
Collaborator

phalcon commented Jun 27, 2012

hi dreamsxin, could you tell us what exactly is the problem you're getting?

@dreamsxin
Copy link
Contributor Author

when use "forward" request, the set Render Level will failure.

@dreamsxin
Copy link
Contributor Author

By the way, whether it whill provide "RESTFul Controller" and "OAuth Controller", and router can set controller directory

@dreamsxin
Copy link
Contributor Author

ps: postgresql datatype change to php type, for example, array and boolean

@phalcon
Copy link
Collaborator

phalcon commented Jun 29, 2012

I think this could work:

protected function beforeDispatch($controllerName, $actionName) {
$acl = $this->_getAcl();
$user = $this->_getUser();

if($controllerName!='welcome'){
   if (!$acl->isAllowed($user["Profile"], $controllerName, $actionName)) {
    $this->_forward("welcome/index");
      return false;
   }
}

}

@dreamsxin
Copy link
Contributor Author

right, "_forward" do not run "welcome/index" action, only render the view file.

@phalcon
Copy link
Collaborator

phalcon commented Jun 29, 2012

yep, with the if($controllerName!='welcome'){ you'll avoid to pass the controller to the Acl isAllowed method :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants