<
From version < 49.1 >
edited by Vincent Massol
on 2015/04/30
To version < 49.2 >
edited by Vincent Massol
on 2015/10/10
>
Change comment: There is no comment for this version

Summary

Details

Page properties
Content
... ... @@ -4,7 +4,7 @@
4 4  
5 5  Scripting allows you to create basic to complex web applications at the XWiki page (or view) layer without the need for compiling code or deploying software components. In other words, you can use scripting syntax in addition to wiki and HTML syntax as the contents of an XWiki page.
6 6  
7 -XWiki integrates [[jsr-223>>http://jcp.org/en/jsr/detail?id=223]] scripting. You can script using several available languages by using one of the following macros:
7 +XWiki integrates [[jsr-223>>http://jcp.org/en/jsr/detail?id=223]] scripting. You can script using several available languages by using the generic [[Script Macro>>extensions:Extension.Script Macro]] or one of following specific macros:
8 8  
9 9  * [[Velocity Macro>>extensions:Extension.Velocity Macro]] (installed by default in XWiki Enterprise)
10 10  * [[Groovy Macro>>extensions:Extension.Groovy Macro]] (installed by default in XWiki Enterprise)
... ... @@ -12,6 +12,12 @@
12 12  * [[Ruby Macro>>extensions:Extension.Ruby Macro]] (not installed by default in XWiki Enterprise)
13 13  * [[PHP Macro>>extensions:Extension.PHP Macro]] (not installed by default in XWiki Enterprise)
14 14  
15 += Permissions =
16 +
17 +Starting with XWiki 7.2M1, a user needs to have the [[Script Permission in order to be able to write Script>>extensions:Extension.Script Macro||anchor="HRights"]].
18 +
19 +In addition, all scripting languages other than Velocity also require Programming Rights (see below for more details).
20 +
15 15  = Choosing a Scripting language =
16 16  
17 17  Since XWiki supports several scripting languages you might be wondering which one to use. Most of the code written by XWiki developers is in Velocity, with a few more complex extensions written in Groovy; these two are thoroughly tried and tested, so they are both a safe bet. The other languages //should// work just as well, but there are less developers that could help answering any questions.
... ... @@ -37,11 +37,11 @@
37 37  {{/groovy}}
38 38  {{/code}}
39 39  )))
40 -* It doesn't require special permissions since it runs in a Sandbox, with access to only a few safe objects, and each API call will check the rights configured in the wiki, forbidding access to resources or actions that the current user shouldn't be allowed to retrieve/perform. Other scripting language require the user that wrote the script to have Programming Rights to execute them, but except this initial precondition, access is granted to all the resources on the server. Note that starting with XWiki 4.1 we've introduced a [[Sandbox for Groovy>>platform:AdminGuide.Configuration#HSecuringGroovyScripts]] too, but it's still in an early stage.
46 +* It doesn't require special permissions (other than Script Permission starting with XWiki 7.2M1) since it runs in a Sandbox, with access to only a few safe objects, and each API call will check the rights configured in the wiki, forbidding access to resources or actions that the current user shouldn't be allowed to retrieve/perform. Other scripting language require the user that wrote the script to have Programming Rights to execute them, but except this initial precondition, access is granted to all the resources on the server. Note that starting with XWiki 4.1 we've introduced a [[Sandbox for Groovy>>platform:AdminGuide.Configuration#HSecuringGroovyScripts]] too, but it's still in an early stage and is currently very restrictive.
41 41  
42 42  Being a templating engine, Velocity doesn't offer many means of structuring code. In fact, there's only one useful directive in this regard, ###macro##. However, because it is a templating engine, its syntax is much simpler and easier to understand by non-developers, which means that it's accessible to a wider range of users, without a serious background in programming.
43 43  
44 -Without programming rights, it's impossible to instantiate new objects, except literals and those safely offered by the XWiki APIs. Nevertheless, the XWiki API is powerful enough to allow a wide range of applications to be safely developed, if "the XWiki way" is properly followed.
50 +Without Programming Rights, it's impossible to instantiate new objects, except literals and those safely offered by the XWiki APIs. Nevertheless, the XWiki API is powerful enough to allow a wide range of applications to be safely developed, if "the XWiki way" is properly followed.
45 45  
46 46  Velocity is also available in some other parts of XWiki: it is the language in which all the templates that generate the HTML UI of XWiki are written, it can be optionally activated in skin extensions, and it is executed when sending CSS and JavaScript skin resources from the filesystem.
47 47  
... ... @@ -67,7 +67,7 @@
67 67  
68 68  == [[Bindings>>extensions:Extension.Script Macro#HBindings]] ==
69 69  
70 -These main objects available to you in scripting languages are:
76 +The main objects available to you in scripting languages are:
71 71  
72 72  * The current Document: **##doc##**
73 73  * The Context of the request: **##xcontext##**

Get Connected