Hi

Could you please help me with the following question?

I have installed Auth and Acl. I create a new user User1 who is in Group1 
(who has aro id 10, for example). There is automatically an Aro created for 
this user with the Aros table with right is, parent_id, foreign_id, etc... 
Parent_id is rightfully set to 10.

Then, when this user logs for the first time, the parent_id of the Aro of 
this user is deleted. So, not possible to log, as rights are inherited, and 
this creates a redirect loop... 
If after this first log, i change the parent_id in aro table for this User1, 
then the next time the User1 logs, the login works and the parent_id in 
Aros  table is not deleted.


I really can't find the reason. So far I have tried to trace and log, to 
find out where this query comes from. Here is the log of all the queries 
with trace():
2011-10-07 11:16:37 Sql: SELECT `User`.`id`, `User`.`active`, 
`User`.`group_id`, `User`.`username`, `User`.`password`, `User`.`firstname`, 
`User`.`lastname`, `User`.`email`, `User`.`company`, `User`.`redirect`, 
`User`.`loggedin`, `User`.`last_login`, `User`.`last_logout`, 
`User`.`created`, `User`.`modified`, `Group`.`id`, `Group`.`parent_id`, 
`Group`.`name`, `Group`.`redirect`, `Group`.`user_count`, `Group`.`created`, 
`Group`.`modified` FROM `da_users` AS `User` LEFT JOIN `da_groups` AS 
`Group` ON (`User`.`group_id` = `Group`.`id`)  WHERE `User`.`username` = 
'test8' AND `User`.`password` = 
'da9ea477e699c7d63be58504e6d6a99f32513a85'    LIMIT 1
2011-10-07 11:16:37 Sql: SELECT COUNT(*) AS `count` FROM `da_users` AS 
`User`   WHERE `User`.`id` = 31   
2011-10-07 11:16:37 Sql: SELECT COUNT(*) AS `count` FROM `da_users` AS 
`User`   WHERE `User`.`id` = 31   
2011-10-07 11:16:37 Sql: TRACE :  
DboMysqlBase::update() - CORE\cake\libs\model\datasources\dbo\dbo_mysql.php, 
line 195
Model::save() - CORE\cake\libs\model\model.php, line 1327
AppController::beforeFilter() - APP\app_controller.php, line 22
UsersController::beforeFilter() - APP\controllers\users_controller.php, line 
15
Controller::startupProcess() - CORE\cake\libs\controller\controller.php, 
line 522
Dispatcher::_invoke() - CORE\cake\dispatcher.php, line 187
Dispatcher::dispatch() - CORE\cake\dispatcher.php, line 171
[main] - APP\webroot\index.php, line 83
2011-10-07 11:16:37 Sql: update dbo_mysql : UPDATE `da_users` SET `id` = 31, 
`last_login` = '2011:10:07 11:16:37', `loggedin` = 1, `modified` = 
'2011-10-07 11:16:37'  WHERE `da_users`.`id` = 31
2011-10-07 11:16:37 Sql: SELECT COUNT(*) AS `count` FROM `da_users` AS 
`User`   WHERE `User`.`group_id` = 5   
2011-10-07 11:16:37 Sql: TRACE :  
DboMysqlBase::update() - CORE\cake\libs\model\datasources\dbo\dbo_mysql.php, 
line 195
Model::updateAll() - CORE\cake\libs\model\model.php, line 1796
Model::updateCounterCache() - CORE\cake\libs\model\model.php, line 1519
Model::save() - CORE\cake\libs\model\model.php, line 1350
AppController::beforeFilter() - APP\app_controller.php, line 22
UsersController::beforeFilter() - APP\controllers\users_controller.php, line 
15
Controller::startupProcess() - CORE\cake\libs\controller\controller.php, 
line 522
Dispatcher::_invoke() - CORE\cake\dispatcher.php, line 187
Dispatcher::dispatch() - CORE\cake\dispatcher.php, line 171
[main] - APP\webroot\index.php, line 83
2011-10-07 11:16:37 Sql: update dbo_mysql : UPDATE `da_groups` AS `Group`  
SET `Group`.`user_count` = 8  WHERE `Group`.`id` = 5
2011-10-07 11:16:37 Sql: aftersave in modl/behaviors/acl.php line 96 
debug($parent) : 
2011-10-07 11:16:37 Sql: SELECT `Aro`.`id`, `Aro`.`parent_id`, 
`Aro`.`model`, `Aro`.`foreign_key`, `Aro`.`alias` FROM `da_aros` AS `Aro` 
LEFT JOIN `da_aros` AS `Aro0` ON (`Aro`.`lft` <= `Aro0`.`lft` AND 
`Aro`.`rght` >= `Aro0`.`rght`)  WHERE `Aro0`.`model` = 'User' AND 
`Aro0`.`foreign_key` = 31   ORDER BY `Aro`.`lft` DESC 
2011-10-07 11:16:37 Sql: SELECT COUNT(*) AS `count` FROM `da_aros` AS 
`Aro`   WHERE `Aro`.`id` = 39   
2011-10-07 11:16:37 Sql: SELECT `Aro`.`parent_id` FROM `da_aros` AS `Aro`   
WHERE `Aro`.`id` = 39    LIMIT 1
2011-10-07 11:16:37 Sql: SELECT COUNT(*) AS `count` FROM `da_aros` AS 
`Aro`   WHERE `Aro`.`id` = 39   
2011-10-07 11:16:37 Sql: TRACE:
DboMysqlBase::update() - CORE\cake\libs\model\datasources\dbo\dbo_mysql.php, 
line 195
Model::save() - CORE\cake\libs\model\model.php, line 1327
AclBehavior::afterSave() - CORE\cake\libs\model\behaviors\acl.php, line 107
ModelBehavior::dispatchMethod() - CORE\cake\libs\model\model_behavior.php, 
line 171
BehaviorCollection::trigger() - CORE\cake\libs\model\model_behavior.php, 
line 494
Model::save() - CORE\cake\libs\model\model.php, line 1363
AppController::beforeFilter() - APP\app_controller.php, line 22
UsersController::beforeFilter() - APP\controllers\users_controller.php, line 
15
Controller::startupProcess() - CORE\cake\libs\controller\controller.php, 
line 522
Dispatcher::_invoke() - CORE\cake\dispatcher.php, line 187
Dispatcher::dispatch() - CORE\cake\dispatcher.php, line 171
[main] - APP\webroot\index.php, line 83
 

