<
From version < 6.1 >
edited by Guillaume Delhumeau
on 2014/09/16
To version < 7.1 >
edited by Marius Dumitru Florea
on 2014/09/16
>
Change comment: There is no comment for this version

Summary

Details

Page properties
Author
... ... @@ -1,1 +1,1 @@
1 -XWiki.gdelhumeau
1 +XWiki.mflorea
Content
... ... @@ -29,10 +29,45 @@
29 29  
30 30  = For Developers =
31 31  
32 -== <developer feature N> ==
32 +== Velocity macro to display users and groups ==
33 33  
34 -<description of developer feature N>
34 +We extracted the code that displays in view mode a property of type 'List of Users' and 'List of Groups' from the corresponding custom displayers (found in ##displayer_users.vm## and ##displayer_groups.vm##) into two Velocity macros that can be used to display arbitrary users and groups, even when you don't have an object. Here's how you can use them:
35 35  
36 +{{code language="none"}}
37 +{{velocity}}
38 +{{html wiki="true"}}
39 += Users =
40 +== Just one ==
41 +#displayUser('XWiki.Admin')
42 +
43 +== List of users ==
44 +#displayUser(['Admin', 'XWiki.mflorea'])
45 +
46 +== A reference of a user ==
47 +#displayUser($xcontext.userReference)
48 +
49 +== A list of references of users ==
50 +#displayUser([$xcontext.userReference, $otherUserReference])
51 +
52 += Groups =
53 +== Just one ==
54 +#displayGroup('XWiki.XWikiAdminGroup')
55 +
56 +== List of groups ==
57 +#displayGroup(['XWikiAdminGroup','XWiki.HRGroup'])
58 +
59 +== A reference of a group ==
60 +#set($adminGroupRef = $services.model.resolveDocument('XWiki.XWikiAdminGroup'))
61 +#set($allGroupRef = $services.model.resolveDocument('XWiki.XWikiAllGroup'))
62 +#displayGroup($adminGroupRef)
63 +
64 +== A list of references of groups ==
65 +#displayGroup([$adminGroupRef, $allGroupRef])
66 +
67 +{{/html}}
68 +{{/velocity}}
69 +{{/code}}
70 +
36 36  == Deprecated and Retired projects ==
37 37  
38 38  <description of deprecated and retired projects>

Get Connected