documentation:1.0:customfunctions

Custom functions

Custom functions allow to extend LL::NG, they can be used in headers, rules or form replay data.

Create your Perl module with custom functions. You can name your module as you want, for example SSOExtensions.pm:

vi /root/SSOExtensions.pm
package SSOExtensions;
 
sub function1 {
  my $portal = shift;
  my $param = shift;
 
  # Your nice code here
 
  return $param
}
 
1;
The first parameter passed to the custom function is the LL::NG portal object.

Your module has to be loaded by Apache (for example after Handler load):

# Perl environment
PerlRequire /var/lib/lemonldap-ng/handler/MyHandler.pm
PerlRequire /root/SSOExtensions.pm
PerlOptions +GlobalRequest

Go in Manager, General Parameters » Advanced Parameters » Custom functions and set:

SSOExtensions::function1

You can now use your function in a macro, an header or an access rule, for example:

Custom-Header => function1($uid)