How can I "apply" or "set" the rightsobject?

Here's what I have got:


{{velocity}} 

#macro(setRightsSubPages $document $documentRightsObject)
 #set($translated = $document.getTranslatedDocument())
 #set($name = $translated.getName())
 #set($fullname = $translated.getFullName())
 #set($prefixed = $translated.getPrefixedFullName())
 #set($where = "where doc.parent = '$name' or doc.parent = '$fullname' or
doc.parent = '$prefixed' order by doc.name")
 #if ($name == "WebHome")
  #set($space = $document.getSpace())
  #set($where = "where doc.space = '$space' and (doc.parent = '' or
doc.parent = '$name' or doc.parent = '$fullname' or doc.parent =
'$prefixed') and doc.name != 'WebHome' order by doc.name")
 #end
 #foreach($name in $xwiki.searchDocuments($where))
  #if ($xwiki.getDocument($name))
   #set($document = $xwiki.getDocument($name))
   #set ($rightsObject = $document.getObject("XWiki.XWikiRights", true))

## HOW DO I COPY/APPLY/SET THE RIGHTS TO THIS OBJECT????
   $rightsObject.set($documentRightsObject)

   ## Save the modifications
   $document.save()
   ## Call macro recursive
   #setRightsSubPages ($document $documentRightsObject)

  #end
 #end
#end

#if ($hasAdmin) 
 #set ($rightsObject = $doc.getObject("XWiki.XWikiRights", true))
 #setRightsSubPages($doc $rightsObject)
#else
 You need to have Admin Rights to perform this action!
#end 
{{/velocity}} 

--
View this message in context: 
http://xwiki.475771.n2.nabble.com/Apply-rights-automaticly-to-child-pages-tp7580100p7580189.html
Sent from the XWiki- Users mailing list archive at Nabble.com.
_______________________________________________
users mailing list
users@xwiki.org
http://lists.xwiki.org/mailman/listinfo/users

Reply via email to