Changes for page RefactoringRESTXML

Last modified by Thomas Mortagne on 2022/08/08 11:05

From version 1.8
edited by Thomas Mortagne
on 2022/08/08 10:55
Change comment: There is no comment for this version
To version 1.9
edited by Thomas Mortagne
on 2022/08/08 10:59
Change comment: There is no comment for this version

Summary

Details

Page properties
Content
... ... @@ -8,8 +8,11 @@
8 8  var source = new SpaceReference("xwiki", "MyParentPage", "MyPage");
9 9  var destination = new SpaceReference("xwiki", "MyPageNewLocaltion", "MyPageNewName");
10 10  var moveRequest = services.component.getInstance(org.xwiki.refactoring.script.RequestFactory.class).createMoveRequest(source, destination)
11 -// By default the request factory enable checking the right of the current user and author at the time of script execution but we don't care for a REST request
11 +// cleanup the request from properties which make sense for a script but are pretty much useless in the case of a REST request
12 12  moveRequest.setCheckRights(false);
13 +moveRequest.removeProperty("checkrights")
14 +moveRequest.removeProperty("user.reference")
15 +moveRequest.removeProperty("caller.reference")
13 13  
14 14  // Convert the standard move request into a REST job request
15 15  var restJobRequest = services.component.getInstance(org.xwiki.rest.internal.ModelFactory.class).toRestJobRequest(moveRequest);