Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
documentation:latest:extendedfunctions [2019/11/05 20:41]
cmaudoux [varIsInUri]
documentation:latest:extendedfunctions [2020/04/16 15:12] (current)
maxbes inGroup doc
Line 26: Line 26:
     * [[#​iso2unicode|iso2unicode]]     * [[#​iso2unicode|iso2unicode]]
     * [[#​groupMatch|groupMatch]]     * [[#​groupMatch|groupMatch]]
 +    * [[#​listMatch|listMatch]] ({{..:​new.png?​direct&​35|}} // since 2.0.7)//
 +    * [[#​inGroup|inGroup]] ({{..:​new.png?​direct&​35|}} // since 2.0.8)//
     * [[#​encrypt|encrypt]]     * [[#​encrypt|encrypt]]
     * [[#​token|token]]     * [[#​token|token]]
Line 161: Line 163:
 groupMatch($hGroups,​ '​description',​ '​Service 1') groupMatch($hGroups,​ '​description',​ '​Service 1')
 </​code>​ </​code>​
 +
 +==== listMatch ====
 +({{..:​new.png?​direct&​35|}} // since 2.0.7)//
 +
 +This function lets you test if a particular value can be found with a multi-valued session attribute.
 +
 +Function parameter:
 +  * **list**: Variable containing several values (plain string with separator, array or hash) 
 +  * **value**: Value to search in the list
 +  * **ignorecase**:​ Ignore case, by default the search is case-sensitive
 +
 +Simple usage example:
 +<​code>​
 +# Case sensitive match
 +listMatch($roles,​ '​role-app1'​)
 +
 +# Case insensitive match
 +listMatch($roles,​ '​RoLe-aPp1',​ 1)
 +</​code>​
 +
 +The function returns 1 if the value was found, and 0 if it was not found.
 +
 +==== inGroup ====
 +({{..:​new.png?​direct&​35|}} // since 2.0.8)//
 +
 +This function lets you test if the user is in a given group. It is case-insensitive.
 +
 +Usage example:
 +<​code>​
 +inGroup('​admins'​)
 +
 +inGroup('​test users'​)
 +</​code>​
 +
 +The function returns 1 if the user belongs to the given group, and 0 if they don't.
  
 ==== encrypt ==== ==== encrypt ====
Line 190: Line 227:
 ==== varIsInUri ==== ==== varIsInUri ====
  
-Function to check if a variable is in requested URI. Example //check if $uid is in /​check-auth/​ URI//:+Function to check if a variable is in requested URI (Require LL::NG >= 2.0.7). 
 + 
 +Example //check if $uid is in /​check-auth/​ URI//:
  
 <code perl> <code perl>