There are 2 updates.
 
 
XWiki Platform / cid:jira-generated-image-avatar-de1f955f-9028-4112-bcdd-68b80b6c2ba2 XWIKI-23648 Open

Impossible to use RefactoringScriptService#restore(String batchId) directly if the author has programming right

 
View issue   ยท   Add comment
 

2 updates

 
cid:jira-generated-image-avatar-b48e00da-adc2-4723-b72c-4c6bda4fd42d Changes by Thomas Mortagne on 30/Oct/25 18:57
 
Difficulty: Unknown Easy
Description: For example, the following

{code}
{{velocity}}
#set ($batchId = "5cfabdc7-ecdd-49f3-90ba-a3fce03e0de2")
$services.refactoring.restore($batchId)
{{/velocity}}
{code}

produces the error

{code}
The author [null] of this script is not allowed to restore document [xwiki:Level1.WebHome()] with ID [11]
{code}

The request is initialized with the current user, but not the author. When you don't have programming right, #execute() will reset the right, bit this time it does set the author (and fix the request).

Same problem with the other #restore API and might be true with other methods of RefactoringScriptService.

The request is created with the current user, but not the author.