I started writing an app today using the "stable" build of cake php.
I encountered some problems with dbACL, it seems there is a bug in both
the __getObject() and check() functions. I couldn't figure out how to
submit a bug report (although I admit it is late and I didn't try too
hard). I am not sure if this is the proper way to fix the problem but
this is what I have done and it seems to work.
Anyway, Here is my patch:
-Jon Kuhn
---
cake_1.0.1.2708/cake/libs/controller/components/dbacl/db_acl.php
2006-04-29
17:51:30.000000000 -0400
+++ cake/libs/controller/components/dbacl/db_acl.php 2006-05-08
01:56:35.000000000 -0400
@@ -74,8 +74,11 @@
}
$permKeys = $this->_getAcoKeys($Perms->loadInfo());
- $aroPath = $Aro->getPath($aro);
- $tmpAcoPath = $Aco->getPath($aco);
+ //EDIT: Jon Kuhn
+ $aro_id = is_null($aro->data['Aro']['user_id']) ? 'alias' :
'user_id';
+ $aroPath = $Aro->getPath($aro_id);
+ $aco_id = is_null($aro->data['Aco']['user_id']) ? 'alias' :
'object_id';
+ $tmpAcoPath = $Aco->getPath($aco_id);
$acoPath = array();
if($action != '*' && !in_array('_' . $action, $permKeys))
@@ -265,20 +268,31 @@
trigger_error('Null id provided in DB_ACL::get'.$object,
E_USER_WARNING);
return null;
}
- $obj = new $obj;
+
+ //EDIT: Jon Kuhn
+ //$obj = new $obj;
+ $obj = new $object;
if (is_numeric($id))
{
- $conditions = array('Aco.user_id' => $id);
+ //EDIT: Jon Kuhn
+ //$conditions = array('Aco.user_id' => $id);
+ $id_name = 'user_id';
+ if ($object == 'Aco')
+ $id_name = 'object_id';
+ $conditions = array($object.'.'.$id_name => $id);
}
else
{
- $conditions = array('Aco.alias' => $id);
+ //EDIT: Jon Kuhn
+ //$conditions = array('Aco.alias' => $id);
+ $conditions = array($object.'.alias' => $id);
}
$tmp = $obj->find($conditions);
- $aco->setId($tmp['Aco']['id']);
- return $aco;
+ $obj->$id = $tmp[$object]['id'];
+ $obj->data = $tmp;
+ return $obj;
}
/**
@@ -334,4 +348,4 @@
}
-?>
\ No newline at end of file
+?>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake
PHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~----------~----~----~----~------~----~------~--~---