0
XML-RPC我嘗試創建一個新的小組,但我不能設置權限如何設置權限的一組在Eclipse中
我的代碼是
private static void createNewGroup() throws MalformedURLException, XmlRpcException {
XWikiXmlRpcClient rpc = new XWikiXmlRpcClient("http://localhost:8080/xwiki/xmlrpc/confluence");
try {
rpc.login("Admin", "admin");
// this create the group but without permissions
Page page = new Page();
page.setSpace("XWiki");
page.setParentId("XWiki.XWikiGroups");
page.setTitle("XWikiUsersGroups");
page.setId("XWiki.XWikiUsersGroup");
page.setContent("{{include document=\"XWiki.XWikiGroupSheet\"/}}");
rpc.storePage(page);
//no puedo setearle permisos
XWikiObject xobjgrp = new XWikiObject();
xobjgrp.setClassName("XWiki.XWikiGroups");
xobjgrp.setPageId("XWiki.XWikiUsersGroup");
xobjgrp.setId(-1);
xobjgrp.setProperty("levels", "View"); // this not work
xobjgrp.setProperty("allow", true); //not work, too
rpc.storeObject(xobjgrp);
} catch (XmlRpcException e) {
System.out.println("invalid username/password was specified or communication problem or ");
System.out.println(e);
} finally {
rpc.logout();
}
}
我嘗試做同樣的方式用戶已創建但我無法分配權限。
http://platform.xwiki.org/xwiki/bin/view/Features/XMLRPCJavaExamples#HUser:CreateANewUser
幫助!!
http://platform.xwiki.org/xwiki/bin/view/Features/XMLRPCJavaExamples#HUser:CreateANewUser沒有分配任何權限,只是將創建的用戶添加到XWikiAllGroup組中。 – 2012-03-03 10:46:22