From c84e3981c12adf07d2934e885eaa05f0cac25aea Mon Sep 17 00:00:00 2001 From: Maxime Besson Date: Mon, 21 Feb 2022 17:39:49 +0100 Subject: [PATCH] Update doc for custom functions (#2706) --- doc/sources/admin/customfunctions.rst | 71 ++++----------------------- 1 file changed, 9 insertions(+), 62 deletions(-) diff --git a/doc/sources/admin/customfunctions.rst b/doc/sources/admin/customfunctions.rst index 44f9471d7..0de060798 100644 --- a/doc/sources/admin/customfunctions.rst +++ b/doc/sources/admin/customfunctions.rst @@ -51,81 +51,28 @@ as you want, for example ``SSOExtensions.pm``: Import custom functions in LemonLDAP::NG ---------------------------------------- -Load relevant code in handler server -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +LemonLDAP::NG Configuration +~~~~~~~~~~~~~~~~~~~~~~~~~~~ -New method -^^^^^^^^^^ - -Just declare files or Perl module that must be loaded: +Edit ``lemonldap-ng.ini`` to load the Perl module(s) :: [all] - require = /path/to/functions.pl, /path/to/SSOExtensions.pm - # OR - require = SSOExtensions::function1, SSOExtensions::function2 + require = /path/to/SSOExtensions.pm ; Prevent Portal to crash if Perl module is not found ;requireDontDie = 1 -Old method -^^^^^^^^^^ - - -.. danger:: - - This method is available but unusable by Portal under - Apache. So if your rule may be used by the menu, use the new - method. - -Apache -'''''' - -Your module has to be loaded by Apache (for example after Handler load): - -.. code-block:: apache - - # Perl environment - PerlRequire Lemonldap::NG::Handler - PerlRequire /path/to/SSOExtensions.pm - PerlOptions +GlobalRequest - -FastCGI server (Nginx) -'''''''''''''''''''''' - -You've just to incicate to :doc:`LLNG FastCGI server` the -file to read using either ``-f`` option or ``CUSTOM_FUNCTIONS_FILE`` -environment variable. Using packages, you just have to modify your -``/etc/default/llng-fastcgi-server`` (or -``/etc/default/lemonldap-ng-fastcgi-server``) file: - -.. code-block:: sh - - # Number of process (default: 7) - #NPROC = 7 - - # Unix socket to listen to - SOCKET=/var/run/llng-fastcgi-server/llng-fastcgi.sock - - # Pid file - PID=/var/run/llng-fastcgi-server/llng-fastcgi-server.pid - - # User and GROUP - USER=www-data - GROUP=www-data - - # Custom functions file - CUSTOM_FUNCTIONS_FILE=/path/to/SSOExtensions.pm Declare custom functions ~~~~~~~~~~~~~~~~~~~~~~~~ Go in Manager, ``General Parameters`` » ``Advanced Parameters`` » -``Custom functions`` and set: +``Custom functions`` and declare your function names, separated by a space: :: - SSOExtensions::function1, SSOExtensions::function2 + SSOExtensions::function1 SSOExtensions::function2 .. attention:: @@ -133,13 +80,13 @@ Go in Manager, ``General Parameters`` » ``Advanced Parameters`` » If your function is not compliant with :doc:`Safe jail`, you will need to disable the jail. -Use it ------- +Usage +----- You can now use your function in a macro, an header or an access rule, for example: :: - SSOExtensions::function1( $uid, $ENV{REMOTE_ADDR} ) + function1( $uid, $ENV{REMOTE_ADDR} )