Debian Codegraph @

docs/devel/mod_accountPages.htm

raw symbols SCIP
1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
2 <html lang="en"><head><title>Module HowTo - Account pages</title>
3
4
5
6 <link rel="stylesheet" type="text/css" href="style/layout.css"><link rel="shortcut icon" type="image/x-icon" href="images/favicon.ico"></head><body>
7 <div style="text-align: center;">
8 <h1>Module HowTo - Account pages<br>
9 </h1>
10 <br>
11 <br>
12 <div style="text-align: left;"><br>
13 <h2>1. Loading the LDAP attributes<br>
14 </h2>
15 Every time the user selects an existing account to modify LAM will load
16 the complete LDAP entry of it. Your module then should select the
17 attributes which are useful for it.<br>
18 There are two variables in <span style="font-style: italic;">baseModule</span>
19 which should be used to store the attributes. The <span style="font-weight: bold;">$attributes</span> variable stores the
20 current attributes including changes the user made. The <span style="font-weight: bold;">$orig</span> variable stores the attributes
21 as they were originally when the account was loaded. This allows you to
22 see what changes were made.<br>
23 <br>
24 The <span style="font-weight: bold;">load_attributes()</span> function
25 in your module gets the complete attribute list from LDAP.<br>
26 In most cases you will not need to implement this function because the
27 parent class baseModule loads attributes based on your meta data.<br>
28 <br>
29 <span style="font-weight: bold; text-decoration: underline;">Example:</span><br style="font-weight: bold; text-decoration: underline;">
30 <br>
31 The <span style="font-style: italic;">ieee802Device</span> uses an
32 object class and the <span style="font-style: italic;">'macAddress'</span>
33 attribute. Therefore we will save these two values.<br>
34 <br>
35 <div class="mod-code">
36 &nbsp;&nbsp;&nbsp; * This function loads all needed attributes into the
37 object.<br>
38 &nbsp;&nbsp;&nbsp; *<br>
39 &nbsp;&nbsp;&nbsp; * @param array $attr an array as it is returned from
40 ldap_get_attributes<br>
41 &nbsp;&nbsp;&nbsp; */<br>
42 &nbsp;&nbsp;&nbsp; <span style="font-weight: bold;">function</span> <span style="color: rgb(255, 0, 0);">load_attributes</span>($attr) {<br>
43 &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
44 $this-&gt;attributes['objectClass'] = array();<br>
45 &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
46 $this-&gt;attributes['macAddress'] = array();<br>
47 &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; $this-&gt;orig['objectClass'] =
48 array();<br>
49 &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; $this-&gt;orig['macAddress'] =
50 array();<br>
51 &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; if (isset($attr['objectClass'])) {<br>
52 &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
53 $this-&gt;attributes['objectClass'] = $attr['objectClass'];<br>
54 &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
55 $this-&gt;orig['objectClass'] = $attr['objectClass'];<br>
56 &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; }<br>
57 &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; if (isset($attr['macAddress'])) {<br>
58 &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
59 $this-&gt;attributes['macAddress'] = $attr['macAddress'];<br>
60 &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
61 $this-&gt;orig['macAddress'] = $attr['macAddress'];<br>
62 &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; }<br>
63 &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; return 0;<br>
64 &nbsp;&nbsp;&nbsp; }<br>
65 </div>
66 <br>
67 <br>
68 <h2>2. Page display</h2>
69 Now that you have defined your subpages you will need one function for
70 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>
71 This function is called <span style="font-weight: bold;">display_html_&lt;page
72 name&gt;()</span> where <span style="font-style: italic;">&lt;page
73 name&gt;</span> is the name of your subpage.<br>
74 <br>
75 See also baseModule::addSimpleInputTextField() and
76 baseModule::addMultiValueInputTextField()/processMultiValueInputTextField()
77 if you only want to add some simple text fields.<br>
78 <br>
79 <span style="font-weight: bold; text-decoration: underline;">Example:</span><br style="font-weight: bold; text-decoration: underline;">
80 <br>
81 The
82 <span style="font-style: italic;">ieee802Device</span>
83 module has only one subpage called <span style="font-style: italic;">'attributes'</span>.<br>
84 <br>
85 The first half of the code displays the existing MAC addresses and the
86 second an input field for new values.<br>
87 The variable <span style="font-style: italic;">$this-&gt;attributes</span>
88 contains the LDAP attributes which are useful for this module.<br>
89 <br>
90 <div class="mod-code">
91 &nbsp;&nbsp;&nbsp; * This function will create the meta HTML code to
92 show a page with all attributes.<br>
93 &nbsp;&nbsp;&nbsp; *<br>
94 &nbsp;&nbsp;&nbsp; * @return htmlElement HTML meta data<br>
95 &nbsp;&nbsp;&nbsp; */<br>
96 &nbsp;&nbsp;&nbsp; <span style="font-weight: bold;">function</span> <span style="color: rgb(255, 0, 0);">display_html_attributes</span>() {<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; $return = new htmlTable();<br>
97 &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; $macCount = 0;<br>
98 &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; // list current MACs<br>
99 &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; if (isset($this-&gt;attributes['macAddress'])) {<br>
100 &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; $macCount = sizeof($this-&gt;attributes['macAddress']);<br>
101 &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; for ($i = 0;
102 $i &lt; sizeof($this-&gt;attributes['macAddress']); $i++) {<br>
103 &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
104 &nbsp;&nbsp;&nbsp; $return-&gt;addElement(new htmlOutputText(_('MAC
105 address')));<br>
106 &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
107 &nbsp;&nbsp;&nbsp; $macInput = new htmlInputField('macAddress' . $i,
108 $this-&gt;attributes['macAddress'][$i]);<br>
109 &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; $macInput-&gt;setFieldSize(17);<br>
110 &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; $macInput-&gt;setFieldMaxLength(17);<br>
111 &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; $return-&gt;addElement($macInput);<br>
112 &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
113 &nbsp;&nbsp;&nbsp; $return-&gt;addElement(new htmlButton('delMAC' . $i,
114 'del.png', true));<br>
115 &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
116 &nbsp;&nbsp;&nbsp; $return-&gt;addElement(new htmlHelpLink('mac'),
117 true);<br>
118 &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; }<br>
119 &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; }<br>
120 &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; // input box for new MAC<br>
121 &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; $return-&gt;addElement(new htmlOutputText(_('New MAC address')));<br>
122 &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; $newMacInput = new htmlInputField('macAddress', '');<br>
123 &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; $newMacInput-&gt;setFieldSize(17);<br>
124 &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; $newMacInput-&gt;setFieldMaxLength(17);<br>
125 &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; $return-&gt;addElement($newMacInput);<br>
126 &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; $return-&gt;addElement(new htmlButton('addMAC', 'add.png', true));<br>
127 &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; $return-&gt;addElement(new htmlHelpLink('mac'));<br>
128 &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; $return-&gt;addElement(new htmlHiddenInput('mac_number', $macCount));<br>
129 &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; return $return;<br>
130 &nbsp;&nbsp;&nbsp; }<br>
131 </div>
132 <br>
133 <br>
134 <h2>3. Processing input data<br>
135 </h2>
136 Every time the user clicks on a submit button while your page is
137 displayed LAM will call a function in your module.<br>
138 This function is called <span style="font-weight: bold;">process_&lt;page
139 name&gt;()</span> where <span style="font-style: italic;">&lt;page
140 name&gt;</span> is the name of your subpage.<br>
141 <br>
142 If all input data is ok then return an empty array. If you return one or more error messages then the user will be
143 redirected to your page.<br>
144 <br>
145 <span style="font-weight: bold; text-decoration: underline;">Example:</span><br style="font-weight: bold; text-decoration: underline;">
146 <br>
147 The
148 <span style="font-style: italic;">ieee802Device</span>
149 module has only one subpage called <span style="font-style: italic;">'attributes'</span>
150 and therefore only <span style="font-style: italic;">process_attributes()</span>.<br>
151 <br>
152 The function checks the input fields and fills the LDAP attributes. If
153 all is ok it will enable the user to move to another module page.<br>
154 <br>
155 <div class="mod-code">
156 &nbsp;&nbsp;&nbsp; * Write variables into object and do some regex
157 checks<br>
158 &nbsp;&nbsp;&nbsp; *<br>
159 &nbsp;&nbsp;&nbsp; * @param array $post HTTP-POST values<br>
160 &nbsp;&nbsp;&nbsp; */<br>
161 &nbsp;&nbsp;&nbsp; <span style="font-weight: bold;">function</span> <span style="color: rgb(255, 0, 0);">process_attributes</span>($post) {<br>
162 &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; $errors = array();<br>
163 &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
164 $this-&gt;attributes['macAddress'] = array();<br>
165 &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; // check old MACs<br>
166 &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; if (isset($post['mac_number'])) {<br>
167 &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; for ($i = 0;
168 $i &lt; $post['mac_number']; $i++) {<br>
169 &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
170 &nbsp;&nbsp;&nbsp; if (isset($post['delMAC' . $i])) continue;<br>
171 &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
172 &nbsp;&nbsp;&nbsp; if (isset($post['macAddress' . $i]) &amp;&amp;
173 ($post['macAddress' . $i] != "")) {<br>
174 &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
175 &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; // check if address has correct
176 format<br>
177 &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
178 &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; if (!get_preg($post['macAddress'
179 . $i], 'macAddress')) {<br>
180 &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
181 &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; $message =
182 $this-&gt;messages['mac'][0];<br>
183 &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
184 &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; $message[] =
185 $post['macAddress' . $i];<br>
186 &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
187 &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; $errors[] = $message;<br>
188 &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
189 &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; }<br>
190 &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
191 &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
192 $this-&gt;attributes['macAddress'][] = $post['macAddress' . $i];<br>
193 &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
194 &nbsp;&nbsp;&nbsp; }<br>
195 &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; }<br>
196 &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; }<br>
197 &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; // check new MAC<br>
198 &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; if (isset($post['macAddress'])
199 &amp;&amp; ($post['macAddress'] != "")) {<br>
200 &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; // check if
201 address has correct format<br>
202 &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; if
203 (get_preg($post['macAddress'], 'macAddress')) {<br>
204 &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
205 &nbsp;&nbsp;&nbsp; $this-&gt;attributes['macAddress'][] =
206 $post['macAddress'];<br>
207 &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; }<br>
208 &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; else {<br>
209 &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
210 &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; $message =
211 $this-&gt;messages['mac'][0];<br>
212 &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
213 &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; $message[] = $post['macAddress'];<br>
214 &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
215 &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; $errors[] = $message;<br>
216 &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; }<br>
217 &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; }<br>
218 &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
219 $this-&gt;attributes['macAddress'] =
220 array_unique($this-&gt;attributes['macAddress']);<br>
221 &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; return $errors;<br>
222 &nbsp;&nbsp;&nbsp; }<br>
223 </div>
224 <br>
225 <br>
226 <h2>4. Defining that your module is ready for user input and LDAP
227 add/modify</h2>
228 In most cases you will not need to implement these functions. The <span style="font-style: italic;">baseModule</span> will return <span style="font-style: italic;">true</span> for both functions.<br>
229 <br>
230 <span style="text-decoration: underline;"><br>
231 There are two functions which control the module status:</span><br style="text-decoration: underline;">
232 <br>
233 The <span style="font-weight: bold;">module_ready()</span> function
234 has to
235 return <span style="font-style: italic;">true</span> if the user may
236 move to your module page. If it is <span style="font-style: italic;">false</span>
237 the user will be shown an error message that your module is not yet
238 ready. You can use this if your module depends on input data from other
239 modules (e.g. you need the user name from posixAccount first).<br>
240 <br>
241 The second function is
242 <span style="font-weight: bold;">module_complete()</span>. The user
243 cannot do the LDAP operation if one or more modules return <span style="font-style: italic;">false</span>. This defines if all needed
244 input data for your module was entered.<br>
245 Use this function if you want to check that all required attributes are
246 set.<br>
247 <br>
248 <span style="font-weight: bold; text-decoration: underline;">Example:</span><br style="font-weight: bold; text-decoration: underline;">
249 <br>
250 The <span style="font-style: italic;">sambaSamAccount</span>
251 module needs the user's <span style="font-style: italic;">uidNumber</span>
252 and <span style="font-style: italic;">gidNumber</span> before it can
253 accept input and the account needs a <span style="font-style: italic;">sambaSID</span>
254 before it can be saved.<br>
255 <br>
256 <div class="mod-code">
257 &nbsp;&nbsp;&nbsp; * This function is used to check if this module page
258 can be displayed.<br>
259 &nbsp;&nbsp;&nbsp; * It returns false if a module depends on data from
260 other modules which was not yet entered.<br>
261 &nbsp;&nbsp;&nbsp; *<br>
262 &nbsp;&nbsp;&nbsp; * @return boolean true, if page can be displayed<br>
263 &nbsp;&nbsp;&nbsp; */<br>
264 &nbsp;&nbsp;&nbsp; <span style="font-weight: bold;">function</span> <span style="color: rgb(255, 0, 0);">module_ready</span>() {<br>
265 &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; if
266 ($_SESSION[$this-&gt;base]-&gt;module['posixAccount']-&gt;attributes['gidNumber'][0]=='')
267 return false;<br>
268 &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; if
269 ($_SESSION[$this-&gt;base]-&gt;module['posixAccount']-&gt;attributes['uidNumber'][0]=='')
270 return false;<br>
271 &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; if
272 ($this-&gt;attributes['uid'][0]=='') return false;<br>
273 &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; return true;<br>
274 &nbsp;&nbsp;&nbsp; }<br>
275 <br>
276 &nbsp;&nbsp;&nbsp; /**<br>
277 &nbsp;&nbsp;&nbsp; * This functions is used to check if all settings
278 for this module have been made.<br>
279 &nbsp;&nbsp;&nbsp; *<br>
280 &nbsp;&nbsp;&nbsp; * @return boolean true, if settings are complete<br>
281 &nbsp;&nbsp;&nbsp; */<br>
282 &nbsp;&nbsp;&nbsp; <span style="font-weight: bold;">function</span> <span style="color: rgb(255, 0, 0);">module_complete</span>() {<br>
283 &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; if (!$this-&gt;module_ready())
284 return false;<br>
285 &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; if
286 ($this-&gt;attributes['sambaSID'][0] == '') return false;<br>
287 &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; return true;<br>
288 &nbsp;&nbsp;&nbsp; }<br>
289 <br>
290 </div>
291 <br>
292 <br>
293 <h2>5. Saving the LDAP attributes<br>
294 </h2>
295 In most cases you will not have to implement this option if you use <span style="font-weight: bold;">$this-&gt;attributes</span> and <span style="font-weight: bold;">$this-&gt;orig</span> to manage the LDAP
296 attributes. The <span style="font-style: italic;">baseModule</span>
297 will generate the save commands for you.<br>
298 <br>
299 When all modules report that they are ready for LDAP add/modify and the
300 user clicks on the add/modify button your module will be asked what
301 changes have to be made.<br>
302 This is done in the function <span style="font-weight: bold;">save_attributes()</span>.<br>
303 <br>
304 <span style="font-weight: bold; text-decoration: underline;">Example:</span><br style="font-weight: bold; text-decoration: underline;">
305 <br>
306 The <span style="font-style: italic;">kolabUser</span> module uses
307 this function to make sure that its object class is saved. Other
308 modules (e.g. quota) use it build the lamdaemon commands.<br>
309 <br>
310 <div class="mod-code">
311 &nbsp;&nbsp;&nbsp; * Returns a list of modifications which have to be
312 made to the LDAP account.<br>
313 &nbsp;&nbsp;&nbsp; *<br>
314 &nbsp;&nbsp;&nbsp; * @return array list of modifications<br>
315 &nbsp;&nbsp;&nbsp; * &lt;br&gt;This function returns an array with 3
316 entries:<br>
317 &nbsp;&nbsp;&nbsp; * &lt;br&gt;array( DN1 ('add' =&gt; array($attr),
318 'remove' =&gt; array($attr), 'modify' =&gt; array($attr)), DN2 .... )<br>
319 &nbsp;&nbsp;&nbsp; * &lt;br&gt;DN is the DN to change. It may be
320 possible to change several DNs (e.g. create a new user and add him to
321 some groups via attribute memberUid)<br>
322 &nbsp;&nbsp;&nbsp; * &lt;br&gt;"add" are attributes which have to be
323 added to LDAP entry<br>
324 &nbsp;&nbsp;&nbsp; * &lt;br&gt;"remove" are attributes which have to be
325 removed from LDAP entry<br>
326 &nbsp;&nbsp;&nbsp; * &lt;br&gt;"modify" are attributes which have to
327 been modified in LDAP entry<br>
328 &nbsp;&nbsp;&nbsp; */<br>
329 &nbsp;&nbsp;&nbsp; function save_attributes() {<br>
330 &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; // add object class if needed<br>
331 &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; if
332 (!isset($this-&gt;attributes['objectClass']) ||
333 !in_array('kolabInetOrgPerson', $this-&gt;attributes['objectClass'])) {<br>
334 &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
335 $this-&gt;attributes['objectClass'][] = 'kolabInetOrgPerson';<br>
336 &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; }<br>
337 &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; return parent::save_attributes();<br>
338 &nbsp;&nbsp;&nbsp; }<br>
339 </div>
340 <br>
341 <br>
342 </div>
343 </div>
344 </body></html>