How to check if content author/owner is in my user group?

Author Message

Aleksander Lech

Monday 20 February 2006 2:08:07 am

Hi there -
as I ask above: I'd like to check if author/owner of given object belongs to my user group.
I can get:

{def $user=fetch( 'user', 'current_user' )}
Group(s): {$user.groups|implode(', ')} <br />

and this lists groups I belong to, but how to check if content author belongs to one or more of my user groups?

Greetz
Aleksander

Aleksander Lech

Wednesday 22 February 2006 12:41:23 am

Well,
searching brings no solution :(

{def $user=fetch( 'user', 'current_user' )}
Group(s): {$user.groups|implode(', ')} <br />

Shows current users' groups, but I want to get groups of user with for example id=523

I didn't find apropriate function :(
Function user - according to docs - can fetch current_user but how to fetch user of given id??

Aleksander

Ɓukasz Serwatka

Wednesday 22 February 2006 1:21:54 am

You can fetch user object, then access user_account. Try with this code:

{ * Replace user_account with your attribute user account name * }
{def user_object=fetch( 'content', 'object', hash( 'object_id', 14 ) )}
   {$user_object.data_map.user_account.content.groups|attribute(show,1)}

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

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:28:16
Script start
Timing: Jan 18 2025 11:28:16
Module start 'layout'
Timing: Jan 18 2025 11:28:16
Module start 'content'
Timing: Jan 18 2025 11:28:17
Module end 'content'
Timing: Jan 18 2025 11:28:17
Script end

Main resources:

Total runtime0.7196 sec
Peak memory usage4,096.0000 KB
Database Queries57

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0053 589.6172152.6563
Module start 'layout' 0.00530.0048 742.273439.5078
Module start 'content' 0.01010.7080 781.7813540.7813
Module end 'content' 0.71820.0014 1,322.562512.0938
Script end 0.7195  1,334.6563 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00320.4500160.0002
Check MTime0.00140.1912160.0001
Mysql Total
Database connection0.00090.121610.0009
Mysqli_queries0.672593.4617570.0118
Looping result0.00050.0709550.0000
Template Total0.688595.720.3443
Template load0.00210.292820.0011
Template processing0.686495.390720.3432
Template load and register function0.00020.029210.0002
states
state_id_array0.00090.128110.0009
state_identifier_array0.00070.097020.0003
Override
Cache load0.00180.2456220.0001
Sytem overhead
Fetch class attribute can translate value0.00060.080520.0003
Fetch class attribute name0.00130.185240.0003
XML
Image XML parsing0.00070.090720.0003
class_abstraction
Instantiating content class attribute0.00000.001740.0000
General
dbfile0.00080.1132180.0000
String conversion0.00000.001540.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
3content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
4content/datatype/view/ezxmltags/line.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/line.tplEdit templateOverride template
7content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
3content/datatype/view/ezxmltags/literal.tpl<No override>extension/community/design/standard/templates/content/datatype/view/ezxmltags/literal.tplEdit templateOverride template
1content/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: 20
 Number of unique templates used: 7

Time used to render debug report: 0.0001 secs