This works fine for me:
{{velocity}}
#set ($internalObject =
$xwiki.getDocument($xcontext.user).getObject('XWiki.XWikiUsers').getXWikiObject())
$internalObject.getStringValue('email')
{{/velocity}}
userObj should be the same as my $internalObject
Hope this helps,
Marius
On Wed, Nov 20, 2013 at 11:35 PM, Valdis Vītoliņš
<valdis.vitolins(a)odo.lv> wrote:
I got stuck with customized validation for XWikiUsers
class using XWiki
5.2. I have custom sheet with validation with following code excerpt:
public class PersonValidation implements XWikiValidationInterface {
public boolean validateDocument(XWikiDocument doc, XWikiContext
context) {
// Validation result
def res = true;
// User settings from the session context
def session=context.getRequest().getSession();
def user = context.getUser();
def userObj=context.getWiki().getDocument(user,
context).getObject('XWiki.XWikiUsers');
if(true) {
XWikiValidationStatus.addErrorToContext('NMPDtools.UserClass',
'', '', 'E-mail is '+userObj.getStringValue('email'),
context);
res = false;
}
return res;
}
public boolean validateObject(BaseObject object, XWikiContext context)
{
return true;
}
}
In difference with first_name, last_name, phone, etc. This method
doesn't return property value.
I noted, that using passed XWiki context, BaseObject is retured in
difference with Object for inline scripts, where get... methods works
properly.
If nothing else, is there is way to get Object from BaseObject?
Any suggestions ar welcome!
Valdis
_______________________________________________
devs mailing list
devs(a)xwiki.org
http://lists.xwiki.org/mailman/listinfo/devs