PEAR is discontinued

This is a static archive preserving historical releases and metadata. No new packages or updates will be published. For updates to existing packages, or to publish new packages, please use Composer and Packagist.

Home » Authentication » LiveUser_Admin » Bug #7955

getRights using hierarchy and '*','has_implied' as fields returns no implied

Details

Submitted2006-06-21 13:36 UTC
Fromroychri at php dot net
StatusNo Feedback
PackageLiveUser_Admin
PHP Version4.4.0
OSFedora Core release 4 (Stentz)
Roadmaps(Not assigned)

Comments

[2006-06-21 13:36 UTC] roychri at php dot net

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
)

)

[2006-06-28 11:40 UTC] kezban11 at gmx dot de

thanks man,
your work around helped me alot :)

[2006-08-13 00:38 UTC] konrek at gmx dot net

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 ?