Drop down class list

Author Message

Nicolas Gommenginger

Thursday 14 January 2010 7:59:38 am

Hi,

In the back-office, I would to limit the drop down class list for the creation of a new element functions of the current node.

For exemple, I have a class "articles_root", if the admin goes to this node and would like to create a new article in it, I would like that the drop down class list contains only the class articles.

Thanks.

Nico

Nicolas Pastorino

Thursday 14 January 2010 11:38:11 pm

Hi Nicolas,

The usual way of restricting the list of allowed content classes for creation at a given location in the tree is to use the access control system. The content | create policy accepts such limitations.
But your case seems to be more of a functional use case than a security question, and the method exposed above might not be suitable. A possible solution would be to build this drop down by hand, in the template you are using for this. I would advise to always verify the list you are building against the authorized one, for security reasons. The latter is available in a node template as follows:

$node.object.can_create_class_list

which takes into account the currently logged in user and the context (location, type of object viewed, section number, ...). You could then further filter this variable.

Hope that helps, cheers!

--
Nicolas Pastorino
Director Community - eZ
Member of the Community Project Board

eZ Publish Community on twitter: http://twitter.com/ezcommunity

t : http://twitter.com/jeanvoye
G+ : http://plus.tl/jeanvoye

Powered by eZ Publish™ CMS Open Source Web Content Management. Copyright © 1999-2014 eZ Systems AS (except where otherwise noted). All rights reserved.

eZ debug

Timing: Jan 18 2025 11:35:09
Script start
Timing: Jan 18 2025 11:35:09
Module start 'layout'
Timing: Jan 18 2025 11:35:09
Module start 'content'
Timing: Jan 18 2025 11:35:10
Module end 'content'
Timing: Jan 18 2025 11:35:10
Script end

Main resources:

Total runtime0.9440 sec
Peak memory usage4,096.0000 KB
Database Queries54

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0051 588.9297152.6094
Module start 'layout' 0.00510.0031 741.539139.4141
Module start 'content' 0.00830.9343 780.9531525.6563
Module end 'content' 0.94260.0014 1,306.60948.1875
Script end 0.9440  1,314.7969 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00400.4287160.0003
Check MTime0.00150.1635160.0001
Mysql Total
Database connection0.00080.086810.0008
Mysqli_queries0.895394.8399540.0166
Looping result0.00060.0617520.0000
Template Total0.906196.020.4530
Template load0.00260.274120.0013
Template processing0.903595.705220.4517
Template load and register function0.00030.028210.0003
states
state_id_array0.00160.164310.0016
state_identifier_array0.00180.185720.0009
Override
Cache load0.00220.2331160.0001
Sytem overhead
Fetch class attribute can translate value0.00090.099120.0005
Fetch class attribute name0.00260.270230.0009
XML
Image XML parsing0.00060.063820.0003
class_abstraction
Instantiating content class attribute0.00000.001130.0000
General
dbfile0.00230.2446160.0001
String conversion0.00000.000740.0000
Note: percentages do not add up to 100% because some accumulators overlap

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/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
4content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
1content/datatype/view/ezimage.tpl<No override>extension/sevenx/design/simple/templates/content/datatype/view/ezimage.tplEdit templateOverride template
1content/datatype/view/ezxmltags/line.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/line.tplEdit templateOverride template
1content/datatype/view/ezxmltags/literal.tpl<No override>extension/community/design/standard/templates/content/datatype/view/ezxmltags/literal.tplEdit templateOverride template
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 11
 Number of unique templates used: 7

Time used to render debug report: 0.0001 secs