Wednesday, October 26, 2011

Acl and Cakephp 2.0

I followed the "Simple Acl controlled Application" tutorial on the
official site (and done a lot of acl controlled apps in cake 1.3); but
when i tried to create Acos, using AclExtras i got a mysql error:

SQLSTATE[42000]: Syntax error or access violation: 1064 You have an
error in your SQL syntax; check the manual that corresponds to your
MySQL server version for the right syntax to use near 'node' at line 1

i tried to fix it but the only thing i've found is that:

$node = $this->Aco->node($path);

is handled by:

public function __call($method, $params) {
$result = $this->Behaviors->dispatchMethod($this, $method, $params);
if ($result !== array('unhandled')) {
return $result;
}
$return = $this->getDataSource()->query($method, $params, $this);
return $return;
}

that calls:

public function dispatchMethod($model, $method, $params = array(),
$strict = false) {
$method = $this->hasMethod($method, true);

if ($strict && empty($method)) {
trigger_error(__d('cake_dev', "BehaviorCollection::dispatchMethod()
- Method %s not found in any attached behavior", $method),
E_USER_WARNING);
return null;
}
if (empty($method)) {
return array('unhandled');
}
if (count($method) === 3) {
array_unshift($params, $method[2]);
unset($method[2]);
}
return call_user_func_array(
array($this->_loaded[$method[0]], $method[1]),
array_merge(array(&$model), $params)
);
}

that finally returns "array('unhandled');", because hasMethod() fails.

After that i tried to build my Acos from scrach in a test environment,
bypassing that method ($this->Aco->node($path)). But when i try to
check permissions i get:

Call to a member function schema() on a non-object in Cakephp-2.0.0/
lib/Cake/Controller/Component/AclComponent.php on line 298

I can't figurate out if this is a bug or something i did wrong.

--
Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org
Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php

No comments: