add change_rights/onEvent.java groovy script

This commit is contained in:
Jonathan Jenne 2018-04-05 12:39:14 +02:00
commit c79407ecd7

View File

@ -0,0 +1,23 @@
import org.xwiki.bridge.event.*
import org.xwiki.model.reference.*
import org.xwiki.model.*
try {
def docSource = xcontext.method.input.get(1)
def context = xcontext.method.input.get(2)
def xwiki = context.getWiki()
def document = xwiki.getDocument(docSource, context)
def parent = xwiki.getDocument(document.getParent(), context)
def userRef = new DocumentReference("xwiki", "XWiki", "ProtokollDummy")
document.setCreatorReference(userRef)
System.out.println(userRef)
System.out.println(document.getCreatorReference())
} catch(e) {
System.out.println("ERROR!")
System.out.println(e.getMessage())
}