Hi Jeremie,
adding the member to the group works just well. The problem is that the
same user or say member can be added several times to the same group. I
need some means to stop this.
I can't see that log.
Thanks
Am 11.06.2014 01:08 schrieb "Jeremie BOUSQUET" <[email protected]>:

> Hi,
> Le 10 juin 2014 21:09, "Daniel Ebanja" <[email protected]> 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
> > [email protected]
> > http://lists.xwiki.org/mailman/listinfo/users
> _______________________________________________
> users mailing list
> [email protected]
> http://lists.xwiki.org/mailman/listinfo/users
>
_______________________________________________
users mailing list
[email protected]
http://lists.xwiki.org/mailman/listinfo/users

Reply via email to