Restricting the creation of objects basing on parent type

Author Message

Pratibha Gannavarapu

Tuesday 16 May 2006 11:53:52 pm

Hi
I am trying to change my admin interface in such a way that the user on the backend can create only articles under folders and can create only comments under the articles. I have achieved this by changing the template but is there any other decent way for it?

Cheers

Kristof Coomans

Wednesday 17 May 2006 12:46:09 am

Hi Pratibha

You'd better use role based access control to do this. Read http://ez.no/doc/ez_publish/technical_manual/3_7/concepts_and_basics/access_control

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

Pratibha Gannavarapu

Wednesday 17 May 2006 5:03:18 pm

Hey Kristof
Thanks for that reply.
But to my understanding the admin has access to everything and if I log onto backend as 'admin' user then I would be able to create any object type under any node isnt it?
To achieve this the change I have made in template is a bit cumbersome. I have got in a switch case in the template which checks the current node type in children.tpl and basing upon that the select would have the required options only. This is literally hacking the template but the result is what I want. No other way other than access control? I am using 3.8.

Also I am having another problem with Events and triggers. I have read some articles and documentation regarding the url aliases. I know that ezPub does this automatically by creating a record for the system url and also a virtual url in the DB. But if I am having a customized view 'text view' for article and everytime user creates an article and publishes it I want a trigger that could enter a new record in the URL aliases table to create a alias foir the text view. But the current 'event-trigger' system appears to be fully workflow oriented. So wondering how can I achieve this instead of tampering with the 'Kernel code'. Do I need to write an extension for this?

Thanks
Pratibha

Kristof Coomans

Wednesday 17 May 2006 11:00:29 pm

Administrator users will have access to everything, that's correct. If you don't want that, you can create another user account for doing daily tasks like publishing content.

Do you currently access the text view of your articles with content/view/text/[nodeid] or something like that? Automatically making URL aliases (e.g. based on the object name) for it could be done with the workflow system, but then you'll need to program your own workflow event. There's no contribution yet that provides this functionality.

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

Pratibha Gannavarapu

Thursday 18 May 2006 12:04:13 am

Thanks very much for that Kristof.
Hmm right.. I might just leave the template hacking then :) because though I go to access restrictions I might still want the user to to be able to create the classes just that in specific locations instead of keeping it generalized.

Yes the text view of articles is being viewed as /content/view/text/[nodeid]. Yes I thought I will have to do my own event. But in the future releases of the ezPublish is their any specs for having a more generalised 'event-trigger' system so that this can be more generalised and be not so specific tro workflow? Cause that could solve many situations where you want a specific action to be triggered basing upon the user's action.

The other problem I am right now facing is that I have created a new custom section called newsletter in my site and have changed the menu.ini file in such a way that this section is shown as a tab in the admin interface along with content, media setup etc. And I have assigned a part of the content structure tree to this section. Now my problem is I dont want this part of subtree to be displayed under content structure anymore and also dont want this subtrees parents to be displayed in the tree structure while viewing the newsletter navigation part.
Any help on this?

Pratibha Gannavarapu

Thursday 18 May 2006 5:26:59 pm

Ok Regading my problems with custom section I found sonme solution which is a bit hacky but I could not figure out a more decent way for it.
1. I figured out that having a custom eznavigationpart is a solution to not to display the required subtree's parents in the newsletter navigatoin. By this we are creating a own navigation for the newsletter tab. So in the pagelayout.tpl a added another couple of lines code that are specific to newsletter tab.

{section show=eq( $navigation_part.identifier, 'eznewsletternavigationpart' )}
{include uri='design:parts/newsletter/menu.tpl'}
{/section}

By this I am saying that whenever user is trying to navigate to the newsletter part then use the menu.tpl in that specific folder. And I copied over the menu.tpl from design:parts/media/menu.tpl but changed bits of code to use NewsletterRootNode for the root node instead of MediaRootNode which worked pretty good.

2. For the second part that the content structure is still displaying the subtree of newsletter section is because it is still the subtree. So now I played with the database and changed the tables ez_nodeassignment and ez_objectTree to specify that the top node of the subtree is the directly under the parent_node '1' and changed the paths accordingly and it worked. But I would really love to have a decent way for it so that everytime I decide on a new section and decide on moving a subtree to that section I will have to tweak the database :(

Cheers
Pratibha

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 21 2025 02:35:56
Script start
Timing: Jan 21 2025 02:35:56
Module start 'layout'
Timing: Jan 21 2025 02:35:56
Module start 'content'
Timing: Jan 21 2025 02:35:58
Module end 'content'
Timing: Jan 21 2025 02:35:58
Script end

Main resources:

Total runtime1.6894 sec
Peak memory usage4,096.0000 KB
Database Queries66

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0068 588.1719151.2422
Module start 'layout' 0.00680.0026 739.414136.7109
Module start 'content' 0.00941.6788 776.1250605.0000
Module end 'content' 1.68820.0011 1,381.125015.7813
Script end 1.6893  1,396.9063 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00360.2129160.0002
Check MTime0.00150.0908160.0001
Mysql Total
Database connection0.00120.071010.0012
Mysqli_queries1.631596.5745660.0247
Looping result0.00110.0673640.0000
Template Total1.634496.720.8172
Template load0.00200.117320.0010
Template processing1.632496.630120.8162
Template load and register function0.00020.009910.0002
states
state_id_array0.00570.335910.0057
state_identifier_array0.00230.135520.0011
Override
Cache load0.00170.1009380.0000
Sytem overhead
Fetch class attribute can translate value0.00080.048420.0004
Fetch class attribute name0.00150.090070.0002
XML
Image XML parsing0.00080.048220.0004
class_abstraction
Instantiating content class attribute0.00000.001080.0000
General
dbfile0.00090.0527160.0001
String conversion0.00000.000440.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
6content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
8content/datatype/view/ezxmltags/line.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/line.tplEdit templateOverride template
10content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
2content/datatype/view/ezimage.tpl<No override>extension/sevenx/design/simple/templates/content/datatype/view/ezimage.tplEdit templateOverride template
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 28
 Number of unique templates used: 6

Time used to render debug report: 0.0001 secs