Forums / Developer / Custom userclass cannot be assigned roles!?

Custom userclass cannot be assigned roles!?

Author Message

Werner Klausen

Sunday 17 July 2005 5:47:07 am

I have a custom class called "Person" which contains the user-attribute. However, I am not able to add a role to instances of this calss, the radiobuttons are all greyed out.

If I make an instance of the premade "User" class, all is well.

So, the question is: How can I make a custom class, that I can assign roles? Is this maybe a bug?

I've treided this on both my upgraded eZ 3.6 version and e freshinstall of 3.6 (just to check there was nothing wrong with the upgrade).

Thanks =)

Because I can!

Bruce Morrison

Sunday 17 July 2005 9:03:50 pm

Hi Werner

Does the new class reside in the 'Users' Class group?
(i.e. /class/classlist/2 )

Cheers
Bruce

My Blog: http://www.stuffandcontent.com/
Follow me on twitter: http://twitter.com/brucemorrison
Consolidated eZ Publish Feed : http://friendfeed.com/rooms/ez-publish

Werner Klausen

Monday 18 July 2005 2:41:44 pm

Hi Bruce!

Yes, the class resides in both the User and content classgroups. So I am able to make an instance of the class from both the "Content structure" and the "User accounts" screen.

The calss is assigned a small green man-icon, so I guess it's interpeded by the system as a user-class. (However, the testclasses I make do NOT get this icon, but only has the common "sheet"-icon)

Because I can!

Bruce Morrison

Monday 18 July 2005 5:02:23 pm

Hi Werner

Not sure. The only other thing to check is if the new users you are creating are assigned the "Users" Section: (/section/view/2)

Cheers
Bruce

My Blog: http://www.stuffandcontent.com/
Follow me on twitter: http://twitter.com/brucemorrison
Consolidated eZ Publish Feed : http://friendfeed.com/rooms/ez-publish

Daniel Beyer

Tuesday 19 July 2005 2:28:37 am

Hi Werner,

by default eZ publish is configured to assign roles only to users (a class with the identifier "user") and to usergroups (a class with the identifier "user_group").

This behavior can be changed or extended by other class identifiers. Take a look into the file /settings/browse.ini. In it you will find a Section called "[AssignRole]", which looks like this:

# Action used when assigning a role to a user or user group
[AssignRole]
StartNode=users
SelectionType=single
ReturnType=ObjectID
Class[]
Class[]=user
Class[]=user_group
TopLevelNodes[]
TopLevelNodes[]=users

This defines that you can choose in browse mode only objects where the class identifier is either "user" or "user_group" and where the objects placed on the TopLevelNode "users".

If you want to assign roles to other classes you have to extend this section in browse.ini or an override of it. For example create a file /settings/override/browse.ini.append and write something like this into it:

[AssignRole]
Class[]=my_custom_user
Class[]=an_alternate_user_group

Of course you have to replace "my_custom_user" and "an_alternate_user_group" with the identifiers of the classes you created.

If you don't care about assigning roles only to specific classes you can either just delete the "Class[]" entries of section "[AssignRole]" from /settings/browse.ini or add something like this into an e.g. /settings/override/browse.ini:

[AssignRole]
Class[]

Now it is possible to assign roles to any object (folder, images, articles, ...) placed on TopLevelNode "users". But I really <b>don't</b> recommend this! Take the time and configure your system to assign roles only to specific classes (as in my first example).

Daniel Beyer
_________________________________
YMC AG
Kreuzlingen, Switzerland
web: www.ymc.ch
____________________________________

Werner Klausen

Wednesday 20 July 2005 6:11:28 am

Thanks all for helping out :)

I'm on vacation right now, so I'll get to it when I get back! Have a nice summer =)

Because I can!

Raymond Williams

Friday 29 September 2006 11:07:22 am

Just like to add a note that this post was /very/ useful to me. Addressed and solved my specific need, worked like a charm. Thank you Daniel!!

Marco Zinn

Saturday 30 September 2006 1:59:07 am

Just a quick "this saved my life, too". Thx.

Marco
http://www.hyperroad-design.com

eZ debug

Timing: Jan 18 2025 14:52:14
Script start
Timing: Jan 18 2025 14:52:14
Module start 'content'
Timing: Jan 18 2025 14:52:15
Module end 'content'
Timing: Jan 18 2025 14:52:16
Script end

Main resources:

Total runtime1.6867 sec
Peak memory usage4,096.0000 KB
Database Queries215

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0074 588.9766180.8125
Module start 'content' 0.00741.4609 769.7891730.5156
Module end 'content' 1.46820.2183 1,500.3047344.4297
Script end 1.6866  1,844.7344 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00440.2605210.0002
Check MTime0.00150.0912210.0001
Mysql Total
Database connection0.00080.049410.0008
Mysqli_queries1.588394.16982150.0074
Looping result0.00300.17932130.0000
Template Total1.644297.520.8221
Template load0.00220.128120.0011
Template processing1.642097.353820.8210
Template load and register function0.00020.012210.0002
states
state_id_array0.00130.079810.0013
state_identifier_array0.00170.100120.0008
Override
Cache load0.00190.1104490.0000
Sytem overhead
Fetch class attribute can translate value0.00220.129360.0004
Fetch class attribute name0.00130.0744120.0001
XML
Image XML parsing0.00520.306360.0009
class_abstraction
Instantiating content class attribute0.00000.0017150.0000
General
dbfile0.00770.4538420.0002
String conversion0.00000.000430.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
7content/datatype/view/ezimage.tpl<No override>extension/sevenx/design/simple/templates/content/datatype/view/ezimage.tplEdit templateOverride template
8content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
14content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
3content/datatype/view/ezxmltags/line.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/line.tplEdit templateOverride template
3content/datatype/view/ezxmltags/literal.tpl<No override>extension/community/design/standard/templates/content/datatype/view/ezxmltags/literal.tplEdit templateOverride template
1pagelayout.tpl<No override>extension/sevenx/design/simple/templates/pagelayout.tplEdit templateOverride template
 Number of times templates used: 37
 Number of unique templates used: 7

Time used to render debug report: 0.0002 secs