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.