5 Dec
2014
5 Dec
'14
1:12 p.m.
Hello ! on one wiki page I have a skript to delete a comment on another page. But when a user that has no edit right tries to do it, it fails. Is there a way to go around this and let the user delete the comment as if he had edit rights? for reference here is my simplified code {{groovy}} yourDocReference = new org.xwiki.model.reference.DocumentReference('xwiki','Main','WebHome'); yourDoc = xwiki.getDocument(yourDocReference); comment = yourDoc.getComments(); if(comment.isEmpty()){ println("No Comment to remove!");} else{ yourDoc.removeObject(comment[comment.size()-1]); yourDoc.save(); println("First comment removed !")} {{/groovy}} thanks for the help Adrien