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

Bug #7955 getRights using hierarchy and '*','has_implied' as fields returns no implied
Submitted: 2006-06-21 13:36 UTC
From: roychri at php dot net Assigned:
Status: No Feedback Package: LiveUser_Admin (version 0.3.8)
PHP Version: 4.4.0 OS: Fedora Core release 4 (Stentz)
Roadmaps: (Not assigned)    
Subscription  
Comments Add Comment Add patch


Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know! Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
MUST BE VALID
Solve the problem : 31 - 4 = ?

 
 [2006-06-21 13:36 UTC] roychri at php dot net (Christian Roy)
Description: ------------ I am attempting to return a right with all implied rights. I used the test example located at as a model: doc/LiveUser_Admin/docs/examples/example1/ImplyRights.php Using that example, I get the right but not the implied rights. WORK AROUND: I am able to get the implied rights if I changed the fields and specify all the fields one by one instead of using "*". Meaning this works: 'fields' => array( 'right_id', 'right_define_name', 'area_id', 'has_implied', ), I do not know if the example script is wrong or if there's a bug when using "*" in the fields list when retrieving implied rights. PS: This is my first bug report, my apologies if its not done right (no pun intended). Test script: --------------- $params = Array( "filters" => Array("right_id" => $id), 'hierarchy' => true, 'rekey' => true, 'fields' => array('*', 'has_implied'), ); $rights = $admin->perm->getRights($params); if ( $rights === false ) { die(var_export($admin->getErrors(), true)); } if ( empty($rights) ) { die("Right does not exists"); } print "<pre>"; print_r($params); print_r($rights); print "</pre>"; Expected result: ---------------- I expected to see: Array ( [filters] => Array ( [right_id] => 9 ) [hierarchy] => 1 [rekey] => 1 [fields] => Array ( [0] => right_id [1] => right_define_name [2] => area_id [3] => has_implied ) ) Array ( [9] => Array ( [right_define_name] => ADD [area_id] => 5 [has_implied] => 1 [_type] => granted [implied_rights] => Array ( [8] => Array ( [right_define_name] => INDEX [area_id] => 5 [has_implied] => [_type] => implied ) ) ) ) Actual result: -------------- The actual result: Array ( [filters] => Array ( [right_id] => 9 ) [hierarchy] => 1 [rekey] => 1 [fields] => Array ( [0] => * [1] => has_implied ) ) Array ( [1] => Array ( [right_define_name] => ADD [area_id] => 5 [has_implied] => 1 [_type] => granted ) )

Comments

 [2006-06-28 11:40 UTC] kezban11 at gmx dot de (Veysel Özer)
thanks man, your work around helped me alot :)
 [2006-08-07 07:54 UTC] mahono (Matthias)
Does it work, if you use: 'fields' => array('*') ?
 [2006-08-13 00:38 UTC] konrek at gmx dot net (konrek)
No, has the same with doc/LiveUser_Admin/docs/examples/example1/ImplyRights.php, with '*','has_implied' it constructs a query: string(186) query: SELECT has_implied AS has_implied, right_id AS right_id, area_id AS area_id, right_define_name AS right_define_name, has_implied AS has_implied FROM lu_rights WHERE right_id = 2 With output: string(9) "error_msg" string(129) "/home/kostja/public_html/eclipse/alitas/pear/PEAR/LiveUser/Admin/Perm/Complex.php (974) Undefined index: has_implied" array(1) { 0 => array(4) { right_id => int 1 area_id => int 1 right_define_name => string(9) FRONT.USE _type => string(7) granted } } this works too: 'right_id', '*' , 'has_implied' All the rights with hierarchy: string(208) query: SELECT right_id AS right_id, has_implied AS has_implied, right_id AS right_id, area_id AS area_id, right_define_name AS right_define_name, has_implied AS has_implied FROM lu_rights WHERE right_id = 3 string(93) query: SELECT implied_right_id AS implied_right_id FROM lu_right_implied WHERE right_id = 3 string(211) query: SELECT right_id AS right_id, has_implied AS has_implied, right_id AS right_id, area_id AS area_id, right_define_name AS right_define_name, has_implied AS has_implied FROM lu_rights WHERE right_id IN (2) string(93) query: SELECT implied_right_id AS implied_right_id FROM lu_right_implied WHERE right_id = 2 string(211) query: SELECT right_id AS right_id, has_implied AS has_implied, right_id AS right_id, area_id AS area_id, right_define_name AS right_define_name, has_implied AS has_implied FROM lu_rights WHERE right_id IN (1) array(1) { 3 => array(5) { has_implied => bool true area_id => int 1 right_define_name => int 0 _type => string(7) granted implied_rights => array(1) { 2 => array(5) { has_implied => bool true area_id => int 1 right_define_name => int 0 _type => string(7) implied implied_rights => array(1) { 1 => array(4) { has_implied => bool false area_id => int 1 right_define_name => int 0 _type => string(7) implied } } } } } } seems right_id has to be explicitly called on first place and all '*'-part is just ignored ?
 [2006-08-19 15:55 UTC] lsmith (Lukas Smith)
Please check current CVS. I have made the algorithm a little smarter: Passing a fields list as follows: array 0 => 'perm_user_id' (length=12) 1 => '*' (length=1) 2 => 'area_id' (length=7) 3 => 'right_define_name' (length=17) Will result in the the following actually used field list: array 0 => 'perm_user_id' (length=12) 1 => 'right_id' (length=8) 2 => 'has_implied' (length=11) 3 => 'area_id' (length=7) 4 => 'right_define_name' (length=17) Essentially '*' will now be expanded in the same location as the '*' was in. However when expanding any columns explicitly contained in the user defined field list will not get expanded.