added profile loading

This commit is contained in:
Roland Gruber 2005-01-07 10:51:56 +00:00
parent 77f7fc2d53
commit cec9d8cd4e
2 changed files with 123 additions and 47 deletions

View File

@ -152,8 +152,54 @@ common cases.<br>
<br> <br>
<br> <br>
<h2>3. Loading an account profile</h2> <h2>3. Loading an account profile</h2>
When an account profile is loaded the modules have to check what values
they need for their internal data structures.<br>
The <span style="font-style: italic;">baseModule</span> already
provides the possibility to store profile values directly as LDAP
attributes in <span style="font-style: italic;">$this-&gt;attributes</span>.
This is done by defining profile-attribute mappings in <span
style="font-weight: bold;">meta['profile_mappings']</span>.<br>
If you have other values than LDAP attributes or need some post
processing you can implement the function <span
style="font-weight: bold;">load_profile()</span> in your module.<br>
<br>
<span style="font-weight: bold; text-decoration: underline;">Example:</span><br
style="font-weight: bold; text-decoration: underline;">
<br>
The <span style="font-style: italic;">inetLocalMailRecipient</span>
module only
needs a static mapping. This can be done by
the <span style="font-style: italic;">baseModule</span>.<br>
<br>
<table style="width: 100%; text-align: left;" class="mod-code"
border="0" cellpadding="2" cellspacing="2">
<tbody>
<tr>
<td style="vertical-align: top;">&nbsp;&nbsp;&nbsp; /**<br>
&nbsp;&nbsp;&nbsp; * Returns meta data that is interpreted by parent
class<br>
&nbsp;&nbsp;&nbsp; *<br>
&nbsp;&nbsp;&nbsp; * @return array array with meta data<br>
&nbsp;&nbsp;&nbsp; */<br>
&nbsp;&nbsp;&nbsp; <span style="font-weight: bold;">function</span>
get_metaData() {<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; $return = array();<br>
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; // profile mappings<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp; &nbsp;$return[<span
style="color: rgb(255, 0, 0);">'profile_mappings'</span>] = array(<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
&nbsp;'inetLocalMailRecipient_host' =&gt; 'mailHost'<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp; &nbsp;);<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; [...]<br>
</td>
</tr>
</tbody>
</table>
<br>
In this example the profile option "inetLocalMailRecipient_host" is
stored as LDAP attribute "mailHost".<br>
<br>
<br> <br>
TODO<br>
<span style="font-weight: bold;"></span> <span style="font-weight: bold;"></span>
<h2><span style="font-weight: bold;"></span></h2> <h2><span style="font-weight: bold;"></span></h2>
</div> </div>

View File

