2012-03-02 2 views
0

でXML-RPCを持つグループに私は新しいグループを作成しようとするが、私はどのようにセット権利日食

私のコードは、私はそれを同じようにやろう

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

ヘルプ!

+0

http://platform.xwiki.org/xwiki/bin/view/Features/XMLRPCJavaExamples#HUser:CreateANewUserは権限を割り当てていないため、作成したユーザーをXWikiAllGroupグループに追加するだけです。 –

答えて

0

グループと権利は、分離されたオブジェクトに格納された2つの分離されたものです。レベルと許可プロパティは、XWiki.XWikiRights(ドキュメント関連の権利)またはXWiki.XWikiGlobalRights(スペースとWiki関連の権利)に設定されています。

例ではhttp://extensions.xwiki.org/xwiki/bin/view/Extension/Setting+Rightsを見ることができます。速度スクリプトですが、同じロジックです。