Package home | Report new bug | New search | Development Roadmap Status: Open | Feedback | All | Closed Since Version 0.4.0

Bug #7241 Error on fetching rights for a specific user that only has inherited rights
Submitted: 2006-03-29 09:49 UTC
From: michiel at dinnersite dot nl Assigned: lsmith
Status: Closed Package: LiveUser_Admin (version CVS)
PHP Version: 4.4.0 OS: Mandrake
Roadmaps: (Not assigned)    
Subscription  


 [2006-03-29 09:49 UTC] michiel at dinnersite dot nl (Michiel Nugter)
Description: ------------ A call to the getRights function with the initial params: Array ( [filters] => Array ( [perm_user_id] => 8 ) [inherited] => 1 [implied] => 1 [rekey] => 1 [fields] => Array ( [0] => right_id [1] => area_id [2] => right_define_name [3] => has_implied ) [select] => all ) And the params created by _getInheritedRights() Array ( [filters] => Array ( [perm_user_id] => 8 [group_id] => Array ( [0] => 1 [1] => 4 ) ) [rekey] => 1 [fields] => Array ( [0] => right_id [1] => area_id [2] => right_define_name [3] => has_implied ) [select] => all [by_group] => 1 [inherited] => [implied] => ) Results in the following errorstack (just a small part, mail me for the full errorstack): Array ( [0] => Array ( [code] => -4 [params] => Array ( [reason] => DB Error: unknown error-SELECT liveuser_rights.right_id AS right_id, liveuser_rights.area_id AS area_id, liveuser_rights.right_define_name AS right_define_name, liveuser_rights.has_implied AS has_implied FROM liveuser_rights, liveuser_groupusers WHERE liveuser_groupusers.group_id IN ('1', '3', '4') AND liveuser_rights.area_id = liveuser_areas.area_id AND liveuser_areas.application_id = liveuser_applications.application_id AND liveuser_applications.application_id = liveuser_areas.application_id AND liveuser_translations.section_type = 1 AND liveuser_areas.area_id = liveuser_translations.section_id AND liveuser_translations.section_id = liveuser_applications.application_id AND liveuser_rights.right_id = liveuser_translations.section_id [nativecode=1109 ** Unknown table 'liveuser_areas' in where clause] ) [package] => LiveUser_Admin [level] => exception [time] => 1143622685.44 [context] => Array ( [file] => /home/netural/ds6/sdk/PEAR/LiveUser/Admin/Storage/DB.php [line] => 321 [function] => queryall [class] => liveuser_admin_perm_storage_db ) [message] => Couldn't create the query, reason: DB Error: unknown error-SELECT liveuser_rights.right_id AS right_id, liveuser_rights.area_id AS area_id, liveuser_rights.right_define_name AS right_define_name, liveuser_rights.has_implied AS has_implied FROM liveuser_rights, liveuser_groupusers WHERE liveuser_groupusers.group_id IN ('1', '3', '4') AND liveuser_rights.area_id = liveuser_areas.area_id AND liveuser_areas.application_id = liveuser_applications.application_id AND liveuser_applications.application_id = liveuser_areas.application_id AND liveuser_translations.section_type = 1 AND liveuser_areas.area_id = liveuser_translations.section_id AND liveuser_translations.section_id = liveuser_applications.application_id AND liveuser_rights.right_id = liveuser_translations.section_id [nativecode=1109 ** Unknown table 'liveuser_areas' in where clause] ) [1] => Array ( [code] => -4 [params] => Array ( [reason] => infinite recursion detected: translations ) [package] => LiveUser_Admin [level] => exception [time] => 1143622685.44 [context] => Array ( [file] => /home/netural/ds6/sdk/PEAR/LiveUser/Admin/Storage/SQL.php [line] => 717 [function] => createjoinfilter [class] => liveuser_admin_perm_storage_db ) [message] => Couldn't create the query, reason: infinite recursion detected: translations )

Comments

 [2006-03-29 20:49 UTC] lsmith (Lukas Smith)
Puh .. this is a tricky one .. I keep running into these issues where some filters should be propagated and others should not .. I think I have to dig through all recent bug reports and in the future I should comment the code better ..
 [2006-03-30 07:49 UTC] michiel at dinnersite dot nl
A tricky one indeed.. Btw. I did try to remove the perm_user_id from the getInheritedRights params but nothing changed. I could help out on some points to add some comment to the Admin side of LiveUser... (Been working with it a lot so I think understanding the code quite well). Mail me if you need any help with this..
 [2006-03-30 07:52 UTC] lsmith (Lukas Smith)
Sure, just send in unified diffs. My current idea is to drop this entire of reusing the filters for these additional calls. Instead $params['inherited'] etc would contain the $params array.
 [2006-03-30 08:11 UTC] michiel at dinnersite dot nl
Sounds
 [2006-03-30 08:11 UTC] michiel at dinnersite dot nl
Sounds like a BC break, don't know if my code would break because of it (don't think so) but I can image it will with some others..
 [2006-03-30 08:13 UTC] lsmith (Lukas Smith)
