Forums / Developer / role system / hiding content / fetch function

role system / hiding content / fetch function

Author Message

Georg Franz

Friday 28 November 2003 10:30:08 am

Hi,

ez 3.2.3:

I've made three sections:
Section 5: All content is readable
Section 6: All content is readable
Section 7: Content is only readable by editors

and added Policies to the roles "anonymous" and "editor"

I've assigned the sections to my node-tree:

Article-Folder (Section 5)
---Folder 1 (Section 5)
------Article 1
---Folder 2 (Section 6)
------Article 2
---Folder 3 (Section 7)
------Article 3

I make a menu in the template which displays the subfolders of the Article-folder.

fetch(content,list,hash(parent_node_id,$top_cat,
class_filter_type, "include",
class_filter_array, array(1),
sort_by,$top_cat_obj.sort_array))

The fetch-function returns also the "Folder 3" which is not readable by the anonymous user.

If an anonymous user clicks on the "Folder 3"-Link, he will get an access-denied message - which is fine.

But the anonymous user shouldn't see the "Folder 3"-Link.

So, is there a possibility (maybe a parameter of the fetch-function?) to tell the fetch-function that it should only returns "readable" content?

At the moment I am doing something like:

{section name="menu" loop=fetch(content,list,hash(parent_node_id,$top_cat,
class_filter_type, "include",
class_filter_array, array(1),
sort_by,$top_cat_obj.sort_array)) }
{section show=$:item.object.can_read}
<a class="menu" href={$:item.url_alias|ezroot}>{$:item.name}</a>
{/section}
{/section}

This isn't a good solution if I need e.g. the google navigator: If the fetch-function returns e.g. 30 objects and only 20 are readable by the current user I've to maintain the "offset" and the "list_count" vars.

So - have I overseen something or isn't it possible to exclude content in the fetch-function which is not readable?

(Similar problem in the search-template.)

Kind regards,
Emil.

Best wishes,
Georg.

--
http://www.schicksal.com Horoskop website which uses eZ Publish since 2004

Georg Franz

Sunday 30 November 2003 6:37:57 am

Hi,

today I've created a new role and a new user who is assigned to the role. And - I was surprised - the fetch function and the search were working as expected (they only have returned "readable" content).

The only difference: First I've created a policy for each section:
1) content / read / section 5
2) content / read / section 6
3) content / read / section 7
4) search *
5) login *

In that case - the search / fetch were returning "not readable" content.

Now I've deleted policy 1-3, my new policy list is:
1) search *
2) login *
3) content / read / section ( 5,6,7)

And - surprise, surprise - fetch and search are working as expected.

So, maybe there is a nasty bug somewhere in the role system?

(PS: Of course, I've removed the
{section show=$:item.object.can_read}
<a class="menu" href={$:item.url_alias|ezroot}>{$:item.name}</a>
{/section}
-Code in the templates)

Kind regards,
Emil.

Best wishes,
Georg.

--
http://www.schicksal.com Horoskop website which uses eZ Publish since 2004

Andrew Vorobyov

Thursday 02 June 2005 2:56:12 am

Have opposite problem...

I want to show several fields of the object that is located in Members area for anonymous users...

fetch('content','list') seems does'nt work because objects are located in Members only section

Please advise if you can!

eZ debug

Timing: Jan 18 2025 15:09:32
Script start
Timing: Jan 18 2025 15:09:32
Module start 'content'
Timing: Jan 18 2025 15:09:33
Module end 'content'
Timing: Jan 18 2025 15:09:33
Script end

Main resources:

