<?xml version="1.0"?>
<?xml-stylesheet 
 href="http://www.w3.org/2000/08/w3c-synd/style.css" type="text/css"
?>
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns="http://purl.org/rss/1.0/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:sy="http://purl.org/rss/1.0/modules/syndication/" xmlns:admin="http://webns.net/mvcb/" xmlns:content="http://purl.org/rss/1.0/modules/content/">
    <channel rdf:about="http://pear.php.net/bugs/7955/bug">
    <title>PEAR Bug #7955</title>
    <link>http://pear.php.net/bugs/7955</link>
    <description>[No Feedback] getRights using hierarchy and '*','has_implied' as fields returns no implied</description>
    <dc:language>en-us</dc:language>
    <dc:creator>pear-webmaster@lists.php.net</dc:creator>
    <dc:publisher>pear-webmaster@lists.php.net</dc:publisher>
    <admin:generatorAgent rdf:resource="http://pear.php.net/bugs"/>
    <sy:updatePeriod>hourly</sy:updatePeriod>
    <sy:updateFrequency>1</sy:updateFrequency>
    <sy:updateBase>2000-01-01T12:00+00:00</sy:updateBase>
    <items>
     <rdf:Seq>
      <rdf:li rdf:resource="http://pear.php.net/bugs/7955"/>
      <rdf:li rdf:resource="http://pear.php.net/bugs/7955/2006-08-19+11%3A55%3A26#2006-08-19+11%3A55%3A26"/>
      <rdf:li rdf:resource="http://pear.php.net/bugs/7955/2006-08-12+20%3A38%3A32#2006-08-12+20%3A38%3A32"/>
      <rdf:li rdf:resource="http://pear.php.net/bugs/7955/2006-08-07+03%3A54%3A23#2006-08-07+03%3A54%3A23"/>
      <rdf:li rdf:resource="http://pear.php.net/bugs/7955/2006-06-28+07%3A40%3A52#2006-06-28+07%3A40%3A52"/>
     </rdf:Seq>
    </items>
  </channel>
    <item rdf:about="http://pear.php.net/bugs/7955">
      <title>roychri@... [2006-06-21 09:36:35]</title>
      <link>http://pear.php.net/bugs/7955</link>
      <description><![CDATA[<pre>LiveUser_Admin Bug
Reported by roychri@...
2006-06-21T13:36:35-00:00
PHP: 4.4.0 OS: Fedora Core release 4 (Stentz) Package Version: 0.3.8

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 &quot;*&quot;.
Meaning this works:
'fields' =&gt; 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 &quot;*&quot; 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(
    &quot;filters&quot; =&gt; Array(&quot;right_id&quot; =&gt; $id),
    'hierarchy' =&gt; true, 'rekey' =&gt; true,
    'fields' =&gt; array('*', 'has_implied'),
);
$rights = $admin-&gt;perm-&gt;getRights($params);
if ( $rights === false ) {
    die(var_export($admin-&gt;getErrors(), true));
}
if ( empty($rights) ) {
    die(&quot;Right does not exists&quot;);
}
print &quot;&lt;pre&gt;&quot;;
print_r($params);
print_r($rights);
print &quot;&lt;/pre&gt;&quot;;


Expected result:
----------------
I expected to see:
Array
(
    [filters] =&gt; Array
        (
            [right_id] =&gt; 9
        )

    [hierarchy] =&gt; 1
    [rekey] =&gt; 1
    [fields] =&gt; Array
        (
            [0] =&gt; right_id
            [1] =&gt; right_define_name
            [2] =&gt; area_id
            [3] =&gt; has_implied
        )

)
Array
(
    [9] =&gt; Array
        (
            [right_define_name] =&gt; ADD
            [area_id] =&gt; 5
            [has_implied] =&gt; 1
            [_type] =&gt; granted
            [implied_rights] =&gt; Array
                (
                    [8] =&gt; Array
                        (
                            [right_define_name] =&gt; INDEX
                            [area_id] =&gt; 5
                            [has_implied] =&gt; 
                            [_type] =&gt; implied
                        )

                )

        )

)




Actual result:
--------------
The actual result:
Array
(
    [filters] =&gt; Array
        (
            [right_id] =&gt; 9
        )

    [hierarchy] =&gt; 1
    [rekey] =&gt; 1
    [fields] =&gt; Array
        (
            [0] =&gt; *
            [1] =&gt; has_implied
        )

)
Array
(
    [1] =&gt; Array
        (
            [right_define_name] =&gt; ADD
            [area_id] =&gt; 5
            [has_implied] =&gt; 1
            [_type] =&gt; granted
        )

)</pre>]]></description>
      <content:encoded><![CDATA[<pre>LiveUser_Admin Bug
Reported by roychri@...
2006-06-21T13:36:35-00:00
PHP: 4.4.0 OS: Fedora Core release 4 (Stentz) Package Version: 0.3.8

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 &quot;*&quot;.
Meaning this works:
'fields' =&gt; 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 &quot;*&quot; 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(
    &quot;filters&quot; =&gt; Array(&quot;right_id&quot; =&gt; $id),
    'hierarchy' =&gt; true, 'rekey' =&gt; true,
    'fields' =&gt; array('*', 'has_implied'),
);
$rights = $admin-&gt;perm-&gt;getRights($params);
if ( $rights === false ) {
    die(var_export($admin-&gt;getErrors(), true));
}
if ( empty($rights) ) {
    die(&quot;Right does not exists&quot;);
}
print &quot;&lt;pre&gt;&quot;;
print_r($params);
print_r($rights);
print &quot;&lt;/pre&gt;&quot;;


Expected result:
----------------
I expected to see:
Array
(
    [filters] =&gt; Array
        (
            [right_id] =&gt; 9
        )

    [hierarchy] =&gt; 1
    [rekey] =&gt; 1
    [fields] =&gt; Array
        (
            [0] =&gt; right_id
            [1] =&gt; right_define_name
            [2] =&gt; area_id
            [3] =&gt; has_implied
        )

)
Array
(
    [9] =&gt; Array
        (
            [right_define_name] =&gt; ADD
            [area_id] =&gt; 5
            [has_implied] =&gt; 1
            [_type] =&gt; granted
            [implied_rights] =&gt; Array
                (
                    [8] =&gt; Array
                        (
                            [right_define_name] =&gt; INDEX
                            [area_id] =&gt; 5
                            [has_implied] =&gt; 
                            [_type] =&gt; implied
                        )

                )

        )

)




Actual result:
--------------
The actual result:
Array
(
    [filters] =&gt; Array
        (
            [right_id] =&gt; 9
        )

    [hierarchy] =&gt; 1
    [rekey] =&gt; 1
    [fields] =&gt; Array
        (
            [0] =&gt; *
            [1] =&gt; has_implied
        )

)
Array
(
    [1] =&gt; Array
        (
            [right_define_name] =&gt; ADD
            [area_id] =&gt; 5
            [has_implied] =&gt; 1
            [_type] =&gt; granted
        )

)</pre>]]></content:encoded>
      <dc:date>2006-06-21T13:36:35-00:00</dc:date>
    </item>
    <item rdf:about="http://pear.php.net/bugs/7955/2006-08-19+11%3A55%3A26#2006-08-19+11%3A55%3A26">
      <title>lsmith [2006-08-19 15:55]</title>
      <link>http://pear.php.net/bugs/7955#1156002926</link>
      <description><![CDATA[<pre>Please check current CVS.

I have made the algorithm a little smarter:

Passing a fields list as follows:
array
  0 =&gt; 'perm_user_id' (length=12)
  1 =&gt; '*' (length=1)
  2 =&gt; 'area_id' (length=7)
  3 =&gt; 'right_define_name' (length=17)

Will result in the the following actually used field list:
array
  0 =&gt; 'perm_user_id' (length=12)
  1 =&gt; 'right_id' (length=8)
  2 =&gt; 'has_implied' (length=11)
  3 =&gt; 'area_id' (length=7)
  4 =&gt; '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.</pre>]]></description>
      <content:encoded><![CDATA[<pre>Please check current CVS.

I have made the algorithm a little smarter:

Passing a fields list as follows:
array
  0 =&gt; 'perm_user_id' (length=12)
  1 =&gt; '*' (length=1)
  2 =&gt; 'area_id' (length=7)
  3 =&gt; 'right_define_name' (length=17)

Will result in the the following actually used field list:
array
  0 =&gt; 'perm_user_id' (length=12)
  1 =&gt; 'right_id' (length=8)
  2 =&gt; 'has_implied' (length=11)
  3 =&gt; 'area_id' (length=7)
  4 =&gt; '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.</pre>]]></content:encoded>
      <dc:date>2006-08-19T15:55:26-00:00</dc:date>
    </item>
    <item rdf:about="http://pear.php.net/bugs/7955/2006-08-12+20%3A38%3A32#2006-08-12+20%3A38%3A32">
      <title>konrek@... [2006-08-13 00:38]</title>
      <link>http://pear.php.net/bugs/7955#1155429512</link>
      <description><![CDATA[<pre>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) &quot;error_msg&quot; string(129) &quot;/home/kostja/public_html/eclipse/alitas/pear/PEAR/LiveUser/Admin/Perm/Complex.php (974)
Undefined index: has_implied&quot;

array(1) {
    0 =&gt; array(4) {
        right_id          =&gt; int 1
        area_id           =&gt; int 1
        right_define_name =&gt; string(9) FRONT.USE
        _type             =&gt; 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 =&gt; array(5) {
        has_implied       =&gt; bool true
        area_id           =&gt; int 1
        right_define_name =&gt; int 0
        _type             =&gt; string(7) granted
        implied_rights    =&gt; array(1) {
            2 =&gt; array(5) {
                has_implied       =&gt; bool true
                area_id           =&gt; int 1
                right_define_name =&gt; int 0
                _type             =&gt; string(7) implied
                implied_rights    =&gt; array(1) {
                    1 =&gt; array(4) {
                        has_implied       =&gt; bool false
                        area_id           =&gt; int 1
                        right_define_name =&gt; int 0
                        _type             =&gt; string(7) implied
                    }
                }
            }
        }
    }
}


seems right_id has to be explicitly called on first place and all '*'-part is just ignored ?</pre>]]></description>
      <content:encoded><![CDATA[<pre>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) &quot;error_msg&quot; string(129) &quot;/home/kostja/public_html/eclipse/alitas/pear/PEAR/LiveUser/Admin/Perm/Complex.php (974)
Undefined index: has_implied&quot;

array(1) {
    0 =&gt; array(4) {
        right_id          =&gt; int 1
        area_id           =&gt; int 1
        right_define_name =&gt; string(9) FRONT.USE
        _type             =&gt; 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 =&gt; array(5) {
        has_implied       =&gt; bool true
        area_id           =&gt; int 1
        right_define_name =&gt; int 0
        _type             =&gt; string(7) granted
        implied_rights    =&gt; array(1) {
            2 =&gt; array(5) {
                has_implied       =&gt; bool true
                area_id           =&gt; int 1
                right_define_name =&gt; int 0
                _type             =&gt; string(7) implied
                implied_rights    =&gt; array(1) {
                    1 =&gt; array(4) {
                        has_implied       =&gt; bool false
                        area_id           =&gt; int 1
                        right_define_name =&gt; int 0
                        _type             =&gt; string(7) implied
                    }
                }
            }
        }
    }
}


seems right_id has to be explicitly called on first place and all '*'-part is just ignored ?</pre>]]></content:encoded>
      <dc:date>2006-08-13T00:38:32-00:00</dc:date>
    </item>
    <item rdf:about="http://pear.php.net/bugs/7955/2006-08-07+03%3A54%3A23#2006-08-07+03%3A54%3A23">
      <title>mahono [2006-08-07 07:54]</title>
      <link>http://pear.php.net/bugs/7955#1154937263</link>
      <description><![CDATA[<pre>Does it work, if you use:
'fields' =&gt; array('*')
?</pre>]]></description>
      <content:encoded><![CDATA[<pre>Does it work, if you use:
'fields' =&gt; array('*')
?</pre>]]></content:encoded>
      <dc:date>2006-08-07T07:54:23-00:00</dc:date>
    </item>
    <item rdf:about="http://pear.php.net/bugs/7955/2006-06-28+07%3A40%3A52#2006-06-28+07%3A40%3A52">
      <title>kezban11@... [2006-06-28 11:40]</title>
      <link>http://pear.php.net/bugs/7955#1151494852</link>
      <description><![CDATA[<pre>thanks man,
your work around helped me alot :)</pre>]]></description>
      <content:encoded><![CDATA[<pre>thanks man,
your work around helped me alot :)</pre>]]></content:encoded>
      <dc:date>2006-06-28T11:40:52-00:00</dc:date>
    </item>
</rdf:RDF>