Yes it would be a BC break.
 [2006-04-09 15:34 UTC] lsmith (Lukas Smith)
OK, I just commited a cleaned up version. I would appreciate it if you could take a look. I also updated the phpdoc comments. Essentially the idea is that you set the filter parameters for the recursion. For getGroups() in the 'subgroups', 'hierarchy' keys (note that hierarchy is now no longer specified by setting 'subgroups' => 'hierarchy'). For getRights() 'inherited', 'implied' and 'hierarchy' (note that hierarchy is now no longer specified by setting 'implied' => 'hierarchy';).
 [2006-04-10 09:07 UTC] michiel at dinnersite dot nl
It still generates errors unfortunately. Using the following params: Array ( [filters] => Array ( [perm_user_id] => 9 ) [inherited] => Array ( [perm_user_id] => 9 ) [implied] => Array ( [perm_user_id] => 9 ) [rekey] => 1 [fields] => Array ( [0] => right_id [1] => area_id [2] => right_define_name [3] => has_implied ) [select] => all ) The errorstack: [0] => Array ( [code] => -4 [params] => Array ( [reason] => DB Error: no such field-SELECT liveuser_rights.right_id AS right_id, liveuser_rights.area_id AS area_id, liveuser_rights.right_define_name AS right_define_name, liveuser_rights.has_implied AS has_implied FROM liveuser_rights, liveuser_groupusers WHERE liveuser_groupusers.perm_user_id = '9' AND liveuser_groupusers.group_id IN ('1') AND liveuser_rights.area_id = liveuser_areas.area_id AND liveuser_areas.application_id = liveuser_applications.application_id AND liveuser_applications.application_id = liveuser_areas.application_id AND liveuser_translations.section_type = 1 AND liveuser_areas.area_id = liveuser_translations.section_id AND liveuser_translations.section_id = liveuser_applications.application_id AND liveuser_rights.right_id = liveuser_translations.section_id [nativecode=1054 ** Unknown column 'liveuser_areas.area_id' in 'where clause'] ) [package] => LiveUser_Admin [level] => exception [time] => 1144659042.51 [context] => Array ( [file] => /home/netural/ds6/sdk/PEAR/LiveUser/Admin/Storage/DB.php [line] => 321 [function] => queryall [class] => liveuser_admin_perm_storage_db ) [message] => Couldn't create the query, reason: DB Error: no such field-SELECT liveuser_rights.right_id AS right_id, liveuser_rights.area_id AS area_id, liveuser_rights.right_define_name AS right_define_name, liveuser_rights.has_implied AS has_implied FROM liveuser_rights, liveuser_groupusers WHERE liveuser_groupusers.perm_user_id = '9' AND liveuser_groupusers.group_id IN ('1') AND liveuser_rights.area_id = liveuser_areas.area_id AND liveuser_areas.application_id = liveuser_applications.application_id AND liveuser_applications.application_id = liveuser_areas.application_id AND liveuser_translations.section_type = 1 AND liveuser_areas.area_id = liveuser_translations.section_id AND liveuser_translations.section_id = liveuser_applications.application_id AND liveuser_rights.right_id = liveuser_translations.section_id [nativecode=1054 ** Unknown column 'liveuser_areas.area_id' in 'where clause'] ) [1] => Array ( [code] => -4 [params] => Array ( [reason] => infinite recursion detected: translations ) [package] => LiveUser_Admin [level] => exception [time] => 1144659042.51 [context] => Array ( [file] => /home/netural/ds6/sdk/PEAR/LiveUser/Admin/Storage/SQL.php [line] => 717 [function] => createjoinfilter [class] => liveuser_admin_perm_storage_db ) [message] => Couldn't create the query, reason: infinite recursion detected: translations ) Other changes with this version: * Break in my getGroups function, had to change my call to getRights(). * Rights still fetch ok for the current logged in user (inherited and granted) with current code (no changes).
 [2006-04-10 10:34 UTC] lsmith (Lukas Smith)
