Open cdvrooman opened 14 years ago
I did some poking around in /cake/libs/model/model.php and in the _findList() function, I found this: if (!isset($query['recursive']) || $query['recursive'] === null) { $query['recursive'] = -1; } Which could definitely be screwing things up if 'recursive' is not being explicitly set by Permissionable', perhaps only when the find is of the 'list' variety?
On a related note, I'm running into a similar problem when trying to save something to the Group table, where first the ability to write to the table is verified. The SQL is appearing as:
SELECT COUNT() AS count
, GroupPermission
. FROM groups
AS Group
WHERE Group
.name
= 'Root' AND Group
.id
!= ' ... uuid ...'
In \models\behaviors\permissionable.php I tried adding 'recursive' => 1 to hasPermissions() here: $perm = $Model->{$alias}->find('count', array( ... )); but it didn't have any effect.
I also tried modifying $queryData['recursive'] directly in the beforeFind() function, but that caused my browser to be unable to resolve the page.
Two alternatives are:
Of course in the second case you would have to use Set::extract() or something similar on the results to leave only the 'user_id' => 'user_name'.
Any real solution to this? The same issue crops up when attempting to use the tree behavior.
I'm trying to do this:
and my SQL is coming out like this:
In permisssionable/models/behaviors/permissionable.php, when I debugged the $Model before and after this line of the beforeFind() function:
the $Model did not and then did have a 'hasOne' binding to GroupPermission however for some reason it isn't being applied to the ->find('list') query.
I tried to do a $this->Group->find('all'); and that did work as expected.
I'm calling $this->Group from my users_controller where I have:
var $uses = array('User', 'Group');
I have User HABTM Group and Group HABTM User defined in the appropriate model files.