. You have saveAsAuthor() and saveWithProgrammingRights().
Hope this helps,
Marius
On Fri, Dec 5, 2014 at 3:12 PM, Adrien Moi <adrienmoi1988(a)hotmail.com> wrote:
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
_______________________________________________
users mailing list
users(a)xwiki.org
http://lists.xwiki.org/mailman/listinfo/users