|
|
|
@ -1,7 +1,7 @@ |
|
|
|
|
package Lemonldap::NG::Manager::Help; |
|
|
|
|
|
|
|
|
|
use AutoLoader qw(AUTOLOAD); |
|
|
|
|
our $VERSION = '0.35'; |
|
|
|
|
our $VERSION = '0.36'; |
|
|
|
|
|
|
|
|
|
sub import { |
|
|
|
|
my ($caller_package) = caller; |
|
|
|
@ -300,14 +300,37 @@ This mechanism avoid to do more than one time the same operation in the |
|
|
|
|
authentication phase. Example :</p> |
|
|
|
|
<pre> |
|
|
|
|
# macros |
|
|
|
|
long_name => \$givenname . " " . \$surname |
|
|
|
|
admin => \$uid eq "foo" or \$uid eq "bar" |
|
|
|
|
long_name => \$givenname . " " . \$surname |
|
|
|
|
admin => \$uid eq "foo" or \$uid eq "bar" |
|
|
|
|
|
|
|
|
|
# test.example.com - Headers |
|
|
|
|
Name => \$long_name |
|
|
|
|
Name => \$long_name |
|
|
|
|
|
|
|
|
|
# test.example.com - Rules |
|
|
|
|
^/admin/ => \$admin |
|
|
|
|
^/admin/ => \$admin |
|
|
|
|
</pre> |
|
|
|
|
|
|
|
|
|
<h4> Tips </h4> |
|
|
|
|
|
|
|
|
|
<h5> Redefining LDAP attributes </h5> |
|
|
|
|
<p> You can create a macro with the same name than an exported value. If so, |
|
|
|
|
the attribute is redefined. Example :</p> |
|
|
|
|
<pre> |
|
|
|
|
uid => $uid . "\\\@domain.com" |
|
|
|
|
</pre> |
|
|
|
|
|
|
|
|
|
<h5> Using regexp </h5> |
|
|
|
|
|
|
|
|
|
<p> Suppose you want to extract the string 'admin' or 'user' in an attribute, |
|
|
|
|
in Perl, you can use <tt>\$mail =~ s/^.*(user|admin)/\$1/</tt>. To |
|
|
|
|
use it in Lemonldap::NG, you have to do the following :</p> |
|
|
|
|
<pre> |
|
|
|
|
mail => (\$mail =~ /(user|admin)/)[0] |
|
|
|
|
</pre> |
|
|
|
|
<p> Explanation : '\$mail =~ /(user|admin)/' returns 0 or 1, but |
|
|
|
|
'(\$mail =~ /(user|admin)/)' is a "list context" so it returns an array |
|
|
|
|
containing all elements recognized. So '(\$mail =~ /(user|admin)/)[0]' |
|
|
|
|
returns the first element.</p> |
|
|
|
|
EOT |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -321,14 +344,38 @@ Elles évitent de répéter le même calcul plusieurs |
|
|
|
|
fois dans la phase d'authentification. Exemple :</p> |
|
|
|
|
<pre> |
|
|
|
|
# macros |
|
|
|
|
nom_complet => \$givenname . " " . \$surname |
|
|
|
|
admin => \$uid eq "foo" or \$uid eq "bar" |
|
|
|
|
nom_complet => \$givenname . " " . \$surname |
|
|
|
|
admin => \$uid eq "foo" or \$uid eq "bar" |
|
|
|
|
|
|
|
|
|
# test.example.com - En-têtes |
|
|
|
|
Nom => \$nom_complet |
|
|
|
|
Nom => \$nom_complet |
|
|
|
|
|
|
|
|
|
# test.example.com - Règles |
|
|
|
|
^/admin/ => \$admin |
|
|
|
|
^/admin/ => \$admin |
|
|
|
|
</pre> |
|
|
|
|
|
|
|
|
|
<h4> Astuces </h4> |
|
|
|
|
|
|
|
|
|
<h5> Redéfinir les attributs LDAP </h5> |
|
|
|
|
<p> Une macro peut porter le même nom |
|
|
|
|
You can create a macro with the same name than an exported value. If so, |
|
|
|
|
the attribute is redefined. Example :</p> |
|
|
|
|
<pre> |
|
|
|
|
uid => $uid . "\\\@domain.com" |
|
|
|
|
</pre> |
|
|
|
|
|
|
|
|
|
<h5> Using regexp </h5> |
|
|
|
|
|
|
|
|
|
<p> Suppose you want to extract the string 'admin' or 'user' in an attribute, |
|
|
|
|
in Perl, you can use <tt>\$mail =~ s/^.*(user|admin)/\$1/</tt>. To |
|
|
|
|
use it in Lemonldap::NG, you have to do the following :</p> |
|
|
|
|
<pre> |
|
|
|
|
mail => (\$mail =~ /(user|admin)/)[0] |
|
|
|
|
</pre> |
|
|
|
|
<p> Explanation : '\$mail =~ /(user|admin)/' returns 0 or 1, but |
|
|
|
|
'(\$mail =~ /(user|admin)/)' is a "list context" so it returns an array |
|
|
|
|
containing all elements recognized. So '(\$mail =~ /(user|admin)/)[0]' |
|
|
|
|
returns the first element.</p> |
|
|
|
|
EOT |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|