LDAPAccountManager/lam/docs/devel/mod_accountPages.htm

421 lines
18 KiB
HTML
Raw Normal View History

2004-11-01 13:56:54 +00:00
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Module HowTo - Account pages</title>
<link rel="stylesheet" type="text/css" href="style/layout.css">
</head>
<body>
<div style="text-align: center;">
<h1>Module HowTo - Account pages<br>
</h1>
<br>
<br>
<div style="text-align: left;"><br>
2004-11-01 16:53:58 +00:00
<h2>1. Loading the LDAP attributes<br>
</h2>
Every time the user selects an existing account to modify LAM will load
the complete LDAP entry of it. Your module then should select the
attributes which are useful for it.<br>
There are two variables in <span style="font-style: italic;">baseModule</span>
which should be used to store the attributes. The <span
style="font-weight: bold;">$attributes</span> variable stores the
current attributes including changes the user made. The <span
style="font-weight: bold;">$orig</span> variable stores the attributes
as they were originally when the account was loaded. This allows you to
see what changes were made.<br>
<br>
The <span style="font-weight: bold;">load_attributes()</span> function
in your module gets the complete attribute list from LDAP.<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;">ieee802Device</span> uses an
object class and the <span style="font-style: italic;">'macAddress'</span>
attribute. Therefore we will save this two values.<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 loads all needed attributes into the
object.<br>
&nbsp;&nbsp;&nbsp; *<br>
&nbsp;&nbsp;&nbsp; * @param array $attr an array as it is retured from
ldap_get_attributes<br>
&nbsp;&nbsp;&nbsp; */<br>
&nbsp;&nbsp;&nbsp; <span style="font-weight: bold;">function</span> <span
style="color: rgb(255, 0, 0);">load_attributes</span>($attr) {<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
$this-&gt;attributes['objectClass'] = array();<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
$this-&gt;attributes['macAddress'] = array();<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; $this-&gt;orig['objectClass'] =
array();<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; $this-&gt;orig['macAddress'] =
array();<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; if (isset($attr['objectClass'])) {<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
unset($attr['objectClass']['count']);<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
$this-&gt;attributes['objectClass'] = $attr['objectClass'];<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
$this-&gt;orig['objectClass'] = $attr['objectClass'];<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; }<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; if (isset($attr['macAddress'])) {<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
unset($attr['macAddress']['count']);<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
$this-&gt;attributes['macAddress'] = $attr['macAddress'];<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
$this-&gt;orig['macAddress'] = $attr['macAddress'];<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; }<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; return 0;<br>
&nbsp;&nbsp;&nbsp; }<br>
</td>
</tr>
</tbody>
</table>
<br>
<br>
<h2>2. Defining pages<br>
2004-11-01 13:56:54 +00:00
</h2>
You can define multiple subpages for your account page. Usually one
page is enough but you may display certain attribute settings on an
extra page (e.g. Unix group memberships are on a second page).<br>
<br>
The page names are set by <span style="font-weight: bold;">pages() </span>which
returns an array of names.<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;">ieee802Device</span>
module needs only one page which is called <span
style="font-style: italic;">'attributes'</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; * This function returns a list of all account pages
in this module.<br>
&nbsp;&nbsp;&nbsp; */<br>
&nbsp;&nbsp;&nbsp; <span style="font-weight: bold;">function</span> <span
style="color: rgb(255, 0, 0);">pages</span>() {<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; return array('attributes');<br>
&nbsp;&nbsp;&nbsp; }<br>
</td>
</tr>
</tbody>
</table>
<br>
<br>
2004-11-01 16:53:58 +00:00
<h2>3. Page display</h2>
2004-11-01 13:56:54 +00:00
Now that you have defined your subpages you will need one function for
each page to display it. The function must return <span
style="font-style: italic;">meta HTML code</span> as defined in the <span
style="font-style: italic;">modules specification</span>.<br>
This function is called <span style="font-weight: bold;">display_html_&lt;page
name&gt;()</span> where <span style="font-style: italic;">&lt;page
name&gt;</span> is the name of your subpage.<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;">ieee802Device</span>
module has only one subpage called <span style="font-style: italic;">'attributes'</span>.<br>
<br>
The first half of the code displays the existing MAC addresses and the
second an input field for new values.<br>
The variable <span style="font-style: italic;">$this-&gt;attributes</span>
2004-11-01 16:53:58 +00:00
contains the LDAP attributes which are useful for this module.<br>
2004-11-01 13:56:54 +00:00
<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 will create the meta HTML code to
show a page with all attributes.<br>
&nbsp;&nbsp;&nbsp; *<br>
&nbsp;&nbsp;&nbsp; * @param array $post HTTP-POST values<br>
&nbsp;&nbsp;&nbsp; */<br>
&nbsp;&nbsp;&nbsp; <span style="font-weight: bold;">function</span> <span
style="color: rgb(255, 0, 0);">display_html_attributes</span>($post) {<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; $return = array();<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; // list current MACs<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; for ($i = 0; $i &lt;
sizeof($this-&gt;attributes['macAddress']); $i++) {<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; $return[] =
array(<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp; 0 =&gt; array('kind' =&gt; 'text', 'text' =&gt;
_('MAC address')),<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp; 1 =&gt; array('kind' =&gt; 'input', 'name' =&gt;
'macAddress' . $i, 'type' =&gt; 'text', 'size' =&gt; '17', 'maxlength'
=&gt; '17', 'value' =&gt; $this-&gt;attributes['macAddress'][$i]),<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp; 2 =&gt; array('kind' =&gt; 'input', 'type' =&gt;
'submit', 'name' =&gt; 'delMAC' . $i, 'value' =&gt; _("Remove")),<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp; 3 =&gt; array('kind' =&gt; 'help', 'value' =&gt;
'mac'));<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; }<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; // input box for new MAC<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; $return[] = array(<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; 0 =&gt;
array('kind' =&gt; 'text', 'text' =&gt; _('New MAC address')),<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; 1 =&gt;
array('kind' =&gt; 'input', 'name' =&gt; 'macAddress', 'type' =&gt;
'text', 'size' =&gt; '17', 'maxlength' =&gt; '17', 'value' =&gt; ''),<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; 2 =&gt;
array('kind' =&gt; 'input', 'type' =&gt; 'submit', 'name' =&gt;
'addMAC', 'value' =&gt; _("Add")),<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; 3 =&gt;
array('kind' =&gt; 'help', 'value' =&gt; 'mac'),<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; 4 =&gt;
array('kind' =&gt; 'input', 'type' =&gt; 'hidden', 'value' =&gt;
sizeof($this-&gt;attributes['macAddress']), 'name' =&gt; 'mac_number'));<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; return $return;<br>
&nbsp;&nbsp;&nbsp; }<br>
</td>
</tr>
</tbody>
</table>
<br>
<br>
2004-11-01 16:53:58 +00:00
<h2>4. Processing input data<br>
2004-11-01 13:56:54 +00:00
</h2>
Every time the user clicks on a submit button while your page is
displayed LAM will call a function in your module.<br>
This function is called <span style="font-weight: bold;">process_&lt;page
name&gt;()</span> where <span style="font-style: italic;">&lt;page
name&gt;</span> is the name of your subpage.<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;">ieee802Device</span>
module has only one subpage called <span style="font-style: italic;">'attributes'</span>
and therefore only <span style="font-style: italic;">process_attributes()</span>.<br>
<br>
The function checks the input fields and fills the LDAP attributes. If
all is ok it will enable the user to move to another module page.<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; * Write variables into object and do some regex
checks<br>
&nbsp;&nbsp;&nbsp; *<br>
&nbsp;&nbsp;&nbsp; * @param array $post HTTP-POST values<br>
&nbsp;&nbsp;&nbsp; */<br>
&nbsp;&nbsp;&nbsp; <span style="font-weight: bold;">function</span> <span
style="color: rgb(255, 0, 0);">proccess_attributes</span>($post) {<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; $this-&gt;triggered_messages =
array();<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
$this-&gt;attributes['macAddress'] = array();<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; // check old MACs<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; if (isset($post['mac_number'])) {<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; for ($i = 0;
$i &lt; $post['mac_number']; $i++) {<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp; if (isset($post['delMAC' . $i])) continue;<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp; if (isset($post['macAddress' . $i]) &amp;&amp;
($post['macAddress' . $i] != "")) {<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; // check if address has correct
format<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; if (!get_preg($post['macAddress'
. $i], 'macAddress')) {<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; $message =
$this-&gt;messages['mac'][0];<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; $message[] =
$post['macAddress' . $i];<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
$this-&gt;triggered_messages[] = array($message);<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; }<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
$this-&gt;attributes['macAddress'][] = $post['macAddress' . $i];<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp; }<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; }<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; }<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; // check new MAC<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; if (isset($post['macAddress'])
&amp;&amp; ($post['macAddress'] != "")) {<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; // check if
address has correct format<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; if
(get_preg($post['macAddress'], 'macAddress')) {<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp; $this-&gt;attributes['macAddress'][] =
$post['macAddress'];<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; }<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; else {<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; $message =
$this-&gt;messages['mac'][0];<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; $message[] = $post['macAddress'];<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; $this-&gt;triggered_messages[] =
array($message);<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; }<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; }<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
$this-&gt;attributes['macAddress'] =
array_unique($this-&gt;attributes['macAddress']);<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; if
(sizeof($this-&gt;triggered_messages) &gt; 0) {<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
$this-&gt;inputCorrect = false;<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; return
$this-&gt;triggered_messages;<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; }<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; else {<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
$this-&gt;inputCorrect = true;<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; return 0;<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; }<br>
&nbsp;&nbsp;&nbsp; }<br>
</td>
</tr>
</tbody>
</table>
<br>
<br>
2004-11-01 16:53:58 +00:00
<h2>5. Defining that your module is ready for LDAP add/modify</h2>
2004-11-01 13:56:54 +00:00
Before a new account can be created or modified all modules are asked
if they are ready.<br>
There are two functions which control the module status. The <span
style="font-weight: bold;">module_ready()</span> function has to
return <span style="font-style: italic;">true</span> if the user may
move to another module page. If it is <span style="font-style: italic;">false</span>
the user will be redirected to your module page. The second function is
<span style="font-weight: bold;">module_complete()</span>. The user
cannot do the LDAP operation if one or modules return <span
style="font-style: italic;">false</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;">ieee802Device</span>
module uses a global variable to store the status: <span
style="font-style: italic;">$this-&gt;inputCorrect</span>. It is set
in <span style="font-style: italic;">process_attributes()</span>. The
variable can be preset to <span style="font-style: italic;">true</span>
because the MAC address is optional.<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; /** used for
account pages, true if input data is correct */<br>
2004-11-01 16:53:58 +00:00
&nbsp;&nbsp;&nbsp; <span style="font-weight: bold;">var</span>
$inputCorrect = true;<br>
2004-11-01 13:56:54 +00:00
<br>
&nbsp;&nbsp;&nbsp; /**<br>
&nbsp;&nbsp;&nbsp; * This function returns true if all needed settings
are done.<br>
&nbsp;&nbsp;&nbsp; */<br>
2004-11-01 16:53:58 +00:00
&nbsp;&nbsp;&nbsp; <span style="font-weight: bold;">function</span> <span
style="color: rgb(255, 0, 0);">module_complete</span>() {<br>
2004-11-01 13:56:54 +00:00
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; return $this-&gt;inputCorrect;<br>
&nbsp;&nbsp;&nbsp; }<br>
&nbsp;&nbsp;&nbsp; <br>
&nbsp;&nbsp;&nbsp; /**<br>
&nbsp;&nbsp;&nbsp; * Returns true if all settings on module page are
correct.<br>
&nbsp;&nbsp;&nbsp; */<br>
2004-11-01 16:53:58 +00:00
&nbsp;&nbsp;&nbsp; <span style="font-weight: bold;">function</span> <span
style="color: rgb(255, 0, 0);">module_ready</span>() {<br>
2004-11-01 13:56:54 +00:00
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; return $this-&gt;inputCorrect;<br>
&nbsp;&nbsp;&nbsp; }<br>
</td>
</tr>
</tbody>
</table>
<br>
<br>
2004-11-01 16:53:58 +00:00
<h2>6. Saving the LDAP attributes<br>
2004-11-01 13:56:54 +00:00
</h2>
2004-11-01 16:53:58 +00:00
When all modules report that they are ready for LDAP add/modify and the
user clicks on the add/modify button your module will be asked what
changes have to be made.<br>
This is done in the function <span style="font-weight: bold;">save_attributes()</span>
which must be implemented by your module.<br>
2004-11-01 13:56:54 +00:00
<br>
<span style="font-weight: bold; text-decoration: underline;">Example:</span><br
style="font-weight: bold; text-decoration: underline;">
<br>
2004-11-01 16:53:58 +00:00
The <span style="font-style: italic;">ieee802Device</span>
module saves the attribute states in <span style="font-style: italic;">$attributes</span>
and <span style="font-style: italic;">$orig</span> and there are no
other DNs which may be modified. Therefore we can use the <span
style="font-weight: bold;">save_module_attributes()</span> function in
<span style="font-weight: bold;">accountContainer</span>. You can
always access the current <span style="font-weight: bold;">accountContainer</span>
with <span style="font-weight: bold;">$_SESSION[$this-&gt;base]</span>.<br>
2004-11-01 13:56:54 +00:00
<br>
<table style="width: 100%; text-align: left;" class="mod-code"
border="0" cellpadding="2" cellspacing="2">
<tbody>
<tr>
2004-11-01 16:53:58 +00:00
<td style="vertical-align: top;">&nbsp;&nbsp;&nbsp; /**<br>
&nbsp;&nbsp;&nbsp; * Returns a list of modifications which have to be
made to the LDAP account.<br>
&nbsp;&nbsp;&nbsp; *<br>
&nbsp;&nbsp;&nbsp; * @return array list of modifications<br>
&nbsp;&nbsp;&nbsp; * &lt;br&gt;This function returns an array with 3
entries:<br>
&nbsp;&nbsp;&nbsp; * &lt;br&gt;array( DN1 ('add' =&gt; array($attr),
'remove' =&gt; array($attr), 'modify' =&gt; array($attr)), DN2 .... )<br>
&nbsp;&nbsp;&nbsp; * &lt;br&gt;DN is the DN to change. It may be
possible to change several DNs (e.g. create a new user and add him to
some groups via attribute memberUid)<br>
&nbsp;&nbsp;&nbsp; * &lt;br&gt;"add" are attributes which have to be
added to LDAP entry<br>
&nbsp;&nbsp;&nbsp; * &lt;br&gt;"remove" are attributes which have to be
removed from LDAP entry<br>
&nbsp;&nbsp;&nbsp; * &lt;br&gt;"modify" are attributes which have to
been modified in LDAP entry<br>
&nbsp;&nbsp;&nbsp; */<br>
&nbsp;&nbsp;&nbsp; <span style="font-weight: bold;">function</span> <span
style="color: rgb(255, 0, 0);">save_attributes</span>() {<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; return
$_SESSION[$this-&gt;base]-&gt;save_module_attributes($this-&gt;attributes,
$this-&gt;orig);<br>
&nbsp;&nbsp;&nbsp; }<br>
2004-11-01 13:56:54 +00:00
</td>
</tr>
</tbody>
</table>
<br>
<br>
<span style="font-weight: bold;"></span>
<h2><span style="font-weight: bold;"></span></h2>
</div>
</div>
</body>
</html>