Hi, Le 10 juin 2014 21:09, "Daniel Ebanja" <danielebanja@googlemail.com> a écrit :
Hi, i am adding Users to a group as shown below d want to prevent that a user be added to a group twice. It is not working this way.
if( null == groupDoc.getXObject(groupDocumentReference, "member", xwikiname)){
I never used this method, and its javadoc could be improved, are you sure it does what you think ? ;) You could use something like (to be checked): xwiki.getUser("username", context).isUserInGroup("group")
// Add a member object to document BaseObject memberObj = groupDoc.newXObject( groupClass.getDocumentReference(), context); memberObj.setStringValue("member", xwikiname);
context.getWiki().saveDocument(groupDoc, context); }else log.error("the user already existed in the requested group...");
You say it doesn't work, but do you see that log ? What happens ?
I will appreciate any help. Thanks _______________________________________________ users mailing list users@xwiki.org http://lists.xwiki.org/mailman/listinfo/users