Hi all,
I'm trying to copy the rights from a page to another without any success
using this code.
Can someone help me?
Thanks
raffo
#set($targetDoc = $xwiki.getDocument('paginavuota2'))
$targetDoc.getName()
#foreach($obj in $doc.getObjects("XWiki.XWikiGlobalRights"))
#set($levels = "$obj.getProperty('levels').getValue()") ## get the
levels
#set($users = $obj.getProperty('users').getValue())
#set($groups = $obj.getProperty('groups').getValue())
#set($allow = $obj.getProperty('allow').getValue())
#set($entry=$targetDoc.newObject("XWiki.XWikiRights"))
$entry.set('groups',$levels)
$entry.set('users',$users)
$entry.set('levels',$groups)
$entry.set('allow',$allow)
#end
#foreach($obj in $doc.getObjects("XWiki.XWikiRights"))
#set($levels = "$obj.getProperty('levels').getValue()") ## get the
levels
#set($users = $obj.getProperty('users').getValue())
#set($groups = $obj.getProperty('groups').getValue())
#set($allow = $obj.getProperty('allow').getValue())
#set($entry=$targetDoc.newObject("XWiki.XWikiRights"))
$entry.set('groups',$levels)
$entry.set('users',$users)
$entry.set('levels',$groups)
$entry.set('allow',$allow)
#end
$targetDoc.save()