Total runtime0.9526 sec
Peak memory usage4,096.0000 KB
Database Queries194

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0050 588.9609180.8125
Module start 'content' 0.00500.8183 769.7734559.6719
Module end 'content' 0.82330.1293 1,329.4453336.7422
Script end 0.9526  1,666.1875 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00380.3966210.0002
Check MTime0.00150.1538210.0001
Mysql Total
Database connection0.00060.068110.0006
Mysqli_queries0.880992.47191940.0045
Looping result0.00190.20071920.0000
Template Total0.929997.620.4650
Template load0.00180.193820.0009
Template processing0.928197.423920.4640
Template load and register function0.00010.009210.0001
states
state_id_array0.00080.082710.0008
state_identifier_array0.00110.115520.0005
Override
Cache load0.00160.1707720.0000
Sytem overhead
Fetch class attribute can translate value0.00090.098330.0003
Fetch class attribute name0.00090.096640.0002
XML
Image XML parsing0.00070.074830.0002
class_abstraction
Instantiating content class attribute0.00000.001050.0000
General
dbfile0.00260.2766270.0001
String conversion0.00000.000630.0000
Note: percentages do not add up to 100% because some accumulators overlap

CSS/JS files loaded with "ezjscPacker" during request:

CacheTypePacklevelSourceFiles
CSS0extension/community/design/community/stylesheets/ext/jquery.autocomplete.css
extension/community_design/design/suncana/stylesheets/scrollbars.css
extension/community_design/design/suncana/stylesheets/tabs.css
extension/community_design/design/suncana/stylesheets/roadmap.css
extension/community_design/design/suncana/stylesheets/content.css
extension/community_design/design/suncana/stylesheets/star-rating.css
extension/community_design/design/suncana/stylesheets/syntax_and_custom_tags.css
extension/community_design/design/suncana/stylesheets/buttons.css
extension/community_design/design/suncana/stylesheets/tweetbox.css
extension/community_design/design/suncana/stylesheets/jquery.fancybox-1.3.4.css
extension/bcsmoothgallery/design/standard/stylesheets/magnific-popup.css
extension/sevenx/design/simple/stylesheets/star_rating.css
extension/sevenx/design/simple/stylesheets/libs/fontawesome/css/all.min.css
extension/sevenx/design/simple/stylesheets/main.v02.css
extension/sevenx/design/simple/stylesheets/main.v02.res.css
JS0extension/ezjscore/design/standard/lib/yui/3.17.2/build/yui/yui-min.js
extension/ezjscore/design/standard/javascript/jquery-3.7.0.min.js
extension/community_design/design/suncana/javascript/jquery.ui.core.min.js
extension/community_design/design/suncana/javascript/jquery.ui.widget.min.js
extension/community_design/design/suncana/javascript/jquery.easing.1.3.js
extension/community_design/design/suncana/javascript/jquery.ui.tabs.js
extension/community_design/design/suncana/javascript/jquery.hoverIntent.min.js
extension/community_design/design/suncana/javascript/jquery.popmenu.js
extension/community_design/design/suncana/javascript/jScrollPane.js
extension/community_design/design/suncana/javascript/jquery.mousewheel.js
extension/community_design/design/suncana/javascript/jquery.cycle.all.js
extension/sevenx/design/simple/javascript/jquery.scrollTo.js
extension/community_design/design/suncana/javascript/jquery.cookie.js
extension/community_design/design/suncana/javascript/ezstarrating_jquery.js
extension/community_design/design/suncana/javascript/jquery.initboxes.js
extension/community_design/design/suncana/javascript/app.js
extension/community_design/design/suncana/javascript/twitterwidget.js
extension/community_design/design/suncana/javascript/community.js
extension/community_design/design/suncana/javascript/roadmap.js
extension/community_design/design/suncana/javascript/ez.js
extension/community_design/design/suncana/javascript/ezshareevents.js
extension/sevenx/design/simple/javascript/main.js

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1node/view/full.tplfull/forum_topic.tplextension/sevenx/design/simple/override/templates/full/forum_topic.tplEdit templateOverride template
2content/datatype/view/ezimage.tpl<No override>extension/sevenx/design/simple/templates/content/datatype/view/ezimage.tplEdit templateOverride template
3content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
12content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
9content/datatype/view/ezxmltags/line.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/line.tplEdit templateOverride template
1pagelayout.tpl<No override>extension/sevenx/design/simple/templates/pagelayout.tplEdit templateOverride template
 Number of times templates used: 28
 Number of unique templates used: 6

Time used to render debug report: 0.0002 secs