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

Request #7041 getRights() on an unassigned group returns nothing
Submitted: 2006-03-06 23:07 UTC
From: msadagopan at wltcapital dot com Assigned: lsmith
Status: Analyzed Package: LiveUser_Admin (version 0.3.7)
PHP Version: 5.1.2 OS: Linux
Roadmaps: (Not assigned)    
Subscription  


 [2006-03-06 23:07 UTC] msadagopan at wltcapital dot com (Madhu Sadagopan)
Description: ------------ Package Version State LiveUser 0.16.10 beta LiveUser_Admin 0.3.7 beta System Linux ubuntu 2.6.12-10-386 #1 Mon Feb 13 12:13:15 UTC 2006 i686 Build Date Feb 21 2006 10:09:40 './configure' '--with-apxs2=/usr/bin/apxs2' '--with-mysql=/usr/local/mysql' '--with-mysqli=/usr/local/mysql/bin/mysql_config' '--with-mysql-sock=/tmp/mysql.sock' '--with-sqlite' '--enable-sqlite-utf8' '--with-zlib' '--with-zlib-dir' '--with-bz2' '--with-gd' '--enable-gd' '--enable-gd-native-ttf' '--with-jpeg-dir=/usr/local' '--with-png-dir=/usr/local' '--with-ttf' '--with-freetype-dir=/usr/local' '--with-iconv=/usr/local' '--with-curl=/usr/local' '--enable-track-vars' '--with-gettext' '--with-config-file-path=/etc/apache2' '--enable-trans-id' '--enable-ftp' '--enable-mbstring' '--with-tidy' '--with-xsl' Test script: --------------- //LUA -> LiveUser_Admin $data = array('application_define_name' => 'APP_WORLD'); $app_id = $LUA->perm->addApplication($data); $data = array( 'application_id' => $app_id, 'area_define_name' => 'AREA_FOO',); $area_id = $LUA->perm->addArea($data); $data = array( 'area_id' => $area_id, 'right_define_name' => 'INSERT', 'has_implied' => FALSE); $right_id = $LUA->perm->addRight($data); $data = array( 'group_define_name' => 'GRP_TEST'); $group_id = $LUA->perm->addGroup($data); $data = array( 'group_id' => $group_id, 'right_id' => $right_id, 'right_level' => '1'); $granted = $LUA->perm->grantGroupRight($data); $params = array( 'fields' => array('right_id','right_define_name','right_level'), 'filters' => array('group_id' => $group_id), 'by_group' => TRUE,); $grp_rights = $LUA->perm->getRights($params, TRUE); print_r($grp_rights); Expected result: ---------------- array(1) { [0]=> array(3) { ["right_id"]=> string(3) "<right_id>" //the $right_id ["right_define_name"]=> string(6) "INSERT" ["right_level"]=> string(1) "1" } Actual result: -------------- array(0) The final generated query @ LiveUser/Admin/Storage/SQL.php in the function select() SELECT liveuser_rights.right_id AS right_id, liveuser_rights.right_define_name AS right_define_name, liveuser_grouprights.right_level AS right_level FROM liveuser_rights, liveuser_groupusers, liveuser_grouprights WHERE liveuser_rights.right_id = liveuser_grouprights.right_id AND liveuser_grouprights.group_id = liveuser_groupusers.group_id AND liveuser_groupusers.group_id = 27 Its joining the 'liveuser_groupusers' table also. But in this case, since a user hasn't been assigned to the group 'GRP_TEST', getRights() returns nothing.

Comments

 [2006-03-07 07:35 UTC] User who submitted this comment has not confirmed identity
If you submitted this note, check your email.If you do not have a message, click here to re-send
MANUAL CONFIRMATION IS NOT POSSIBLE.  Write a message to pear-dev@lists.php.net
to request the confirmation link.  All bugs/comments/patches associated with this

email address will be deleted within 48 hours if the account request is not confirmed!
 [2006-03-07 18:40 UTC] msadagopan at wltcapital dot com
I don't think you understood the actual issue. For a context, we're working on a group rights editor. If we create a group, but it has no users yet, it should still be possible to manage the rights of that group before assigning a user to the group. However at the moment it is not possible due to getRights() creating an SQL query that unnecessarily joins the liveuser_groupusers table: WHERE liveuser_rights.right_id = liveuser_grouprights.right_id AND liveuser_grouprights.group_id = liveuser_groupusers.group_id AND liveuser_groupusers.group_id = 27 But what it should be: WHERE liveuser_rights.right_id = liveuser_grouprights.right_id AND liveuser_grouprights.group_id = 27 There is no data being requested from liveuser_groupusers, nor it that being used for any filtering, so shouldn't be involved in the query. What we are requesting is this behavior, to support group rights management before users have been added to the group.
 [2006-03-07 18:45 UTC] User who submitted this comment has not confirmed identity
If you submitted this note, check your email.If you do not have a message, click here to re-send
MANUAL CONFIRMATION IS NOT POSSIBLE.  Write a message to pear-dev@lists.php.net
to request the confirmation link.  All bugs/comments/patches associated with this

email address will be deleted within 48 hours if the account request is not confirmed!
 [2006-03-07 19:16 UTC] msadagopan at wltcapital dot com
We are using the the Complex container and its the getRights() function defined at Line - 815 in /<pear-dir>/LiveUser/Admin/Perm/Complex.php Regarding the bogus second parameter, The documentation still has the second bogus parameter, even in the latest source tree of Complex.php which is at revision 1.86 The expected result, which you seem to agree is how it should be, didn't match with the actual result even after removing the bogus second parameter because its not being used anyway. $params = array( 'fields' => array('right_id','right_define_name','right_level'), 'filters' => array('group_id' => $group_id), 'by_group' => TRUE,); $grp_rights = $LUA->perm->getRights($params);
 [2006-03-07 22:20 UTC] User who submitted this comment has not confirmed identity
If you submitted this note, check your email.If you do not have a message, click here to re-send
MANUAL CONFIRMATION IS NOT POSSIBLE.  Write a message to pear-dev@lists.php.net
to request the confirmation link.  All bugs/comments/patches associated with this

email address will be deleted within 48 hours if the account request is not confirmed!
 [2006-03-08 13:53 UTC] User who submitted this comment has not confirmed identity
If you submitted this note, check your email.If you do not have a message, click here to re-send
MANUAL CONFIRMATION IS NOT POSSIBLE.  Write a message to pear-dev@lists.php.net
to request the confirmation link.  All bugs/comments/patches associated with this

email address will be deleted within 48 hours if the account request is not confirmed!
 [2006-06-26 16:13 UTC] kezban11 at gmx dot de (Veysel Özer)
i had a similar problem with LiveUser_Admin 0.3.8 i added following line to the admin/perm/medium.php constructor $this->selectable_tables['getRights'][] = 'grouprights'; i think this is simply missing there, cause when looking to the complex.php you'll see that there is $this->selectable_tables['getRights'][] = 'right_implied'; hope that's also what you're talking about
 [2006-08-14 08:45 UTC] User who submitted this comment has not confirmed identity
If you submitted this note, check your email.If you do not have a message, click here to re-send
MANUAL CONFIRMATION IS NOT POSSIBLE.  Write a message to pear-dev@lists.php.net
to request the confirmation link.  All bugs/comments/patches associated with this

email address will be deleted within 48 hours if the account request is not confirmed!