Re: [xwiki-users] Altering Access Rights from REST Api
On 06/24/2010 01:10 AM, xManish wrote: Fabio Mancinelli-4 wrote: So as long as what you want to do is achievable by page and object manipulation (like the most of the XWiki functionalities) you are able to use the REST api to do it. Hi Fabio, Thanks for replying to my thread. Coming to the creating user issue. Does that mean we can create a user by creating a page and have object of class XWikiUser, but won't be able to add the user details like personal information and contact information through REST Api? All this personal information is stored in the XWiki.XWikiUsers object. Go to your profile page, edit with the object editor and expand the XWiki.XWikiUsers object. You'll see a lot of properties. I'm sure there is a way to set those properties using the REST Api. Hope this helps, Marius Or may be there is a way to do it?? Thanks, Manish ___ users mailing list users@xwiki.org http://lists.xwiki.org/mailman/listinfo/users
Re: [xwiki-users] Altering Access Rights from REST Api
On 06/24/2010 04:25 PM, xManish wrote: Marius Dumitru Florea wrote: All this personal information is stored in the XWiki.XWikiUsers object. Go to your profile page, edit with the object editor and expand the XWiki.XWikiUsers object. You'll see a lot of properties. I'm sure there is a way to set those properties using the REST Api. Hope this helps, Marius Hi Marius, Thanks for the reply. I checked it out and I can saw those properties. I too believe there is a way to set those properties. I went through the Restful API documentation at http://platform.xwiki.org/xwiki/bin/view/Features/XWikiRESTfulAPI and tried to set the property like below . PutMethod putMethod = new PutMethod(http://localhost:8080/xwiki/rest/wikis/xwiki/spaces/XWiki/pages/user01/objects/XWikiUsers/0/properties/first_name=MyName;); putMethod.addRequestHeader(Accept, MediaType.APPLICATION_XML.toString()); httpClient.executeMethod(putMethod); .. Can somebody find anything wrong here? Am I missing some point? First. The resource http://localhost:8080/xwiki/rest/wikis/xwiki/spaces/XWiki/pages/user01/objects/XWikiUsers/0/properties/first_name=MyName; is not correct. Here it seems that you are using URIs as if they were variable names! The resource should be http://localhost:8080/xwiki/rest/wikis/xwiki/spaces/XWiki/pages/user01/objects/XWikiUsers/0/properties/first_name; The value will be given through the PUT request body, that you didn't initialize in your code. Using curl, for example you would have done something like this: $ curl -v -u Admin:admin -X PUT -H Content-type: text/plain --data-ascii Real User01 Name http://localhost:8080/xwiki/rest/wikis/xwiki/spaces/XWiki/pages/user01/objects/XWiki.XWikiUsers/0/properties/first_name To see how this is translated in Java you can hava a look at the functional tests for the REST Api. You can find them here: http://svn.xwiki.org/svnroot/xwiki/enterprise/trunk/distribution-test/rest-tests/src/test/it/org/xwiki/rest/it/ And in particular, for objects and properties you can have a look at: http://svn.xwiki.org/svnroot/xwiki/enterprise/trunk/distribution-test/rest-tests/src/test/it/org/xwiki/rest/it/ObjectsResourceTest.java Hope it helps, Fabio ___ users mailing list users@xwiki.org http://lists.xwiki.org/mailman/listinfo/users
Re: [xwiki-users] Altering Access Rights from REST Api
On 06/22/2010 11:46 PM, Marius Dumitru Florea wrote: Hi Manish, On 06/23/2010 12:13 AM, xManish wrote: Hello, I was able to create a wiki page through API. Now I wanted to restrict some of the access rights for certain users to that particular wikipage through REST Api. For example, How can we restrict a certain user from viewing a particular wiki page through REST Api? In XWiki, this could be achieved by logging in as an administrator - Click on a wiki Page - Click on the 'Access Rights' from 'Edit' dropdown menu - and then checkmarking the rights to specific user or group. How can we achieve this from REST Api? I don't know much about the REST API, but if you edit with the object editor the page you just set access rights on you'll see that it has an object of class XWiki.XWikiRights attached. In other words, access rights are controlled with XWiki objects. So you just have to add/update/remove objects of class XWiki.XWikiRights to your page with the REST API. Hope this helps, Marius That's it. The REST api only provide resources for manipulating pages an objects. There are no resources for higher-level abstractions (excepts tags and comments) So as long as what you want to do is achievable by page and object manipulation (like the most of the XWiki functionalities) you are able to use the REST api to do it. Marius suggested the way to change the rights for a page and in a previous thread it was told how to create a new user. It's clear that having explicit resources for common use cases would simplify things. -Fabio ___ users mailing list users@xwiki.org http://lists.xwiki.org/mailman/listinfo/users
Re: [xwiki-users] Altering Access Rights from REST Api
Fabio Mancinelli-4 wrote: So as long as what you want to do is achievable by page and object manipulation (like the most of the XWiki functionalities) you are able to use the REST api to do it. Hi Fabio, Thanks for replying to my thread. Coming to the creating user issue. Does that mean we can create a user by creating a page and have object of class XWikiUser, but won't be able to add the user details like personal information and contact information through REST Api? Or may be there is a way to do it?? Thanks, Manish -- View this message in context: http://xwiki.475771.n2.nabble.com/Altering-Access-Rights-from-REST-Api-tp5210826p5215426.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] Altering Access Rights from REST Api
Hi Manish, On 06/23/2010 12:13 AM, xManish wrote: Hello, I was able to create a wiki page through API. Now I wanted to restrict some of the access rights for certain users to that particular wikipage through REST Api. For example, How can we restrict a certain user from viewing a particular wiki page through REST Api? In XWiki, this could be achieved by logging in as an administrator - Click on a wiki Page - Click on the 'Access Rights' from 'Edit' dropdown menu - and then checkmarking the rights to specific user or group. How can we achieve this from REST Api? I don't know much about the REST API, but if you edit with the object editor the page you just set access rights on you'll see that it has an object of class XWiki.XWikiRights attached. In other words, access rights are controlled with XWiki objects. So you just have to add/update/remove objects of class XWiki.XWikiRights to your page with the REST API. Hope this helps, Marius Any help would be really appreciated. Thanks, Manish ___ users mailing list users@xwiki.org http://lists.xwiki.org/mailman/listinfo/users