[xwiki-users] object template and groovy
I have created a XWiki class as described in the FAQTutorial ( http://platform.xwiki.org/xwiki/bin/view/DevGuide/FAQTutorial), I have then modified the Document Sheet code, and I have tried to use groovy scripting instead of velocity. However when creating a new object, I get the error Failed to execute the [groovy] macro org.xwiki.rendering.macro.MacroExecutionException: You don't have the right to execute this script whereas the same works if I translate the code into velocity. Editing an existing page with the groovy script works fine, it only fails when creating a new document. Any idea? thanks Vito
vimpagliazzo wrote:
I have then modified the Document Sheet code, and I have tried to use groovy scripting instead of velocity. However when creating a new object, I get the error
Failed to execute the [groovy] macro org.xwiki.rendering.macro.MacroExecutionException: You don't have the right to execute this script
Rule of thumb: you can't use groovy in class sheets. A newly created document using a sheet (i.e. including a document) with groovy code in it can't be saved without programming rights. Velocity code - even the privileged API - will work as long as the sheet has been saved by a user with programming rights; afaik this is due to differences in the permissions evaluation (cp. http://markmail.org/message/aaxf5g34knxdvvoh). Solution: 1. re-write your code in velocity or 2. use velocity in the sheet to include your groovy code through <code>parseGroovyFromPage</code> (cp. http://platform.xwiki.org/xwiki/bin/view/DevGuide/GroovyNotificationTutorial) Philipp -- View this message in context: http://xwiki.475771.n2.nabble.com/object-template-and-groovy-tp5859642p58621... Sent from the XWiki- Users mailing list archive at Nabble.com.
Thanks Philipp I can manage with velocity, I just needed to instantiate a SimpleDateFormat, which I can do from a small groovy class loaded with parseGroovyFromPage. thanks Vito On Thu, Dec 23, 2010 at 2:27 PM, tapaya <[email protected]> wrote:
vimpagliazzo wrote:
I have then modified the Document Sheet code, and I have tried to use groovy scripting instead of velocity. However when creating a new object, I get the error
Failed to execute the [groovy] macro org.xwiki.rendering.macro.MacroExecutionException: You don't have the right to execute this script
Rule of thumb: you can't use groovy in class sheets.
A newly created document using a sheet (i.e. including a document) with groovy code in it can't be saved without programming rights. Velocity code - even the privileged API - will work as long as the sheet has been saved by a user with programming rights; afaik this is due to differences in the permissions evaluation (cp. http://markmail.org/message/aaxf5g34knxdvvoh).
Solution: 1. re-write your code in velocity or 2. use velocity in the sheet to include your groovy code through <code>parseGroovyFromPage</code> (cp.
http://platform.xwiki.org/xwiki/bin/view/DevGuide/GroovyNotificationTutorial )
Philipp
-- View this message in context: http://xwiki.475771.n2.nabble.com/object-template-and-groovy-tp5859642p58621... Sent from the XWiki- Users mailing list archive at Nabble.com. _______________________________________________ users mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/users
-- Vito Impagliazzo --- Please consider the environment before printing this email.
participants (2)
-
tapaya -
Vito Impagliazzo