@ -26,8 +26,8 @@ All module classes should extend the baseModule class.<br>
</h3> </h3>
<h3>2.1.1. can_manage*</h3> <h3>2.1.1. can_manage*</h3>
<br> <br>
<table cellpadding="2" cellspacing="2" border="0" <table style="text-align: left; width: 300px;" border="0"
style="text-align: left; width: 300px;"> cellpadding="2" cellspacing="2">
<tbody> <tbody>
<tr> <tr>
<td <td
@ -46,7 +46,7 @@ otherwise <span style="font-style: italic;">false</span>.<br>
<h3>2.1.2. get_alias*</h3> <h3>2.1.2. get_alias*</h3>
<br> <br>
<table style="text-align: left; width: 300px;" border="0" <table style="text-align: left; width: 300px;" border="0"
cellspacing="2" cellpadding="2"> cellpadding="2" cellspacing="2">
<tbody> <tbody>
<tr> <tr>
<td <td
@ -69,7 +69,7 @@ sure that there is a general alias for unknown types.<br>
<h3>2.1.3. is_base_module*</h3> <h3>2.1.3. is_base_module*</h3>
<br> <br>
<table style="text-align: left; width: 300px; height: 30px;" border="0" <table style="text-align: left; width: 300px; height: 30px;" border="0"
cellspacing="2" cellpadding="2"> cellpadding="2" cellspacing="2">
<tbody> <tbody>
<tr> <tr>
<td <td
@ -92,7 +92,7 @@ quota module is no base module as it needs posixAccount.<br>
<h3>2.1.4. get_ldap_filter*</h3> <h3>2.1.4. get_ldap_filter*</h3>
<br> <br>
<table style="text-align: left; width: 300px; height: 30px;" border="0" <table style="text-align: left; width: 300px; height: 30px;" border="0"
cellspacing="2" cellpadding="2"> cellpadding="2" cellspacing="2">
<tbody> <tbody>
<tr> <tr>
<td <td
@ -123,7 +123,7 @@ implement it.</span><br>
<h3>2.1.5. get_RDNAttributes*</h3> <h3>2.1.5. get_RDNAttributes*</h3>
<br> <br>
<table style="text-align: left; width: 300px; height: 30px;" border="0" <table style="text-align: left; width: 300px; height: 30px;" border="0"
cellspacing="2" cellpadding="2"> cellpadding="2" cellspacing="2">
<tbody> <tbody>
<tr> <tr>
<td <td
@ -149,8 +149,8 @@ for the RDN selection.<br>
<span style="font-weight: bold; color: rgb(255, 0, 0);"></span><br> <span style="font-weight: bold; color: rgb(255, 0, 0);"></span><br>
<h3>2.1.6. get_dependencies*</h3> <h3>2.1.6. get_dependencies*</h3>
<br> <br>
<table cellpadding="2" cellspacing="2" border="0" <table style="text-align: left; width: 300px; font-weight: bold;"
style="text-align: left; width: 300px; font-weight: bold;"> border="0" cellpadding="2" cellspacing="2">
<tbody> <tbody>
<tr> <tr>
<td <td
@ -180,8 +180,8 @@ your module depends on one of these modules.<br>
<br> <br>
<h3>2.1.7. get_metaData()</h3> <h3>2.1.7. get_metaData()</h3>
<br> <br>
<table cellpadding="2" cellspacing="2" border="0" <table style="text-align: left; width: 300px;" border="0"
style="text-align: left; width: 300px;"> cellpadding="2" cellspacing="2">
<tbody> <tbody>
<tr> <tr>
<td <td
@ -199,8 +199,8 @@ true);</span><br style="font-weight: bold;">
<br> <br>
<h3>2.1.8. get_configOptions()*</h3> <h3>2.1.8. get_configOptions()*</h3>
<br> <br>
<table cellpadding="2" cellspacing="2" border="0" <table style="text-align: left; width: 300px;" border="0"
style="text-align: left; width: 300px;"> cellpadding="2" cellspacing="2">
<tbody> <tbody>
<tr> <tr>
<td <td
@ -227,8 +227,8 @@ naming confilcts.<br>
<br> <br>
<h3>2.1.9. get_configDescriptions()*</h3> <h3>2.1.9. get_configDescriptions()*</h3>
<br> <br>
<table cellpadding="2" cellspacing="2" border="0" <table style="text-align: left; width: 300px;" border="0"
style="text-align: left; width: 300px;"> cellpadding="2" cellspacing="2">
<tbody> <tbody>
<tr> <tr>
<td <td
@ -255,7 +255,7 @@ array with this format:<br>
<h3>2.1.10. check_configOptions*</h3> <h3>2.1.10. check_configOptions*</h3>
<br> <br>
<table style="text-align: left; width: 400px; height: 30px;" border="0" <table style="text-align: left; width: 400px; height: 30px;" border="0"
cellspacing="2" cellpadding="2"> cellpadding="2" cellspacing="2">
<tbody> <tbody>
<tr> <tr>
<td <td
@ -284,8 +284,8 @@ If no errors occured the function returns an empty array.<span
<span style="font-weight: bold;"></span> <span style="font-weight: bold;"></span>
<h3>2.1.11. get_scope()</h3> <h3>2.1.11. get_scope()</h3>
<br> <br>
<table cellpadding="2" cellspacing="2" border="0" <table style="text-align: left; width: 300px;" border="0"
style="text-align: left; width: 300px;"> cellpadding="2" cellspacing="2">
<tbody> <tbody>
<tr> <tr>
<td <td
@ -304,7 +304,7 @@ baseModule and should not be overwritten.</span><br>
<h3>2.1.12. get_uploadColumns*</h3> <h3>2.1.12. get_uploadColumns*</h3>
<br> <br>
<table style="text-align: left; width: 300px; height: 30px;" border="0" <table style="text-align: left; width: 300px; height: 30px;" border="0"
cellspacing="2" cellpadding="2"> cellpadding="2" cellspacing="2">
<tbody> <tbody>
<tr> <tr>
<td <td
@ -351,7 +351,7 @@ all values of this column must be different values <span
<h3>2.1.13. get_uploadPreDepends*</h3> <h3>2.1.13. get_uploadPreDepends*</h3>
<br> <br>
<table style="text-align: left; width: 300px; height: 30px;" border="0" <table style="text-align: left; width: 300px; height: 30px;" border="0"
cellspacing="2" cellpadding="2"> cellpadding="2" cellspacing="2">
<tbody> <tbody>
<tr> <tr>
<td <td
@ -369,7 +369,7 @@ The named modules may not be active, LAM will check this automatically.<br>
<h3>2.1.14. build_uploadAccounts</h3> <h3>2.1.14. build_uploadAccounts</h3>
<br> <br>
<table style="text-align: left; width: 484px; height: 31px;" border="0" <table style="text-align: left; width: 484px; height: 31px;" border="0"
cellspacing="2" cellpadding="2"> cellpadding="2" cellspacing="2">
<tbody> <tbody>
<tr> <tr>
<td <td
@ -398,7 +398,7 @@ if any errors occured.<br>
<h3>2.1.15. do_uploadPostActions</h3> <h3>2.1.15. do_uploadPostActions</h3>
<br> <br>
<table style="text-align: left; width: 484px; height: 31px;" border="0" <table style="text-align: left; width: 484px; height: 31px;" border="0"
cellspacing="2" cellpadding="2"> cellpadding="2" cellspacing="2">
<tbody> <tbody>
<tr> <tr>
<td <td
@ -445,8 +445,8 @@ StatusMessages<br>
<br> <br>
<h3>2.1.16. get_profileOptions*</h3> <h3>2.1.16. get_profileOptions*</h3>
<br> <br>
<table cellpadding="2" cellspacing="2" border="0" <table style="text-align: left; width: 300px; height: 30px;" border="0"
style="text-align: left; width: 300px; height: 30px;"> cellpadding="2" cellspacing="2">
<tbody> <tbody>
<tr> <tr>
<td <td
@ -472,7 +472,7 @@ naming confilcts.<br>
<h3>2.1.17. check_profileOptions*</h3> <h3>2.1.17. check_profileOptions*</h3>
<br> <br>
<table style="text-align: left; width: 400px; height: 30px;" border="0" <table style="text-align: left; width: 400px; height: 30px;" border="0"
cellspacing="2" cellpadding="2"> cellpadding="2" cellspacing="2">
<tbody> <tbody>
<tr> <tr>
<td <td
@ -495,6 +495,27 @@ head, 2 =&gt; message text, 3 =&gt; additional variables).<br>
If no errors occured the function returns an empty array.<span If no errors occured the function returns an empty array.<span
style="font-weight: bold;"></span><br> style="font-weight: bold;"></span><br>
<br> <br>
<h3>2.1.18. load_profile*</h3>
<br>
<table style="text-align: left; width: 400px; height: 30px;" border="0"
cellpadding="2" cellspacing="2">
<tbody>
<tr>
<td
style="vertical-align: top; background-color: rgb(204, 204, 204); text-align: center;"><span
style="font-weight: bold;">function load_profile($profile)</span><br>
</td>
</tr>
</tbody>
</table>
<br>
This function loads the values from an account profile to the module's
internal data structures.<br>
<br>
<span style="font-weight: bold;"></span><span style="font-weight: bold;">$profile</span>
is an hash array (identifier =&gt; array(values))&nbsp; with all values
of an account profile.<br>
<br>
<h3><br> <h3><br>
</h3> </h3>
<br> <br>
@ -503,8 +524,8 @@ If no errors occured the function returns an empty array.<span
</h3> </h3>
<h3>2.2.1. init</h3> <h3>2.2.1. init</h3>
<br> <br>
<table cellpadding="2" cellspacing="2" border="0" <table style="text-align: left; width: 300px; height: 30px;" border="0"
style="text-align: left; width: 300px; height: 30px;"> cellpadding="2" cellspacing="2">
<tbody> <tbody>
<tr> <tr>
<td <td
@ -523,8 +544,8 @@ several helper functions.<br>
<br> <br>
<h3>2.2.2. module_ready</h3> <h3>2.2.2. module_ready</h3>
<br> <br>
<table cellpadding="2" cellspacing="2" border="0" <table style="text-align: left; width: 300px; height: 30px;" border="0"
style="text-align: left; width: 300px; height: 30px;"> cellpadding="2" cellspacing="2">
<tbody> <tbody>
<tr> <tr>
<td <td
@ -543,7 +564,7 @@ your module accepts input, otherwise <span style="font-weight: bold;">false</spa
<h3>2.2.3. module_complete</h3> <h3>2.2.3. module_complete</h3>
<br> <br>
<table style="text-align: left; width: 300px; height: 30px;" border="0" <table style="text-align: left; width: 300px; height: 30px;" border="0"
cellspacing="2" cellpadding="2"> cellpadding="2" cellspacing="2">
<tbody> <tbody>
<tr> <tr>
<td <td
@ -564,7 +585,7 @@ page will be displayed.<br>
<h3>2.2.4. get_help</h3> <h3>2.2.4. get_help</h3>
<br> <br>
<table style="text-align: left; width: 300px; height: 30px;" border="0" <table style="text-align: left; width: 300px; height: 30px;" border="0"
cellspacing="2" cellpadding="2"> cellpadding="2" cellspacing="2">
<tbody> <tbody>
<tr> <tr>
<td <td
@ -587,7 +608,7 @@ section 4. "Help entry syntax".<br>
<h3>2.2.7. get_pdfEntries</h3> <h3>2.2.7. get_pdfEntries</h3>
<br> <br>
<table style="text-align: left; width: 300px; height: 30px;" border="0" <table style="text-align: left; width: 300px; height: 30px;" border="0"
cellspacing="2" cellpadding="2"> cellpadding="2" cellspacing="2">
<tbody> <tbody>
<tr> <tr>
<td <td
@ -613,7 +634,7 @@ syntax".<br>
</h3> </h3>
<br> <br>
<table style="text-align: left; width: 349px; height: 50px;" border="0" <table style="text-align: left; width: 349px; height: 50px;" border="0"
cellspacing="2" cellpadding="2"> cellpadding="2" cellspacing="2">
<tbody> <tbody>
<tr> <tr>
<td <td
@ -636,7 +657,7 @@ Returnis an array as expected from StatusMessage().<br>
</h3> </h3>
<br> <br>
<table style="text-align: left; width: 280px; height: 50px;" border="0" <table style="text-align: left; width: 280px; height: 50px;" border="0"
cellspacing="2" cellpadding="2"> cellpadding="2" cellspacing="2">
<tbody> <tbody>
<tr> <tr>
<td <td
@ -657,7 +678,7 @@ $this-&gt;messages[x][y][z]<br>
</h3> </h3>
<br> <br>
<table style="text-align: left; width: 280px; height: 50px;" border="0" <table style="text-align: left; width: 280px; height: 50px;" border="0"
cellspacing="2" cellpadding="2"> cellpadding="2" cellspacing="2">
<tbody> <tbody>
<tr> <tr>
<td <td
@ -685,7 +706,7 @@ separat.<br>
</h3> </h3>
<br> <br>
<table style="text-align: left; width: 280px; height: 50px;" border="0" <table style="text-align: left; width: 280px; height: 50px;" border="0"
cellspacing="2" cellpadding="2"> cellpadding="2" cellspacing="2">
<tbody> <tbody>
<tr> <tr>
<td <td
@ -716,7 +737,7 @@ itself which should be executed by lamdaemon.<br>
</h3> </h3>
<br> <br>
<table style="text-align: left; width: 280px; height: 50px;" border="0" <table style="text-align: left; width: 280px; height: 50px;" border="0"
cellspacing="2" cellpadding="2"> cellpadding="2" cellspacing="2">
<tbody> <tbody>
<tr> <tr>
<td <td
@ -737,7 +758,7 @@ is needed t interact with the user.<br>
</h3> </h3>
<br> <br>
<table style="text-align: left; width: 386px; height: 50px;" border="0" <table style="text-align: left; width: 386px; height: 50px;" border="0"
cellspacing="2" cellpadding="2"> cellpadding="2" cellspacing="2">
<tbody> <tbody>
<tr> <tr>
<td <td
@ -775,7 +796,7 @@ array();<br>
</h3> </h3>
<br> <br>
<table style="text-align: left; width: 346px; height: 50px;" border="0" <table style="text-align: left; width: 346px; height: 50px;" border="0"
cellspacing="2" cellpadding="2"> cellpadding="2" cellspacing="2">
<tbody> <tbody>
<tr> <tr>
<td <td
@ -797,7 +818,7 @@ is needed t interact with the user.<br>
</h3> </h3>
<br> <br>
<table style="text-align: left; width: 346px; height: 50px;" border="0" <table style="text-align: left; width: 346px; height: 50px;" border="0"
cellspacing="2" cellpadding="2"> cellpadding="2" cellspacing="2">
<tbody> <tbody>
<tr> <tr>
<td <td
@ -819,7 +840,7 @@ is needed t interact with the user.<br>
</h3> </h3>
<br> <br>
<table style="text-align: left; width: 346px; height: 50px;" border="0" <table style="text-align: left; width: 346px; height: 50px;" border="0"
cellspacing="2" cellpadding="2"> cellpadding="2" cellspacing="2">
<tbody> <tbody>
<tr> <tr>
<td <td
@ -842,7 +863,7 @@ is needed t interact with the user.<br>
</h3> </h3>
<br> <br>
<table style="text-align: left; width: 346px; height: 50px;" border="0" <table style="text-align: left; width: 346px; height: 50px;" border="0"
cellspacing="2" cellpadding="2"> cellpadding="2" cellspacing="2">
<tbody> <tbody>
<tr> <tr>
<td <td
@ -1184,7 +1205,16 @@ head, 2 =&gt; message text, 3 =&gt; additional variables)</li>
</ul> </ul>
</ul> </ul>
<br> <br>
<h3>6.8 get_configOptions()<br> <h3>6.8 load_profile()<br>
</h3>
&nbsp;&nbsp;&nbsp; "profile_mappings" =&gt; array('profile_identifier1'
=&gt; 'LDAP_attribute1', 'profile_identifier2' =&gt; 'LDAP_attribute2')<br>
<br>
&nbsp;&nbsp;&nbsp; The mapped values are stored directly in
$this-&gt;attributes.<br>
<span style="font-weight: bold;"><span style="font-style: italic;"><br>
</span></span>
<h3>6.9 get_configOptions()<br>
</h3> </h3>
&nbsp;&nbsp;&nbsp; "config_options" =&gt; array('user' =&gt; array, &nbsp;&nbsp;&nbsp; "config_options" =&gt; array('user' =&gt; array,
'host' =&gt; array, 'all' =&gt; array)<br> 'host' =&gt; array, 'all' =&gt; array)<br>
@ -1200,7 +1230,7 @@ the
return value of get_configOptions().<br> return value of get_configOptions().<br>
<br> <br>
</span></span> </span></span>
<h3>6.9 get_configDescriptions()<br> <h3>6.10 get_configDescriptions()<br>
</h3> </h3>
&nbsp;&nbsp;&nbsp; "config_descriptions" =&gt; array<br> &nbsp;&nbsp;&nbsp; "config_descriptions" =&gt; array<br>
<br> <br>
@ -1209,7 +1239,7 @@ return value of get_configOptions().<br>
return value of get_configDescriptions().<br> return value of get_configDescriptions().<br>
<br> <br>
</span></span> </span></span>
<h3>6.10 check_configOptions()<br> <h3>6.11 check_configOptions()<br>
</h3> </h3>
&nbsp;&nbsp;&nbsp; "config_checks" =&gt; array('user' =&gt; array, &nbsp;&nbsp;&nbsp; "config_checks" =&gt; array('user' =&gt; array,
'host' =&gt; 'array', 'all' =&gt; array)<br> 'host' =&gt; 'array', 'all' =&gt; array)<br>
@ -1223,14 +1253,14 @@ the other values only if they are inside the <span
check_profileOptions().<br> check_profileOptions().<br>
<br> <br>
</span></span> </span></span>
<h3>6.11 get_uploadColumns()</h3> <h3>6.12 get_uploadColumns()</h3>
"upload_columns" =&gt; array()<br> "upload_columns" =&gt; array()<br>
<span style="font-weight: bold;"><br> <span style="font-weight: bold;"><br>
<span style="font-style: italic;">Syntax for array is the same as for <span style="font-style: italic;">Syntax for array is the same as for
the the
return value of get_uploadColumns().<br> return value of get_uploadColumns().<br>
</span></span><br> </span></span><br>
<h3>6.12 get_uploadPreDepends()</h3> <h3>6.13 get_uploadPreDepends()</h3>
"upload_preDepends" =&gt; array()<br> "upload_preDepends" =&gt; array()<br>
<span style="font-weight: bold;"><br> <span style="font-weight: bold;"><br>
<span style="font-style: italic;">Syntax for array is the same as for <span style="font-style: italic;">Syntax for array is the same as for