added advanced upload and RDN

This commit is contained in:
Roland Gruber 2004-11-14 17:46:46 +00:00
parent 476565f934
commit 4ed8533bd5
3 changed files with 185 additions and 1 deletions

View File

@ -47,7 +47,10 @@ existing modules.<br>
<br> <br>
<h3><a href="mod_config.htm">2. Configuration options</a></h3> <h3><a href="mod_config.htm">2. Configuration options</a></h3>
<br> <br>
<h3>3. Advanced upload options</h3> <h3><a href="mod_upload2.htm">3. Advanced upload options</a></h3>
<br>
<h3><a href="mod_rdn.htm">4. Defining the RDN</a></h3>
<br>
<br> <br>
</div> </div>
</div> </div>

View File

@ -0,0 +1,59 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Module HowTo - Defining the RDN</title>
<link rel="stylesheet" type="text/css" href="style/layout.css">
</head>
<body>
<div style="text-align: center;">
<h1>Module HowTo - Defining the RDN<br>
</h1>
<div style="text-align: left;"><br>
Every LDAP DN starts with a RDN (relative DN). This is the value of a
LDAP attribute. Users usually use "uid", groups use "cn".<br>
You can provide a list of suitable RDN attributes for your module and
give them a priority, too.<br>
<br>
</div>
<div style="text-align: left;">You will need to implement the function <span
style="font-weight: bold;">get_RDNAttributes()</span> or use <span
style="font-weight: bold;">meta['RDN']</span>.<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;">posixAccount</span> module
offers to create accounts with DNs uid=foo,dc=.... and cn=foo,dc=...<br>
The uid attribute has a higher priority as it is the usual attribute
for Unix accounts.<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; // RDN attributes<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp; &nbsp;$return["RDN"] = array("uid"
=&gt; "normal", "cn" =&gt; "low");<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; [...]<br>
</td>
</tr>
</tbody>
</table>
<br>
<br>
<br>
<span style="font-weight: bold;"></span>
<h2><span style="font-weight: bold;"></span></h2>
</div>
</div>
</body>
</html>

View File

@ -0,0 +1,122 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Module HowTo - Advanced upload options</title>
<link rel="stylesheet" type="text/css" href="style/layout.css">
</head>
<body>
<div style="text-align: center;">
<h1>Module HowTo - Advanced upload options<br>
</h1>
<div style="text-align: left;"><br>
The <span style="font-style: italic;">ieee802Device</span> module only
needs the basic upload functions for its functionality.<br>
However there are more possibilities for the modules to control the
file upload.<br>
</div>
<div style="text-align: left;"><br>
<h2>1. Module order<br>
</h2>
Your module might depend on the input values of another module. In this
case you probably want that your module is called as the second one.<br>
<br>
You can define dependencies to other modules with the function <span
style="font-weight: bold;">get_uploadPreDepends()</span> or <span
style="font-weight: bold;">meta['upload_preDepends']</span>.<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;">sambaGroupMapping</span> module
needs the group name to set the default <span
style="font-style: italic;">displayName</span>. Therefore it depends
on the <span style="font-style: italic;">posixGroup</span> module<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; // upload dependencies<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp; &nbsp;$return[<span
style="color: rgb(255, 0, 0);">'upload_preDepends'</span>] =
array('posixGroup');<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; [...]<br>
</td>
</tr>
</tbody>
</table>
<br>
<br>
<h2>2. Upload post actions<br>
</h2>
If your module does not only create an account but relates the account
with other existing LDAP entries you can do these modifications after
the account was created.<br>
This is useful for adding users to groups or setting quotas.<br>
<br>
You have to implement the function <span style="font-weight: bold;">doUploadPostActions()</span>
in your module. Since post actions are very special there is no <span
style="font-style: italic;">meta data</span> for this.<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;">posixAccount</span> module
offers to put the user account in additional groups. This is done in
the post actions.<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; * This function executes one post upload action.<br>
&nbsp;&nbsp;&nbsp; *<br>
&nbsp;&nbsp;&nbsp; * @param array $data array containing one account in
each element<br>
&nbsp;&nbsp;&nbsp; * @param array $ids array(&lt;column_name&gt; =&gt;
&lt;column number&gt;)<br>
&nbsp;&nbsp;&nbsp; * @param array $failed list of accounts which were
not created successfully<br>
&nbsp;&nbsp;&nbsp; * @param array $temp variable to store temporary
data between two post actions<br>
&nbsp;&nbsp;&nbsp; * @return array current status<br>
&nbsp;&nbsp;&nbsp; * &lt;br&gt; array (<br>
&nbsp;&nbsp;&nbsp; * &lt;br&gt;&nbsp; 'status' =&gt; 'finished' |
'inProgress'<br>
&nbsp;&nbsp;&nbsp; * &lt;br&gt;&nbsp; 'progress' =&gt; 0..100<br>
&nbsp;&nbsp;&nbsp; * &lt;br&gt;&nbsp; 'errors' =&gt; array (&lt;array
of parameters for StatusMessage&gt;)<br>
&nbsp;&nbsp;&nbsp; * &lt;br&gt; )<br>
&nbsp;&nbsp;&nbsp; */<br>
&nbsp;&nbsp;&nbsp; <span style="font-weight: bold;">function</span> <span
style="color: rgb(255, 0, 0);">doUploadPostActions</span>($data, $ids,
$failed, &amp;$temp) {<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; [...]<br>
&nbsp;&nbsp;&nbsp; }<br>
</td>
</tr>
</tbody>
</table>
<br>
Please make sure that the actions in one call of <span
style="font-weight: bold;">doUploadPostActions()</span> are not very
time consuming (only one LDAP operation). Your function will be called
repeatedly until you give back the status "finished".<br>
This allows LAM to avoid running longer than the maximum execution time
by sending meta refreshes to the browser.<br>
<span style="font-weight: bold;"></span>
<h2><span style="font-weight: bold;"></span></h2>
</div>
</div>
</body>
</html>