*AND HERE IT COMES:*

*2011-10-07 11:16:37 Sql: update in dbo_mysql : UPDATE `da_aros` SET 
`parent_id` = NULL, `model` = 'User', `foreign_key` = 31, `id` = 39, 
`modified` = '2011-10-07 11:16:37'  WHERE `da_aros`.`id` = 39*

2011-10-07 11:16:37 Sql: UPDATE `da_aros` SET `parent_id` = NULL, `model` = 
'User', `foreign_key` = 31, `id` = 39, `modified` = '2011-10-07 11:16:37'  
WHERE `da_aros`.`id` = 39
2011-10-07 11:16:37 Sql: SELECT `Aro`.`id`, `Aro`.`parent_id`, `Aro`.`lft`, 
`Aro`.`rght` FROM `da_aros` AS `Aro`   WHERE 1 = 1 AND `Aro`.`id` = 39    
LIMIT 1
2011-10-07 11:16:37 Sql: SELECT MAX(`Aro`.`rght`) AS `rght` FROM `da_aros` 
AS `Aro`   WHERE 1 = 1    LIMIT 1
2011-10-07 11:16:37 Sql: DboMysqlBase::update() - 
CORE\cake\libs\model\datasources\dbo\dbo_mysql.php, line 195
Model::updateAll() - CORE\cake\libs\model\model.php, line 1796
TreeBehavior::__sync() - CORE\cake\libs\model\behaviors\tree.php, line 974
TreeBehavior::__sync() - CORE\cake\libs\model\behaviors\tree.php, line 962
TreeBehavior::_setParent() - CORE\cake\libs\model\behaviors\tree.php, line 
843
TreeBehavior::afterSave() - CORE\cake\libs\model\behaviors\tree.php, line 95
ModelBehavior::dispatchMethod() - CORE\cake\libs\model\model_behavior.php, 
line 171
BehaviorCollection::trigger() - CORE\cake\libs\model\model_behavior.php, 
line 494
Model::save() - CORE\cake\libs\model\model.php, line 1363
AclBehavior::afterSave() - CORE\cake\libs\model\behaviors\acl.php, line 107
ModelBehavior::dispatchMethod() - CORE\cake\libs\model\model_behavior.php, 
line 171
BehaviorCollection::trigger() - CORE\cake\libs\model\model_behavior.php, 
line 494
Model::save() - CORE\cake\libs\model\model.php, line 1363
AppController::beforeFilter() - APP\app_controller.php, line 22
UsersController::beforeFilter() - APP\controllers\users_controller.php, line 
15
Controller::startupProcess() - CORE\cake\libs\controller\controller.php, 
line 522
Dispatcher::_invoke() - CORE\cake\dispatcher.php, line 187
Dispatcher::dispatch() - CORE\cake\dispatcher.php, line 171
[main] - APP\webroot\index.php, line 83
2011-10-07 11:16:37 Sql: update dbo_mysql : UPDATE `da_aros` AS `Aro`  SET 
`Aro`.`lft` = `Aro`.`lft` + 15  WHERE `Aro`.`lft` BETWEEN 38 AND 39
....
etc.....

Would you have an idea how to repair this?

Thank in advance.
Nastya

-- 
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
[email protected] For more options, visit this group at 
http://groups.google.com/group/cake-php

Reply via email to