comparison Sphinx/source/users/lua.rst @ 25:669ea65ba7fb

fix links
author Sebastien Jodogne <s.jodogne@gmail.com>
date Wed, 20 Jul 2016 09:26:08 +0200
parents c98317fedf87
children a3df3c2b68cf
comparison
equal deleted inserted replaced
24:25fa874803ab 25:669ea65ba7fb
4 ============================== 4 ==============================
5 5
6 .. contents:: 6 .. contents::
7 7
8 Since release 0.5.2, Orthanc supports server-side scripting through 8 Since release 0.5.2, Orthanc supports server-side scripting through
9 the `Lua <http://en.wikipedia.org/wiki/Lua_(programming_language)>`__ 9 the `Lua <https://en.wikipedia.org/wiki/Lua_(programming_language)>`__
10 scripting language. Thanks to this major feature, Orthanc can be tuned 10 scripting language. Thanks to this major feature, Orthanc can be tuned
11 to specific medical workflows without being driven by an external 11 to specific medical workflows without being driven by an external
12 script. This page summarizes the possibilities of Orthanc server-side 12 script. This page summarizes the possibilities of Orthanc server-side
13 scripting. 13 scripting.
14 14
43 $ curl -X POST http://localhost:8042/tools/execute-script --data-binary "print(42)" 43 $ curl -X POST http://localhost:8042/tools/execute-script --data-binary "print(42)"
44 44
45 *Note:* The ``--data-binary`` cURL option is used instead of 45 *Note:* The ``--data-binary`` cURL option is used instead of
46 ``--data`` to prevent the interpretation of newlines by cURL, which is 46 ``--data`` to prevent the interpretation of newlines by cURL, which is
47 `mandatory for the proper evaluation 47 `mandatory for the proper evaluation
48 <http://stackoverflow.com/q/3872427/881731>`__ of the possible 48 <http://stackoverflow.com/questions/3872427/how-to-send-line-break-with-curl>`__ of the possible
49 comments inside the Lua script. 49 comments inside the Lua script.
50 50
51 51
52 Lua API 52 Lua API
53 ------- 53 -------
246 ``IncomingHttpRequestFilter()`` Lua function is called. The access to 246 ``IncomingHttpRequestFilter()`` Lua function is called. The access to
247 the resource is granted if and only if this callback script returns 247 the resource is granted if and only if this callback script returns
248 ``true``. 248 ``true``.
249 249
250 This mechanism can be used to implement fine-grained `access control 250 This mechanism can be used to implement fine-grained `access control
251 lists <http://en.wikipedia.org/wiki/Access_control_list>`__. Here is 251 lists <https://en.wikipedia.org/wiki/Access_control_list>`__. Here is
252 an example of a Lua script that limits POST, PUT and DELETE requests 252 an example of a Lua script that limits POST, PUT and DELETE requests
253 to an user that is called "admin":: 253 to an user that is called "admin"::
254 254
255 function IncomingHttpRequestFilter(method, uri, ip, username, httpHeaders) 255 function IncomingHttpRequestFilter(method, uri, ip, username, httpHeaders)
256 -- Only allow GET requests for non-admin users 256 -- Only allow GET requests for non-admin users