Allow access to a specific action (ACO)

/ Published in: PHP
Save to your folder(s)

Another common use of Auth component variables is to allow access to certain methods without the user being logged in (by default Auth restricts access to every action except the login and logout methods).

Copy this code and paste it in your HTML
  1. //For example if we want to allow all users access to the index and view methods ( but not //any other), we would do the following (inside a controller)
  3. function beforeFilter() {
  4. $this->Auth->allow('index','view');
  5. }


Report this snippet


RSS Icon Subscribe to comments

You need to login to post a comment.