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

Bug #5453 return of getRight() method
Submitted: 2005-09-19 14:45 UTC
From: l dot nienhaus at gmail dot com Assigned: lsmith
Status: Closed Package: LiveUser_Admin
PHP Version: 4.3.0 OS:
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 : 33 - 17 = ?

 
 [2005-09-19 14:45 UTC] l dot nienhaus at gmail dot com
Description: ------------ When using Perm_Simple or Perm_Medium Container, the getRights() method returns the result as an array with incrementing indexes when switching to Perm_Complex it occured, that the return array has the right_ids as indexes Test script: --------------- $result = $lu_admin->perm->getRights(...) Expected result: ---------------- //expected result like in perm_simple & perm_medium: $result = array(0 => array(rightstuff), 1 => array(rightstuff), ...); Actual result: -------------- //perm_complex: $result = array(first_right_id => array(rightstuff), second_right_id => array(rightstuff), ...);

Comments

 [2005-09-20 23:33 UTC] lsmith
Please give us your LU config .. specifically that of the permission backend.
 [2005-09-20 23:36 UTC] l dot nienhaus at gmail dot com
voilĂ , tell me if you need more 'permContainer' => array('type' => 'Complex', 'storage' => array('DB' => array('dsn' => DSN, 'prefix' => 'liveuser_', 'tables' => array(), 'fields' => array(), 'alias' => array(), 'force_seq' => true, ), ), )
 [2005-09-20 23:43 UTC] lsmith
I would also need the exact parameters you are passing into getRights().
 [2005-09-20 23:53 UTC] l dot nienhaus at gmail dot com
Doesn't matter which arguments. A simple $lu_admin->perm->getRights() call does it, try switching vom Simple or Medium to Complex and compare the returned arrays. I think this bug is obvious, just have a look at the getRights method of the Complex container. http://cvs.php.net/co.php/pear/LiveUser_Admin/Perm/Complex.php?r=1.69#793 Normally lu-admin's get*() methods return arrays with incrementing indexes, this one does not.
 [2005-09-21 00:27 UTC] lsmith
/me blushes .. yeah you are right. i will have look tomorrow .. maybe an array_values() if "rekey" is not set to true is all we need. IIRC we needed the ability to look up array values by $id for something ..
 [2005-09-21 07:28 UTC] lsmith
Ok this code seems to be very broken indeed. I am also seeing some "FIX ME" in some of the related methods. Not sure if I will have time to handle this today or tomorrow. If you find the time to send in a patch it would be great. It looks to me like the code atm is currently not flexible enough to handle all sorts of settings for "rekey" or "select".
 [2005-09-23 15:24 UTC] lsmith
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. Please try CVS and reopen the bug if you still have issues. The following are the parameter validation rules in getRights() if ($params['inherited'] || $params['implied']) { if ((!isset($params['rekey']) || !$params['rekey']) || (isset($params['group']) && $params['group']) || (isset($params['select']) && $params['select'] != 'all') || (isset($params['fields']) && reset($params['fields']) !== 'right_id') ) { $this->_stack->push( LIVEUSER_ADMIN_ERROR, 'exception', array('msg' => "Setting 'implied' or 'inherited' is only allowed if 'rekey' is enabled, ". "'group' is disabled, 'select' is 'all' and the first field is 'right_id'") ); return false; } if ($params['implied'] && array_key_exists('fields', $params) && !in_array('has_implied', $params['fields']) ) { $this->_stack->push( LIVEUSER_ADMIN_ERROR, 'exception', array('msg' => "Setting 'implied' requires that 'has_implied' field needs to be in the select list") ); return false; } }