Exported variables are the variables available to <ahref="writingrulesand_headers.html"class="wikilink1"title="documentation:2.0:writingrulesand_headers">write rules and headers</a>. They are extracted from the users database by the <ahref="start.html#authentication_users_and_password_databases"class="wikilink1"title="documentation:2.0:start">users module</a>.
</p>
<p>
To create a variable, you've just to map a user attributes in <abbrtitle="LemonLDAP::NG">LL::NG</abbr> using <code>Variables</code> » <code>Exported variables</code>. For each variable, The first field is the name which will be used in rules, macros or headers and the second field is the name of the user database field.
</p>
<p>
Examples for <ahref="authldap.html"class="wikilink1"title="documentation:2.0:authldap">LDAP</a>:
<tdclass="col0 centeralign"> number </td><tdclass="col1 centeralign"> employeeNumber </td>
</tr>
<trclass="row3 rowodd">
<tdclass="col0 centeralign"> name </td><tdclass="col1 centeralign"> sn </td>
</tr>
</table></div>
<!-- EDIT3 TABLE [587-693] -->
<p>
You can define exported variables for each module in the module configuration itself. Variables defined in the main <code>Exported variables</code> will be used for each backend. Variables defined in the exported variables node of the module will be used only for that module.
</p>
<p>
<imgsrc="documentation/manager-exported-variables.png"class="mediacenter"title="Exported variables in the Manager"alt="Exported variables in the Manager"/>
<divclass="notetip">You can define environment variables in <code>Exported variables</code>, this allows one to populate user session with some environment values. Environment variables will not be queried in users database.
Macros and groups are calculated during authentication process by the portal:
</p>
<ul>
<liclass="level1"><divclass="li"> macros are used to extend (or rewrite) <spanclass="curid"><ahref="exportedvars.html"class="wikilink1"title="documentation:2.0:exportedvars">exported variables</a></span>. A macro is stored as attributes: it can contain boolean results or any string</div>
</li>
<liclass="level1"><divclass="li"> groups are stored as space-separated strings in the special attribute “groups”: it contains the names of groups whose rules were returned true for the current user</div>
</li>
<liclass="level1"><divclass="li"> You can also get groups in <code>$hGroups</code> which is a Hash Reference of this form:</div>
<divclass="noteclassic">Groups are computed after macros, so a group rule may involve a macro value.
</div><divclass="noteimportant">Macros and groups are computed in alphanumeric order, that is, in the order they are displayed in the manager. For example, macro “macro1” will be computed before macro “macro2”: so, expression of macro2 may involve value of macro1. As same for groups: a group rule may involve another, previously computed group.