First of all in app controller we need to gather all exists actions.
class AppController extends Controller {
function __construct()
{
if (isset($this->othAuthOpen)) {
$othOpen=array_map(’strtolower’,$this->othAuthOpen);
} else {
$othOpen=array();
}
$protected = array( ‘object’, low($this->name. ‘Controller’), ‘controller’, ‘appcontroller’,
‘tostring’, ‘requestaction’, ‘log’, ‘cakeerror’, ‘constructclasses’, ‘redirect’, ’set’, ’setaction’,
‘validate’, ‘validateerrors’, ‘render’, ‘referer’, ‘flash’, ‘flashout’, ‘generatefieldnames’,
‘postconditions’, ‘cleanupfields’, ‘beforefilter’, ‘beforerender’, ‘afterfilter’, ‘disablecache’, ‘paginate’);
$protected=am($protected,array_map(’strtolower’,get_class_methods(‘AppController’)));
$controllerName = Inflector::camelize($this->name);
$controllerPath = Inflector::underscore($controllerName);
$methList=array();
$methods=get_class_methods($controllerName.‘Controller’);
if (is_array($methods)) {
foreach($methods as $method) {
if ($method{0} != ‘_’ && !in_array(low($method), $othOpen) && !in_array(low($method), am($protected, array(‘delete’, ”)))) {
$methList[]=$method;
}
}
}
//debug($methList);
$this->othAuthRestrictions=$methList;
}
}
After it we just need to declare in controller list of opened methods:
var $othAuthOpen = array(‘login’, ‘logout’, ‘forget’ , ‘register’, ‘confirm’, ‘noaccess’);
August 30, 2007 at 2:36 pm
hey SkieDr , many thanks for this (spasseba?)
September 3, 2007 at 11:46 am
Sorry, I lost it when make copy from my application