Forums / Setup & design / Parent classes and child classes

Parent classes and child classes

Author Message

Andrey Astakhov

Friday 07 July 2006 10:15:10 am

I have 3 classes: Class A, Class B, Class C.
Class A is a container.
I need to setup it so that an instance of Class A could contain ONLY instances of classes B and C.
For example, <b>User groups</b> could contain only <b>Users</b>.

If is very simple, just show me please a page in the eZ documentation.

Łukasz Serwatka

Friday 07 July 2006 11:15:59 am

Hi Andre,

You did not specify if your question is related directly to permissions but, you can easily setup new police as following:

Module: content
Function: create
Limitations: Class( Class B , Class C ) , ParentClass( Class A )

Module: content
Function: edit
Limitations: Class( Class B , Class C )

This means that you can create objects as instance of classes Class B and Class C under object as instance Class A.

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

Andrey Astakhov

Friday 07 July 2006 1:09:35 pm

Thank you, Lukasz!

<i>You did not specify if your question is related directly to permissions ...</i>

Yes, you are right.
I already knew this approach with permissions and limitations, but i'm not sure that it is single and best approach. It is impossible to add an instance of the class "User" to content tree, isn't it? Is it based on permissions?
I wondering is there another approach: probably object relations or something like this?

Łukasz Serwatka

Friday 07 July 2006 1:30:57 pm

By default you can't create User object as instance in the content tree. Other approach is that you can control edit form on the template level, if current node class id/identifier is "something" then show "create new object" edit form or not. I would recommend use permissions for control if user has access to create new object under specified content classes.

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

Andrey Astakhov

Friday 07 July 2006 1:39:58 pm

Ok, thank you.
About permissions: my user from the user group "Editors" doesn't see content tree in the left panel. How should i change his permissions to allow him see (and navigate through) this tree?