Hi!
Gerritjan Koekkoek wrote:
Hi,
I really appreciate your interest, this really helps me; Thanks
You are very right, If users are redirected to their profile they are not forced to enter
any extra data.
But we will put a text in the profile page that it would be very helpfull if they did;
If they do not, we will not add them to to more functional group, so, i hope, it is also
in their interest
if they want more functionality. This is, by means a manual process, we do not want that
the WIKI is crowded with visitors
that do not ADD to our community
I think Curriki people have done a nice work to create a custimized
registering process. Do you know Curriki? Check this...
http://www.curriki.org
Register yourself and will see the look and feel of the process.
One principle is that I try to do everything from
within the WIKI and stay away from configuration files.
WE are hosting our wiki on a external system, so it is difficult to get access to
filesystem anyway!
Second; we are fully happy with the default behaviour of to what groups a registered user
is added after registration
I do agree with this approach. It also helps in the upgrade process.
There are a number of "extension things" playing around lately in XWiki
that is worth to pay attention to! For JavaScript and Stylesheet
extensions seam simply great... even though I'm not able to use them
yet! :-) The Extensions Manager will ease the process.
Regarding the modification of the login.vm, I think it is quite simple
to copy login.vm to a customized skin.
Regarding the login.vm modification
(snippet from default login.vm in XWIKI 2.5
#if ($xcontext.user != 'XWiki.XWikiGuest')
#if ($request.xredirect)
$response.sendRedirect($request.xredirect)
#else
$response.sendRedirect($xwiki.getURL('Main.WebHome'))
#end
#elseif($doc.fullName != 'XWiki.XWikiLogin')
#set($qs = "$!{request.queryString}")
#if(!$request.getParameter('xredirect'))
#set($qs =
"xredirect=$escapetool.url($doc.getURL('view'))&${qs}")
#end
$response.sendRedirect($xwiki.getURL('XWiki.XWikiLogin', 'login',
$qs))
#else
###
### Login page
###
###
...
#end
I think I should inject the code after #if ($xcontext.user !=
'XWiki.XWikiGuest')
You think I could use #includeInContext('YourSpace.YourDocument') or would a
macro make more sense?
I'm always trying to keep standard XWIKI code as supplied with the product as
standard as possible, otherwise
I'm facing more complex upgrade paths?
Have you tried this? I'm not able to get it working. Or there is some
more element involved in the login process, or I don't
understand the first code chunk behaviour. I've substitute this block...
#if ($xcontext.user != 'XWiki.XWikiGuest')
#if ($request.xredirect)
$response.sendRedirect($request.xredirect)
#else
$response.sendRedirect($xwiki.getURL('Main.WebHome'))
#end
#elseif($doc.fullName != 'XWiki.XWikiLogin')
#set($qs = "$!{request.queryString}")
#if(!$request.getParameter('xredirect'))
#set($qs =
"xredirect=$escapetool.url($doc.getURL('view'))&${qs}")
#end
$response.sendRedirect($xwiki.getURL('XWiki.XWikiLogin', 'login', $qs))
#else
with this one...
#if ($xcontext.user != 'XWiki.XWikiGuest')
$response.sendRedirect($xwiki.getURL('XWiki.RogerGoldman'))
#else
And I keep being redirected to the homepage after log in.
XWiki.RogerGoldman is a dummy user and it exists. It works when included
in a "regular" document. See this..
http://epecnetcore.environmentalchange.net:8080/xwiki/bin/view/ICT/Redirect
Please, do you understand why? Thanks!
Gerritjan
Op 25 okt 2010, om 23:59 heeft [Ricardo Rodriguez] eBioTIC. het volgende geschreven:
Gerritjan Koekkoek wrote:
Hi,
The condition is:
After user has registered he/she only belongs to XWikiAllGroup (right?)
Right, by default. You should want to consider these two parameters in
xwiki.cfg (as stated in its preamble, commented parameters show the
default value)
#-# List of groups that a new user should be added to by default after
registering. Comma-separated list of group document
#-# names.
# xwiki.users.initialGroups=XWiki.XWikiAllGroup
#-# Should all users be considered members of XWiki.XWikiAllGroup, even
if they don't have an associated object in the
#-# group's document?
# xwiki.authentication.group.allgroupimplicit=0
If this condition is true; we would like to ask
the user to 'tell us more about yourself' by re-directing to the profile
But redirecting to her/his profile doesn't enforce more information to
be entered. Please, how are you planning to get that? Users can just
arrive to their profiles and to enter nothing.
Updating the userprofile with extra data; with
this data we can then add the user to appropriate group(s)
I understand : the $query will give all groups in the wiki except XWikiAllGroup
Yes, the query retrieves all documents with an instance of class
XWiki.XWikiGroups (obj.className='XWiki.XWikiGroups') but
XWiki.XWikiGroupTemplate and XWiki.XWikiAllGroup
In the foreach you add 1 to the counter for each
group the user is extra in?
Yes
So if the counter > 0 the user belongs to
extra group so should NOT be redirected
OK! I got the condition the other way round!
if the counter still == 0 then the redirect
should happen?
OK. I understand now.
The login.vm seems indeed to be the place to be,
I prefer to copy the vm into my skin, so I will override the login.vm on the disk
Op 24 okt 2010, om 22:47 heeft [Ricardo Rodriguez] eBioTIC. het volgende geschreven:
Hi,
Gerritjan Koekkoek wrote:
Hi,
The script works fine;
One modification required (#if($counter > 0) ==> #if($counter == 0)
I'm afraid I don't understand the condition yet! :-( Do you want
that
any user belonging to any group but XWikiAllGroup is redirected to
his/her profile? Or should be only XWikAllGroup members whom must be
redirected to his/her profile page?
Just trying to understand why do you need == instead o >. Thanks!
But this only works when user login is on
homepage, in our use cases there are also other pages where a guest can decide to login
Is there a vm script that is always triggered when user does login?
OK! I've not taken this into account! login.vm in your /templates
folder
seems to be the right place to tweak.
Gerritjan
Op 24 okt 2010, om 01:52 heeft [Ricardo Rodriguez] eBioTIC. het volgende geschreven:
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
Greetings!
Cheer!
Ricardo
--
Ricardo Rodríguez
CTO
eBioTIC.
Life Sciences, Data Modeling and Information Management Systems