Ok, I found and fixed several issues, but I do not think I ever saw the same error as you got. Maybe it works now?
 [2006-04-12 11:37 UTC] michiel at dinnersite dot nl
An update on the situation. I got everything working again, but with some interesting notes. In some cases adding right_level is required and some times adding right_level causes problems. right_level is required when you add perm_user_id or group_id to the filters. right_level gives problems when filtering on area_id. I included my parameters below, maby they can help some. With these parameters the right_level is required: Array ( [filters] => Array ( [perm_user_id] => 8 ) [inherited] => Array ( [perm_user_id] => 8 ) [implied] => Array ( [perm_user_id] => 8 ) [rekey] => 1 [fields] => Array ( [0] => right_id [1] => area_id [2] => right_define_name [3] => has_implied [4] => right_level ) [select] => all ) The same goes for filtering by group_id. However if you add right_level when filtering on area_id results in an empty array. Removing the right_level does provide (the correct) results.
 [2006-04-13 08:59 UTC] lsmith (Lukas Smith)
I cannot really reproduce these issues. Could you send me a copy of your permissions tables?
 [2006-04-13 10:59 UTC] michiel at dinnersite dot nl
I mailed you my database dump.
 [2006-04-13 11:01 UTC] michiel at dinnersite dot nl
I maile
 [2006-04-14 13:50 UTC] lsmith (Lukas Smith)
Using the dump you send me I cannot reproduce your issues. Both of the following calls return several rights. $rights = $admin->perm->getRights(array( 'implied' => array('perm_user_id' => 8), 'inherited' => array('perm_user_id' => 8), 'rekey' => true, 'filters' => array('perm_user_id' => 8), 'fields' => array( 'right_id', 'area_id', 'right_define_name', 'has_implied', ), )); $rights = $admin->perm->getRights(array( 'implied' => array('perm_user_id' => 8), 'inherited' => array('perm_user_id' => 8), 'rekey' => true, 'filters' => array('area_id' => 3), 'fields' => array( 'right_id', 'area_id', 'right_define_name', 'has_implied', 'right_level', ), ));
 [2006-04-14 14:42 UTC] michiel at dinnersite dot nl
Hmm, that is a bit weird. I'll just try to renew my whole LiveUser package with the CVS version again (did the admin part once already). I'll update you as soon as I know more.
 [2006-04-19 08:22 UTC] lsmith (Lukas Smith)
This bug has been fixed in CVS. If this was a documentation problem, the fix will appear on pear.php.net by the end of next Sunday (CET). If this was a problem with the pear.php.net website, the change should be live shortly. Otherwise, the fix will appear in the package's next release. Thank you for the report and for helping us make PEAR better.