added advanced upload and RDN
This commit is contained in:
parent
476565f934
commit
4ed8533bd5
|
@ -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>
|
||||||
|
|
|
@ -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;"> /**<br>
|
||||||
|
* Returns meta data that is interpreted by parent
|
||||||
|
class<br>
|
||||||
|
*<br>
|
||||||
|
* @return array array with meta data<br>
|
||||||
|
*/<br>
|
||||||
|
<span style="font-weight: bold;"> function</span>
|
||||||
|
get_metaData() {<br>
|
||||||
|
$return = array();<br>
|
||||||
|
// RDN attributes<br>
|
||||||
|
$return["RDN"] = array("uid"
|
||||||
|
=> "normal", "cn" => "low");<br>
|
||||||
|
[...]<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>
|
|
@ -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;"> /**<br>
|
||||||
|
* Returns meta data that is interpreted by parent
|
||||||
|
class<br>
|
||||||
|
*<br>
|
||||||
|
* @return array array with meta data<br>
|
||||||
|
*/<br>
|
||||||
|
<span style="font-weight: bold;"> function</span>
|
||||||
|
get_metaData() {<br>
|
||||||
|
$return = array();<br>
|
||||||
|
// upload dependencies<br>
|
||||||
|
$return[<span
|
||||||
|
style="color: rgb(255, 0, 0);">'upload_preDepends'</span>] =
|
||||||
|
array('posixGroup');<br>
|
||||||
|
[...]<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;"> /**<br>
|
||||||
|
* This function executes one post upload action.<br>
|
||||||
|
*<br>
|
||||||
|
* @param array $data array containing one account in
|
||||||
|
each element<br>
|
||||||
|
* @param array $ids array(<column_name> =>
|
||||||
|
<column number>)<br>
|
||||||
|
* @param array $failed list of accounts which were
|
||||||
|
not created successfully<br>
|
||||||
|
* @param array $temp variable to store temporary
|
||||||
|
data between two post actions<br>
|
||||||
|
* @return array current status<br>
|
||||||
|
* <br> array (<br>
|
||||||
|
* <br> 'status' => 'finished' |
|
||||||
|
'inProgress'<br>
|
||||||
|
* <br> 'progress' => 0..100<br>
|
||||||
|
* <br> 'errors' => array (<array
|
||||||
|
of parameters for StatusMessage>)<br>
|
||||||
|
* <br> )<br>
|
||||||
|
*/<br>
|
||||||
|
<span style="font-weight: bold;">function</span> <span
|
||||||
|
style="color: rgb(255, 0, 0);">doUploadPostActions</span>($data, $ids,
|
||||||
|
$failed, &$temp) {<br>
|
||||||
|
[...]<br>
|
||||||
|
}<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>
|
Loading…
Reference in New Issue