Forums / Setup & design / fetch limitation parameter

fetch limitation parameter

Author Message

James Ward

Tuesday 24 January 2006 5:25:55 pm

running ez 3.7.2

Has anyone got a working example of the fetch limitation parameter mentioned in the docs at: http://ez.no/doc/ez_publish/technical_manual/3_6/reference/modules/content/fetch_functions/list

I tried the following to fetch a subnode that the anonymous user can not access:

{def $emptyarray=array()}
{def $objects=fetch(content, list, hash(parent_node_id, $node.node_id, 
                                        limitation, array ( $emptyarray ) ) )}

I'm not sure if this paramter is working yet as the documentation is a little vague. The docs would seem to indicate that I can use this to ignore user permissions and fetch subnodes.

Thanks in advance.

working at www.wardnet.com
blogging at www.jamesward.ca

Kristof Coomans

Tuesday 24 January 2006 11:25:26 pm

Take a look at eZContentObjectTreeNode::createPermissionCheckingSQLString. It gets called with the limitation array you provided, and adds extra SQL conditions according to the entries in the limitation array. An emtpy limitation array should result in no extra conditions, so it disables any policy checking.

independent eZ Publish developer and service provider | http://blog.coomanskristof.be | http://ezpedia.org

Ɓukasz Serwatka

Tuesday 24 January 2006 11:47:11 pm

Example which will work is:

{def $objects=fetch(content, list, hash(parent_node_id, $node.node_id, 
                                       limitation, array() ) )}

Personal website -> http://serwatka.net
Blog (about eZ Publish) -> http://serwatka.net/blog

James Ward

Wednesday 25 January 2006 8:50:42 am

Thanks Lukasz,
I had actually tried that way first but thought it was not working. My problem was in my understanding of what you can and can not do with the fetched information. After the object fetch without limitation I was attempting to view the node with the following:

{node_view_gui view=full content_node=$objects[0]}

Which obviously is not allowed, I assume because the fetches within that node view will be restricted by the permisison limitations.

As soon as I used the following I was able to see information within the restricted node:

{attribute_view_gui attribute=$objects[0].data_map.name}

In retrospect this makes complete sense and is a logical way for the limitation parameter to work.

Thanks for all your help.

working at www.wardnet.com
blogging at www.jamesward.ca