Re: [xwiki-users] Creating user using XML RPC.... and also how to add the user in default group with the xwiki all group rights via xml rpc/programmatically??

2010-03-09 Thread Nithya Vembu

Hi Dilip,

 Thanks for the valuable reply.

  I tried your example with this set of code and password also able to
create for the user. But i didnt checked whether its plain text or hashed..
I used this snippet of code

XWikiObject xobj = new XWikiObject();
xobj.setClassName(XWiki.XWikiUsers);
xobj.setPageId(XWiki.testuser);
xobj.setProperty(first_name, Test);
xobj.setProperty(last_name, User);
xobj.setProperty(password, aa);
rpc.storeObject(xobj); 

If you check the xwiki-core..jar, you can find the class com.xpn.xwiki.
XWiki  and method getUserClass() which has properties which you are meaning
here. I hope we can use all the properties depends on  our need.

Thanks,
Nithya.


And i logined as test user and its successfully working.


-- 
View this message in context: 
http://n2.nabble.com/Creating-user-using-XML-RPC-tp4669004p4701447.html
Sent from the XWiki- Users mailing list archive at Nabble.com.
___
users mailing list
users@xwiki.org
http://lists.xwiki.org/mailman/listinfo/users


Re: [xwiki-users] Creating user using XML RPC....

2010-03-08 Thread Dilipkumar Jadhav
Hi Nithya,
As Sergiu rightly said, an XWiki user is just another document/Page with a
XWiki.XWikiUser object associated to it.
Hope the following example helps you in creating users using XMLRPC.
Please note that I have only been able to create a user. Setting the
password is something I did not have much luck with.
Probably, the XMLRPC API method to set the password property stores the
password in plain text when in fact XWiki expects passwords which are
hashed.
I hope someone on the mailing list could help by providing the code snippet
to update password using XMLRPC. Once, that is done, we can save this
example  at
http://platform.xwiki.org/xwiki/bin/view/Features/XMLRPCJavaExamples




import java.net.MalformedURLException;
import org.apache.xmlrpc.XmlRpcException;
import org.codehaus.swizzle.confluence.Page;
import org.xwiki.xmlrpc.XWikiXmlRpcClient;
import org.xwiki.xmlrpc.model.XWikiObject;

public class CreateUser {

public static void main(String[] args) throws MalformedURLException,
XmlRpcException {

//URL of the xwiki instance
String url = http://localhost:8080/xwiki/xmlrpc/confluence;;

//Replace user  pass with desired xwiki username  password
String user = Admin;
String pass = admin;

XWikiXmlRpcClient rpc = new XWikiXmlRpcClient(url);
try {
//Perform Login  Authentication
rpc.login(user, pass);

//Create a Page to hold the user profile  set it's three
important attributes viz. Space, Title, Content
//Set the space=XWiki since all XWiki users go to
XWiki space by default
//Set title to the username of the user. In our
case, username=testuser
//Set content to include the XWikiUserSheet. 
//Without this the user Page will come up blank and
no fields will be displayed

Page page = new Page();
page.setSpace(XWiki);
page.setTitle(testuser);
page.setId(XWiki.testuser);
page.setContent({{include
document=\XWiki.XWikiUserSheet\/}});
rpc.storePage(page);

//Create a XWikiObject and set the class to
XWiki.XWikiUsers
//Set the host Page as XWiki.testuser. This is the
page we created in the steps above
//Set the first_name  last_name properties with
values Test and User respectively
//We can access the list of all properties for a
User class at the following link:

//http://localhost:8080/xwiki/bin/edit/XWiki/XWikiUsers?editor=class
//Finally, save the object using rpc.storeObject

XWikiObject xobj = new XWikiObject();
xobj.setClassName(XWiki.XWikiUsers);
xobj.setPageId(XWiki.testuser);
xobj.setProperty(first_name, Test);
xobj.setProperty(last_name, User);
rpc.storeObject(xobj);

} catch (XmlRpcException e) {
System.out.println(e);
} finally {
rpc.logout();
}
}
}
 



Message: 1
Date: Wed, 3 Mar 2010 09:33:05 -0800 (PST)
From: Nithya Vembu nithu...@gmail.com
Subject: [xwiki-users] Creating user using XML RPC
To: users@xwiki.org
Message-ID: 1267637585814-4669004.p...@n2.nabble.com
Content-Type: text/plain; charset=us-ascii


Hi All,

 Is there any sample available to create a user through XML RPC like the
examples in the following link for creation of page, space etc..

http://platform.xwiki.org/xwiki/bin/view/Features/XMLRPCJavaExamples

Please help me out if there any solution.

Thanks,
Nithya.
-- 
View this message in context:
http://n2.nabble.com/Creating-user-using-XML-RPC-tp4669004p4669004.html
Sent from the XWiki- Users mailing list archive at Nabble.com.


--

Message: 2
Date: Wed, 03 Mar 2010 19:23:44 +0100
From: Sergiu Dumitriu ser...@xwiki.com
Subject: Re: [xwiki-users] Creating user using XML RPC
To: XWiki Users users@xwiki.org
Message-ID: 4b8ea930.8020...@xwiki.com
Content-Type: text/plain; charset=UTF-8; format=flowed

On 03/03/2010 06:33 PM, Nithya Vembu wrote:

 Hi All,

   Is there any sample available to create a user through XML RPC like the
 examples in the following link for creation of page, space etc..

 http://platform.xwiki.org/xwiki/bin/view/Features/XMLRPCJavaExamples

 Please help me out if there any solution.

A user is just like any other document+object. Just do what's usually 
done for creating a new document and adding a XWiki.XWikiUsers object.

Don't forget to add the user to the groups you want.

-- 
Sergiu Dumitriu
http://purl.org/net/sergiu/


--

___
users mailing list
users@xwiki.org

[xwiki-users] Creating user using XML RPC....

2010-03-03 Thread Nithya Vembu

Hi All,

 Is there any sample available to create a user through XML RPC like the
examples in the following link for creation of page, space etc..

http://platform.xwiki.org/xwiki/bin/view/Features/XMLRPCJavaExamples

Please help me out if there any solution.

Thanks,
Nithya.
-- 
View this message in context: 
http://n2.nabble.com/Creating-user-using-XML-RPC-tp4669004p4669004.html
Sent from the XWiki- Users mailing list archive at Nabble.com.
___
users mailing list
users@xwiki.org
http://lists.xwiki.org/mailman/listinfo/users


Re: [xwiki-users] Creating user using XML RPC....

2010-03-03 Thread Sergiu Dumitriu
On 03/03/2010 06:33 PM, Nithya Vembu wrote:

 Hi All,

   Is there any sample available to create a user through XML RPC like the
 examples in the following link for creation of page, space etc..

 http://platform.xwiki.org/xwiki/bin/view/Features/XMLRPCJavaExamples

 Please help me out if there any solution.

A user is just like any other document+object. Just do what's usually 
done for creating a new document and adding a XWiki.XWikiUsers object.

Don't forget to add the user to the groups you want.

-- 
Sergiu Dumitriu
http://purl.org/net/sergiu/
___
users mailing list
users@xwiki.org
http://lists.xwiki.org/mailman/listinfo/users