Hi,
Gerritjan Koekkoek wrote:
Hi,
We would like to, conditionally, redirect users who log in to their profile page. (in
our case; XWiki.<username>)
The condition is: User is not in ANY OTHER GROUP then XWikiAllGroup.
How can I do this most elegantly, modifying as little as possible of the standard pages
that come with a distribution of XWIKI
This is not elegant, but I think it works:
#set($counter = 0)
#set($user = $xwiki.getUser())
#set($userContext = $context.user)
#set($query = ", BaseObject as obj, StringProperty as prop where
doc.fullName = obj.name and obj.className='XWiki.XWikiGroups' and
doc.fullName <> 'XWiki.XWikiGroupTemplate' and doc.fullName <>
'XWiki.XWikiAllGroup' order by doc.fullName asc")
#set($results=$xwiki.searchDocuments($query))
<p/>
#foreach($item in $results)
#if($user.isUserInGroup($item))
#set($counter = $counter+1)
#end
#end
#if($counter > 0)
$response.sendRedirect($xwiki.getURL($userContext))
#end
You could copy and paste in your WebHome or create an ad hoc document
and use #includeInContext('YourSpace.YourDocument') to include it in
your WebHome.
HTH,
Ricardo
--
Ricardo RodrÃguez
CTO
eBioTIC.
Life Sciences, Data Modeling and Information Management Systems