bfd6bd462344fa05948a0664ff7081f006122ea9
1 <?php
2 /*!
3 \brief user plugin
4 \author Cajus Pollmeier <pollmeier@gonicus.de>
5 \version 2.00
6 \date 24.07.2003
8 This class provides the functionality to read and write all attributes
9 relevant for person, organizationalPerson, inetOrgPerson and gosaAccount
10 from/to the LDAP. It does syntax checking and displays the formulars required.
11 */
13 class user extends plugin
14 {
15 /* Definitions */
16 var $plHeadline= "Generic";
17 var $plDescription= "This does something";
19 /* CLI vars */
20 var $cli_summary= "Handling of GOsa's user base object";
21 var $cli_description= "Some longer text\nfor help";
22 var $cli_parameters= array("eins" => "Eins ist toll", "zwei" => "Zwei ist noch besser");
24 /* Plugin specific values */
25 var $base= "";
26 var $orig_base= "";
27 var $cn= "";
28 var $new_dn= "";
29 var $personalTitle= "";
30 var $academicTitle= "";
31 var $homePostalAddress= "";
32 var $homePhone= "";
33 var $labeledURI= "";
34 var $o= "";
35 var $ou= "";
36 var $departmentNumber= "";
37 var $employeeNumber= "";
38 var $employeeType= "";
39 var $roomNumber= "";
40 var $telephoneNumber= "";
41 var $facsimileTelephoneNumber= "";
42 var $mobile= "";
43 var $pager= "";
44 var $l= "";
45 var $st= "";
46 var $postalAddress= "";
47 var $dateOfBirth;
48 var $use_dob= "0";
49 var $gender="0";
50 var $preferredLanguage="0";
52 var $jpegPhoto= "*removed*";
53 var $photoData= "";
54 var $old_jpegPhoto= "";
55 var $old_photoData= "";
56 var $cert_dialog= FALSE;
57 var $picture_dialog= FALSE;
59 var $userPKCS12= "";
60 var $userSMIMECertificate= "";
61 var $userCertificate= "";
62 var $certificateSerialNumber= "";
63 var $old_certificateSerialNumber= "";
64 var $old_userPKCS12= "";
65 var $old_userSMIMECertificate= "";
66 var $old_userCertificate= "";
68 var $gouvernmentOrganizationalUnit= "";
69 var $houseIdentifier= "";
70 var $street= "";
71 var $postalCode= "";
72 var $vocation= "";
73 var $ivbbLastDeliveryCollective= "";
74 var $gouvernmentOrganizationalPersonLocality= "";
75 var $gouvernmentOrganizationalUnitDescription= "";
76 var $gouvernmentOrganizationalUnitSubjectArea= "";
77 var $functionalTitle= "";
78 var $role= "";
79 var $publicVisible= "";
81 var $orig_dn;
82 var $dialog;
84 /* variables to trigger password changes */
85 var $pw_storage= "crypt";
86 var $last_pw_storage= "crypt";
87 var $had_userCertificate= FALSE;
89 var $view_logged = FALSE;
91 /* attribute list for save action */
92 var $attributes= array("sn", "givenName", "uid", "personalTitle", "academicTitle",
93 "homePostalAddress", "homePhone", "labeledURI", "ou", "o", "dateOfBirth", "gender","preferredLanguage",
94 "departmentNumber", "employeeNumber", "employeeType", "l", "st","jpegPhoto",
95 "roomNumber", "telephoneNumber", "mobile", "pager", "cn", "userPKCS12",
96 "postalAddress", "facsimileTelephoneNumber", "userSMIMECertificate");
98 var $objectclasses= array("top", "person", "organizationalPerson", "inetOrgPerson",
99 "gosaAccount");
101 /* attributes that are part of the government mode */
102 var $govattrs= array("gouvernmentOrganizationalUnit", "houseIdentifier", "vocation",
103 "ivbbLastDeliveryCollective", "gouvernmentOrganizationalPersonLocality",
104 "gouvernmentOrganizationalUnitDescription","gouvernmentOrganizationalUnitSubjectArea",
105 "functionalTitle", "certificateSerialNumber", "publicVisible", "street", "role",
106 "postalCode");
108 var $multiple_support =TRUE;
111 /* constructor, if 'dn' is set, the node loads the given
112 'dn' from LDAP */
113 function user (&$config, $dn= NULL)
114 {
116 $this->config= $config;
117 /* Configuration is fine, allways */
118 if ($this->config->current['GOVERNMENTMODE']){
119 $this->attributes=array_merge($this->attributes,$this->govattrs);
120 }
122 $this->dn = $dn;
123 if(is_array($dn)){
124 return;
125 }
127 /* Load base attributes */
128 plugin::plugin ($config, $dn);
130 $this->orig_dn = $this->dn;
131 $this->new_dn = $this->dn;
133 $this->new_dn = $dn;
135 if ($this->config->current['GOVERNMENTMODE']){
136 /* Fix public visible attribute if unset */
137 if (!isset($this->attrs['publicVisible'])){
138 $this->publicVisible == "nein";
139 }
140 }
142 /* Load government mode attributes */
143 if ($this->config->current['GOVERNMENTMODE']){
144 /* Copy all attributs */
145 foreach ($this->govattrs as $val){
146 if (isset($this->attrs["$val"][0])){
147 $this->$val= $this->attrs["$val"][0];
148 }
149 }
150 }
152 /* Create me for new accounts */
153 if ($dn == "new"){
154 $this->is_account= TRUE;
155 }
157 /* Make hash default to md5 if not set in config */
158 if (!isset($this->config->current['HASH'])){
159 $hash= "md5";
160 } else {
161 $hash= $this->config->current['HASH'];
162 }
164 /* Load data from LDAP? */
165 if ($dn !== NULL){
167 /* Do base conversation */
168 if ($this->dn == "new"){
169 $ui= get_userinfo();
170 $this->base= dn2base($ui->dn);
171 } else {
172 $this->base= dn2base($dn);
173 }
175 /* get password storage type */
176 if (isset ($this->attrs['userPassword'][0])){
177 /* Initialize local array */
178 $matches= array();
179 if (preg_match ("/^{([^}]+)}(.+)/", $this->attrs['userPassword'][0], $matches)){
180 $this->pw_storage= strtolower($matches[1]);
181 } else {
182 if ($this->attrs['userPassword'][0] != ""){
183 $this->pw_storage= "clear";
184 } else {
185 $this->pw_storage= $hash;
186 }
187 }
188 } else {
189 /* Preset with vaule from configuration */
190 $this->pw_storage= $hash;
191 }
193 /* Load extra attributes: certificate and picture */
194 $this->load_cert();
195 $this->load_picture();
196 if ($this->userCertificate != ""){
197 $this->had_userCertificate= TRUE;
198 }
199 }
201 /* Reset password storage indicator, used by password_change_needed() */
202 if ($dn == "new"){
203 $this->last_pw_storage= "unset";
204 } else {
205 $this->last_pw_storage= $this->pw_storage;
206 }
208 /* Generate dateOfBirth entry */
209 if (isset ($this->attrs['dateOfBirth'])){
210 /* This entry is ISO 8601 conform */
211 list($year, $month, $day)= split("-", $this->attrs['dateOfBirth'][0], 3);
213 $this->dateOfBirth=array( 'mon'=> $month,"mday"=> $day,"year"=> $year);
214 $this->use_dob= "1";
215 } else {
216 $this->use_dob= "0";
217 }
219 /* Put gender attribute to upper case */
220 if (isset ($this->attrs['gender'])){
221 $this->gender= strtoupper($this->attrs['gender'][0]);
222 }
224 $this->orig_base = $this->base;
225 }
228 /* execute generates the html output for this node */
229 function execute()
230 {
231 /* Call parent execute */
232 plugin::execute();
234 if(is_array($this->dn)){
235 return("Still not supported.");
236 }
237 /* Log view */
238 if($this->is_account && !$this->view_logged){
239 $this->view_logged = TRUE;
240 new log("view","users/".get_class($this),$this->dn);
241 }
243 $smarty= get_smarty();
245 /* Fill calendar */
246 if ($this->dateOfBirth == "0"){
247 $date= getdate();
248 } else {
249 if(is_array($this->dateOfBirth)){
250 $date = $this->dateOfBirth;
252 // Trigger on dates like 1985-04-01, getdate only understands timestamps
253 } else if (!empty($this->dateOfBirth) && !is_numeric($this->dateOfBirth)){
254 $date= getdate(strtotime($this->dateOfBirth));
256 } else {
257 $date = getdate($this->dateOfBirth);
258 }
259 }
261 $days= array();
262 for($d= 1; $d<32; $d++){
263 $days[$d]= $d;
264 }
265 $years= array();
267 if(($date['year']-100)<1901){
268 $start = 1901;
269 }else{
270 $start = $date['year']-100;
271 }
273 $end = $start +100;
275 for($y= $start; $y<=$end; $y++){
276 $years[]= $y;
277 }
278 $years['-']= "- ";
279 $months= array(_("January"), _("February"), _("March"), _("April"),
280 _("May"), _("June"), _("July"), _("August"), _("September"),
281 _("October"), _("November"), _("December"), '-' => '- ');
282 $smarty->assign("day", $date["mday"]);
283 $smarty->assign("days", $days);
284 $smarty->assign("months", $months);
285 $smarty->assign("month", $date["mon"]-1);
286 $smarty->assign("years", $years);
287 $smarty->assign("year", $date["year"]);
289 /* Assign sex */
290 $sex= array(0 => " ", "F" => _("female"), "M" => _("male"));
291 $smarty->assign("gender_list", $sex);
293 $language= array_merge(array(0 => " ") ,get_languages(TRUE));
294 $smarty->assign("preferredLanguage_list", $language);
296 /* Get random number for pictures */
297 srand((double)microtime()*1000000);
298 $smarty->assign("rand", rand(0, 10000));
301 /* Do we represent a valid gosaAccount? */
302 if (!$this->is_account){
303 echo "<img alt=\"\" src=\"images/stop.png\" align=\"middle\"> <b>".
304 _("This account has no valid GOsa extensions.")."</b>";
305 return;
306 }
308 /* Base select dialog */
309 $once = true;
310 foreach($_POST as $name => $value){
311 if(preg_match("/^chooseBase/",$name) && $once){
312 $once = false;
313 $this->dialog = new baseSelectDialog($this->config,$this,$this->allowedBasesToMoveTo());
314 $this->dialog->setCurrentBase($this->base);
315 }
316 }
318 /* Dialog handling */
319 if(is_object($this->dialog)){
320 /* Must be called before save_object */
321 $this->dialog->save_object();
323 if($this->dialog->isClosed()){
324 $this->dialog = false;
325 }elseif($this->dialog->isSelected()){
327 /* check if selected base is allowed to move to / create a new object */
328 $tmp = $this->get_allowed_bases();
329 if(isset($tmp[$this->dialog->isSelected()])){
330 $this->base = $this->dialog->isSelected();
331 }
332 $this->dialog= false;
333 }else{
334 return($this->dialog->execute());
335 }
336 }
338 /* Want picture edit dialog? */
339 if($this->acl_is_writeable("userPicture")) {
340 if (isset($_POST['edit_picture'])){
341 /* Save values for later recovery, in case some presses
342 the cancel button. */
343 $this->old_jpegPhoto= $this->jpegPhoto;
344 $this->old_photoData= $this->photoData;
345 $this->picture_dialog= TRUE;
346 $this->dialog= TRUE;
347 }
348 }
350 /* Remove picture? */
351 if($this->acl_is_writeable("userPicture",(!is_object($this->parent) && !isset($_SESSION['edit']))) ){
352 if (isset($_POST['picture_remove'])){
353 $this->set_picture ();
354 $this->jpegPhoto= "*removed*";
355 $this->is_modified= TRUE;
356 return($smarty->fetch (get_template_path('generic_picture.tpl', TRUE, dirname(__FILE__))));
357 }
358 }
360 /* Save picture */
361 if (isset($_POST['picture_edit_finish'])){
363 /* Check for clean upload */
364 if ($_FILES['picture_file']['name'] != ""){
365 if (!is_uploaded_file($_FILES['picture_file']['tmp_name'])) {
366 print_red(_("The specified file has not been uploaded via HTTP POST! Aborted."));
367 }else{
368 /* Activate new picture */
369 $this->set_picture($_FILES['picture_file']['tmp_name']);
370 }
371 }
372 $this->picture_dialog= FALSE;
373 $this->dialog= FALSE;
374 $this->is_modified= TRUE;
375 }
378 /* Cancel picture */
379 if (isset($_POST['picture_edit_cancel'])){
381 /* Restore values */
382 $this->jpegPhoto= $this->old_jpegPhoto;
383 $this->photoData= $this->old_photoData;
385 /* Update picture */
386 $_SESSION['binary']= $this->photoData;
387 $_SESSION['binarytype']= "image/jpeg";
388 $this->picture_dialog= FALSE;
389 $this->dialog= FALSE;
390 }
392 /* Toggle dateOfBirth information */
393 if (isset($_POST['set_dob'])){
394 $this->use_dob= ($this->use_dob == "0")?"1":"0";
395 }
398 /* Want certificate= */
399 if ((isset($_POST['edit_cert'])) && $this->acl_is_readable("Certificate")){
401 /* Save original values for later reconstruction */
402 foreach (array("certificateSerialNumber", "userCertificate",
403 "userSMIMECertificate", "userPKCS12") as $val){
405 $oval= "old_$val";
406 $this->$oval= $this->$val;
407 }
409 $this->cert_dialog= TRUE;
410 $this->dialog= TRUE;
411 }
414 /* Cancel certificate dialog */
415 if (isset($_POST['cert_edit_cancel'])){
417 /* Restore original values in case of 'cancel' */
418 foreach (array("certificateSerialNumber", "userCertificate",
419 "userSMIMECertificate", "userPKCS12") as $val){
421 $oval= "old_$val";
422 $this->$val= $this->$oval;
423 }
424 $this->cert_dialog= FALSE;
425 $this->dialog= FALSE;
426 }
429 /* Remove certificate? */
430 if($this->acl_is_writeable("Certificate",(!is_object($this->parent) && !isset($_SESSION['edit'])))){
431 foreach (array ("userCertificate", "userSMIMECertificate", "userPKCS12") as $val){
432 if (isset($_POST["remove_$val"])){
434 /* Reset specified cert*/
435 $this->$val= "";
436 $this->is_modified= TRUE;
437 }
438 }
439 }
441 /* Upload new cert and close dialog? */
442 if($this->acl_is_writeable("Certificate",(!is_object($this->parent) && !isset($_SESSION['edit'])))){
443 if (isset($_POST['cert_edit_finish'])){
445 /* for all certificates do */
446 foreach (array ("userCertificate", "userSMIMECertificate", "userPKCS12")
447 as $val){
449 /* Check for clean upload */
450 if (array_key_exists($val."_file", $_FILES) &&
451 array_key_exists('name', $_FILES[$val."_file"]) &&
452 $_FILES[$val."_file"]['name'] != "" &&
453 is_uploaded_file($_FILES[$val."_file"]['tmp_name'])) {
454 $this->set_cert("$val", $_FILES[$val."_file"]['tmp_name']);
455 }
456 }
458 /* Save serial number */
459 if (isset($_POST["certificateSerialNumber"]) &&
460 $_POST["certificateSerialNumber"] != ""){
462 if (!is_id($_POST["certificateSerialNumber"])){
463 print_red (_("Please enter a valid serial number"));
465 foreach(array("userCertificate", "userSMIMECertificate", "userPKCS12") as $cert){
466 if ($this->$cert != ""){
467 $smarty->assign("$cert"."_state", "true");
468 } else {
469 $smarty->assign("$cert"."_state", "");
470 }
471 }
472 return ($smarty->fetch (get_template_path('generic_certs.tpl', TRUE, dirname(__FILE__))));
473 }
475 $this->certificateSerialNumber= $_POST["certificateSerialNumber"];
476 $this->is_modified= TRUE;
477 }
479 $this->cert_dialog= FALSE;
480 $this->dialog= FALSE;
481 }
482 }
483 /* Display picture dialog */
484 if ($this->picture_dialog){
485 return($smarty->fetch (get_template_path('generic_picture.tpl', TRUE, dirname(__FILE__))));
486 }
488 /* Display cert dialog */
489 if ($this->cert_dialog){
490 $smarty->assign("CertificateACL",$this->getacl("Certificate",(!is_object($this->parent) && !isset($_SESSION['edit']))));
491 $smarty->assign("Certificate_readable",$this->acl_is_readable("Certificate"));
493 foreach(array("userCertificate", "userSMIMECertificate", "userPKCS12") as $cert){
494 if ($this->$cert != ""){
495 /* import certificate */
496 $certificate = new certificate;
497 $certificate->import($this->$cert);
499 /* Read out data*/
500 $timeto = $certificate->getvalidto_date();
501 $timefrom = $certificate->getvalidfrom_date();
504 /* Additional info if start end time is '0' */
505 $add_str_info = "";
506 if($timeto == 0 && $timefrom == 0){
507 $add_str_info = "<br><i>"._("(Some types of certificates are currently not supported and may be displayed as 'invalid'.)")."</i>";
508 }
510 $str = "<table summary=\"\" border=0>
511 <tr>
512 <td style='vertical-align:top'>CN</td>
513 <td>".preg_replace("/ /", " ", $certificate->getname())."</td>
514 </tr>
515 </table><br>".
517 sprintf(_("Certificate is valid from %s to %s and is currently %s."),
518 "<b>".date('d M Y',$timefrom)."</b>",
519 "<b>".date('d M Y',$timeto)."</b>",
520 $certificate->isvalid()?"<b><font style='color:green'>"._("valid")."</font></b>":
521 "<b><font style='color:red'>"._("invalid")."</font></b>").$add_str_info;
523 $smarty->assign($cert."info",$str);
524 $smarty->assign($cert."_state","true");
525 } else {
526 $smarty->assign($cert."info", "<i>"._("No certificate installed")."</i>");
527 $smarty->assign($cert."_state","");
528 }
529 }
530 $smarty->assign("governmentmode", "false");
531 return($smarty->fetch (get_template_path('generic_certs.tpl', TRUE, dirname(__FILE__))));
532 }
534 /* Prepare password hashes */
535 if ($this->pw_storage == ""){
536 $this->pw_storage= $this->config->current['HASH'];
537 }
539 $temp= passwordMethod::get_available_methods();
540 $hashes = $temp['name'];
541 $test= new $temp[$this->pw_storage]($this->config);
542 $is_configurable= $test->is_configurable();
544 /* Load attributes and acl's */
545 $ui =get_userinfo();
546 foreach($this->attributes as $val){
547 $smarty->assign("$val", $this->$val);
548 }
550 /* Set acls */
551 $tmp = $this->plinfo();
552 foreach($tmp['plProvidedAcls'] as $val => $translation){
553 $smarty->assign("$val"."ACL", $this->getacl($val,(!is_object($this->parent) && !isset($_SESSION['edit']))));
554 }
556 $smarty->assign("pwmode", $hashes);
557 $smarty->assign("pwmode_select", $this->pw_storage);
558 $smarty->assign("pw_configurable", $is_configurable);
559 $smarty->assign("passwordStorageACL", $this->getacl("userPassword",(!is_object($this->parent) && !isset($_SESSION['edit']))));
560 $smarty->assign("base_select", $this->base);
561 $smarty->assign("CertificatesACL", $this->getacl("Certificate",(!is_object($this->parent) && !isset($_SESSION['edit']))));
562 $smarty->assign("userPictureACL", $this->getacl("userPicture",(!is_object($this->parent) && !isset($_SESSION['edit']))));
563 $smarty->assign("userPicture_is_readable", $this->acl_is_readable("userPicture",(!is_object($this->parent) && !isset($_SESSION['edit']))));
565 /* Create base acls */
566 @$smarty->assign("bases", $this->allowedBasesToMoveTo());
568 /* Save government mode attributes */
569 if (isset($this->config->current['GOVERNMENTMODE']) &&
570 preg_match('/true/i', $this->config->current['GOVERNMENTMODE'])){
571 $smarty->assign("governmentmode", "true");
572 $ivbbmodes= array("nein", "ivbv", "testa", "ivbv,testa", "internet",
573 "internet,ivbv", "internet,testa", "internet,ivbv,testa");
574 $smarty->assign("ivbbmodes", $ivbbmodes);
575 foreach ($this->govattrs as $val){
576 $smarty->assign("$val", $this->$val);
577 $smarty->assign("$val"."ACL", $this->getacl($val,(!is_object($this->parent) && !isset($_SESSION['edit']))));
578 }
579 } else {
580 $smarty->assign("governmentmode", "false");
581 }
583 /* Special mode for uid */
584 $uidACL= $this->getacl("uid",(!is_object($this->parent) && !isset($_SESSION['edit'])));
585 if (isset ($this->dn)){
586 if ($this->dn != "new"){
587 $uidACL= preg_replace("/w/","",$uidACL);
588 }
589 } else {
590 $uidACL= preg_replace("/w/","",$uidACL);
591 }
593 $smarty->assign("uidACL", $uidACL);
594 $smarty->assign("is_template", $this->is_template);
595 $smarty->assign("use_dob", $this->use_dob);
597 if (isset($this->parent)){
598 if (isset($this->parent->by_object['phoneAccount']) &&
599 $this->parent->by_object['phoneAccount']->is_account){
600 $smarty->assign("has_phoneaccount", "true");
601 } else {
602 $smarty->assign("has_phoneaccount", "false");
603 }
604 } else {
605 $smarty->assign("has_phoneaccount", "false");
606 }
607 return($smarty->fetch (get_template_path('generic.tpl', TRUE, dirname(__FILE__))));
608 }
611 /* remove object from parent */
612 function remove_from_parent()
613 {
614 $ldap= $this->config->get_ldap_link();
615 $ldap->rmdir ($this->dn);
616 show_ldap_error($ldap->get_error(), sprintf(_("Removing of user/generic account with dn '%s' failed."),$this->dn));
618 new log("remove","users/".get_class($this),$this->dn,$this->attributes,$ldap->get_error());
620 /* Delete references to groups */
621 $ldap->cd ($this->config->current['BASE']);
622 $ldap->search ("(&(objectClass=posixGroup)(memberUid=".$this->uid."))", array("uid"));
623 while ($ldap->fetch()){
624 $g= new group($this->config, $ldap->getDN());
625 $g->removeUser($this->uid);
626 $g->save ();
627 }
629 /* Delete references to object groups */
630 $ldap->cd ($this->config->current['BASE']);
631 $ldap->search ("(&(objectClass=gosaGroupOfNames)(member=".$this->dn."))", array("cn"));
632 while ($ldap->fetch()){
633 $og= new ogroup($this->config, $ldap->getDN());
634 unset($og->member[$this->dn]);
635 $og->save ();
636 }
638 /* If needed, let the password method do some cleanup */
639 $tmp = new passwordMethod($_SESSION['config']);
640 $available = $tmp->get_available_methods();
641 if (in_array_ics($this->pw_storage, $available['name'])){
642 $test= new $available[$this->pw_storage]($this->config);
643 $test->attrs= $this->attrs;
644 $test->dn= $this->dn;
645 $test->remove_from_parent();
646 }
648 /* Remove ACL dependencies too */
649 $tmp = new acl($this->config,$this->parent,$this->dn);
650 $tmp->remove_acl();
652 /* Optionally execute a command after we're done */
653 $this->handle_post_events("remove",array("uid" => $this->uid));
654 }
657 /* Save data to object */
658 function save_object()
659 {
660 if (isset($_POST['generic'])){
662 /* Make a backup of the current selected base */
663 $base_tmp = $this->base;
665 /* Parents save function */
666 plugin::save_object ();
668 /* Save government mode attributes */
669 if ($this->config->current['GOVERNMENTMODE']){
670 foreach ($this->govattrs as $val){
671 if ($this->acl_is_writeable($val,(!is_object($this->parent) && !isset($_SESSION['edit']))) && isset($_POST["$val"])){
672 $data= stripcslashes($_POST["$val"]);
673 if ($data != $this->$val){
674 $this->is_modified= TRUE;
675 }
676 $this->$val= $data;
677 }
678 }
679 }
681 /* In template mode, the uid is autogenerated... */
682 if ($this->is_template){
683 $this->uid= strtolower($this->sn);
684 $this->givenName= $this->sn;
685 }
687 /* Save base and pw_storage, since these are no LDAP attributes */
688 if (isset($_POST['base'])){
690 $tmp = $this->get_allowed_bases();
691 if(isset($tmp[$_POST['base']])){
692 $base= validate($_POST['base']);
693 if ($base != $this->base){
694 $this->is_modified= TRUE;
695 }
696 $this->base= $base;
697 }else{
698 $this->base = $base_tmp;
699 print_red(sprintf(_("You are not allowed to move this object to '%s'."),LDAP::fix($_POST['base'])));
700 $this->set_acl_base('dummy,'.$this->base);
701 }
702 }
704 /* Get pw_storage mode */
705 if (isset($_POST['pw_storage'])){
706 foreach(array("pw_storage") as $val){
707 if(isset($_POST[$val])){
708 $data= validate($_POST[$val]);
709 if ($data != $this->$val){
710 $this->is_modified= TRUE;
711 }
712 $this->$val= $data;
713 }
714 }
715 }
717 $this->set_acl_base('dummy,'.$this->base);
718 }
719 }
721 function rebind($ldap, $referral)
722 {
723 $credentials= LDAP::get_credentials($referral, $this->config->current['REFERRAL']);
724 if (ldap_bind($ldap, $credentials['ADMIN'], $credentials['PASSWORD'])) {
725 $this->error = "Success";
726 $this->hascon=true;
727 $this->reconnect= true;
728 return (0);
729 } else {
730 $this->error = "Could not bind to " . $credentials['ADMIN'];
731 return NULL;
732 }
733 }
735 /* Save data to LDAP, depending on is_account we save or delete */
736 function save()
737 {
738 /* Only force save of changes ....
739 If this attributes aren't changed, avoid saving.
740 */
741 if($this->gender=="0") $this->gender ="";
742 if($this->preferredLanguage=="0") $this->preferredLanguage ="";
745 /* First use parents methods to do some basic fillup in $this->attrs */
746 plugin::save ();
748 if ($this->use_dob == "1"){
749 /* If it is an array, the generic page has never been loaded - so there's no difference. Using an array would cause an error btw. */
750 if(!is_array($this->attrs['dateOfBirth'])) {
751 $this->attrs['dateOfBirth'] = date("Y-m-d", $this->dateOfBirth);
752 }
753 }
755 /* Remove additional objectClasses */
756 $tmp= array();
757 foreach ($this->attrs['objectClass'] as $key => $set){
758 $found= false;
759 foreach (array("ivbbentry", "gosaUserTemplate") as $val){
760 if (preg_match ("/^$set$/i", $val)){
761 $found= true;
762 break;
763 }
764 }
765 if (!$found){
766 $tmp[]= $set;
767 }
768 }
770 /* Replace the objectClass array. This is done because of the
771 separation into government and normal mode. */
772 $this->attrs['objectClass']= $tmp;
774 /* Add objectClasss for template mode? */
775 if ($this->is_template){
776 $this->attrs['objectClass'][]= "gosaUserTemplate";
777 }
779 /* Hard coded government mode? */
780 if ($this->config->current['GOVERNMENTMODE'] != 'false'){
781 $this->attrs['objectClass'][]= "ivbbentry";
783 /* Copy standard attributes */
784 foreach ($this->govattrs as $val){
785 if ($this->$val != ""){
786 $this->attrs["$val"]= $this->$val;
787 } elseif (!$this->is_new) {
788 $this->attrs["$val"]= array();
789 }
790 }
792 /* Remove attribute if set to "nein" */
793 if ($this->publicVisible == "nein"){
794 $this->attrs['publicVisible']= array();
795 if($this->is_new){
796 unset($this->attrs['publicVisible']);
797 }else{
798 $this->attrs['publicVisible']=array();
799 }
801 }
803 }
805 /* Special handling for attribute userCertificate needed */
806 if ($this->userCertificate != ""){
807 $this->attrs["userCertificate;binary"]= $this->userCertificate;
808 $remove_userCertificate= false;
809 } else {
810 $remove_userCertificate= true;
811 }
813 /* Special handling for dateOfBirth value */
814 if ($this->use_dob != "1"){
815 if ($this->is_new) {
816 unset($this->attrs["dateOfBirth"]);
817 } else {
818 $this->attrs["dateOfBirth"]= array();
819 }
820 }
821 if (!$this->gender){
822 if ($this->is_new) {
823 unset($this->attrs["gender"]);
824 } else {
825 $this->attrs["gender"]= array();
826 }
827 }
828 if (!$this->preferredLanguage){
829 if ($this->is_new) {
830 unset($this->attrs["preferredLanguage"]);
831 } else {
832 $this->attrs["preferredLanguage"]= array();
833 }
834 }
836 /* Special handling for attribute jpegPhote needed, scale image via
837 image magick to 147x200 pixels and inject resulting data. */
838 if ($this->jpegPhoto == "*removed*"){
840 /* Reset attribute to avoid writing *removed* as value */
841 $this->attrs["jpegPhoto"] = array();
843 } else {
845 /* Fallback if there's no image magick inside PHP */
846 if (!function_exists("imagick_blob2image")){
847 /* Get temporary file name for conversation */
848 $fname = tempnam ("/tmp", "GOsa");
850 /* Open file and write out photoData */
851 $fp = fopen ($fname, "w");
852 fwrite ($fp, $this->photoData);
853 fclose ($fp);
855 /* Build conversation query. Filename is generated automatically, so
856 we do not need any special security checks. Exec command and save
857 output. For PHP safe mode, you'll need a configuration which respects
858 image magick as executable... */
859 $query= "convert -size 147x200 $fname -resize 147x200 +profile \"*\" -";
860 @DEBUG (DEBUG_SHELL, __LINE__, __FUNCTION__, __FILE__,
861 $query, "Execute");
863 /* Read data written by convert */
864 $output= "";
865 $sh= popen($query, 'r');
866 while (!feof($sh)){
867 $output.= fread($sh, 4096);
868 }
869 pclose($sh);
871 unlink($fname);
873 /* Save attribute */
874 $this->attrs["jpegPhoto"] = $output;
876 } else {
878 /* Load the new uploaded Photo */
879 if(!$handle = imagick_blob2image($this->photoData)) {
880 new log("debug","users/".get_class($this),"",array(),"Could not access uploaded image");
881 }
883 /* Resizing image to 147x200 and blur */
884 if(!imagick_resize($handle,147,200,IMAGICK_FILTER_GAUSSIAN,0)){
885 new log("debug","users/".get_class($this),"",array(),"Could not resize uploaded image");
886 }
888 /* Converting image to JPEG */
889 if(!imagick_convert($handle,"JPEG")) {
890 new log("debug","users/".get_class($this),"",array(),"Could not convert uploaded image to jepg");
891 }
893 /* Creating binary Code for the Image */
894 if(!$dump = imagick_image2blob($handle)){
895 new log("debug","users/".get_class($this),"",array(),"Could not create new user image");
896 }
898 /* Sending Image */
899 $output= $dump;
901 /* Save attribute */
902 $this->attrs["jpegPhoto"] = $output;
903 }
905 }
907 /* This only gets called when user is renaming himself */
908 $ldap= $this->config->get_ldap_link();
909 if ($this->dn != $this->new_dn){
911 /* Write entry on new 'dn' */
912 $this->update_acls($this->dn,$this->new_dn);
913 $this->move($this->dn, $this->new_dn);
915 /* Happen to use the new one */
916 change_ui_dn($this->dn, $this->new_dn);
917 $this->dn= $this->new_dn;
918 }
921 /* Save data. Using 'modify' implies that the entry is already present, use 'add' for
922 new entries. So do a check first... */
923 $ldap->cat ($this->dn, array('dn'));
924 if ($ldap->fetch()){
925 $mode= "modify";
926 } else {
927 $mode= "add";
928 $ldap->cd($this->config->current['BASE']);
929 $ldap->create_missing_trees(preg_replace('/^[^,]+,/', '', $this->dn));
930 }
932 /* Set password to some junk stuff in case of templates */
933 if ($this->is_template){
934 $this->attrs['userPassword']= '{crypt}N0T$3T4N0W';
935 }
937 @DEBUG (DEBUG_LDAP, __LINE__, __FUNCTION__, __FILE__,
938 $this->attributes, "Save via $mode");
940 /* Finally write data with selected 'mode' */
941 $this->cleanup();
943 if(isset($this->attrs['preferredLanguage'])){
944 $_SESSION['ui']->language = $this->preferredLanguage;
945 $_SESSION['Last_init_lang'] = "update";
946 }
948 $ldap->cd ($this->dn);
949 $ldap->$mode ($this->attrs);
950 if (show_ldap_error($ldap->get_error(), sprintf(_("Saving of user/generic account with dn '%s' failed."),$this->dn))){
951 return (1);
952 }
955 /* Remove ACL dependencies too */
956 if($this->dn != $this->orig_dn && $this->orig_dn != "new"){
957 $tmp = new acl($this->config,$this->parent,$this->dn);
958 $tmp->update_acl_membership($this->orig_dn,$this->dn);
959 }
961 if($mode == "modify"){
962 new log("modify","users/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
963 }else{
964 new log("create","users/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
965 }
967 /* Remove cert?
968 For some reason, the 'ldap' class doesn't want to remove binary entries, so I need
969 to work around myself. */
970 if ($remove_userCertificate == true && !$this->is_new && $this->had_userCertificate){
972 /* Reset array, assemble new, this should be reworked */
973 $this->attrs= array();
974 $this->attrs['userCertificate;binary']= array();
976 /* Prepare connection */
977 if (!($ds = ldap_connect($this->config->current['SERVER']))) {
978 die ("Could not connect to LDAP server");
979 }
980 ldap_set_option($ds, LDAP_OPT_PROTOCOL_VERSION, 3);
981 if (function_exists("ldap_set_rebind_proc") && isset($this->config->current['RECURSIVE']) && $this->config->current['RECURSIVE'] == "true") {
982 ldap_set_option($this->cid, LDAP_OPT_REFERRALS, 1);
983 ldap_set_rebind_proc($ds, array(&$this, "rebind"));
984 }
985 if(isset($config->current['TLS']) && $config->current['TLS'] == "true"){
986 ldap_start_tls($ds);
987 }
988 if (!($res = @ldap_bind($ds, $this->config->current['ADMIN'],
989 $this->config->current['PASSWORD']))) {
990 die ("Could not bind to LDAP");
991 }
993 /* Modify using attrs */
994 ldap_mod_del($ds,$this->dn,$this->attrs);
995 ldap_close($ds);
996 }
998 /* If needed, let the password method do some cleanup */
999 if ($this->pw_storage != $this->last_pw_storage){
1000 $tmp = new passwordMethod($_SESSION['config']);
1001 $available = $tmp->get_available_methods();
1002 if (in_array_ics($this->pw_storage, $available['name'])){
1003 $test= new $available[$this->pw_storage]($this->config);
1004 $test->attrs= $this->attrs;
1005 $test->dn= $this->dn;
1006 $test->remove_from_parent();
1007 }
1008 }
1010 /* Optionally execute a command after we're done */
1011 if ($mode == "add"){
1012 $this->handle_post_events("add", array("uid" => $this->uid));
1013 } elseif ($this->is_modified){
1014 $this->handle_post_events("modify", array("uid" => $this->uid));
1015 }
1017 /* Fix tagging if needed */
1018 $this->handle_object_tagging();
1020 return (0);
1021 }
1024 /* Check formular input */
1025 function check()
1026 {
1027 /* Call common method to give check the hook */
1028 $message= plugin::check();
1030 $pt= "";
1031 if(isset($this->config->current['INCLUDE_PERSONAL_TITLE']) && preg_match("/true/i",$this->config->current['INCLUDE_PERSONAL_TITLE'])){
1032 if(!empty($this->personalTitle)){
1033 $pt = $this->personalTitle." ";
1034 }
1035 }
1036 $this->cn= $pt.$this->givenName." ".$this->sn;
1038 /* Permissions for that base? */
1039 if (isset($this->config->current['DNMODE']) && $this->config->current['DNMODE'] == "uid"){
1040 $this->new_dn= 'uid='.$this->uid.','.get_people_ou().$this->base;
1041 } else {
1042 /* Don't touch dn, if cn hasn't changed */
1043 if (isset($this->saved_attributes['cn']) && $this->saved_attributes['cn'] == $this->cn &&
1044 $this->orig_base == $this->base ){
1045 $this->new_dn= $this->dn;
1046 } else {
1047 $this->new_dn= $this->create_unique_dn('cn', get_people_ou().$this->base);
1048 }
1049 }
1051 /* Set the new acl base */
1052 if($this->dn == "new") {
1053 $this->set_acl_base($this->base);
1054 }
1056 /* must: sn, givenName, uid */
1057 if ($this->sn == "" && ($this->acl_is_writeable("sn",(!is_object($this->parent) && !isset($_SESSION['edit'])) || ($this->is_new)))){
1058 $message[]= _("The required field 'Name' is not set.");
1059 }
1061 /* UID already used? */
1062 $ldap= $this->config->get_ldap_link();
1063 $ldap->cd($this->config->current['BASE']);
1064 $ldap->search("(uid=$this->uid)", array("uid"));
1065 $ldap->fetch();
1066 if ($ldap->count() != 0 && $this->dn == 'new'){
1067 $message[]= _("There's already a person with this 'Login' in the database.");
1068 }
1070 /* In template mode, the uid and givenName are autogenerated... */
1071 if (!$this->is_template){
1072 if ($this->givenName == "" && $this->acl_is_writeable("givenName",(!is_object($this->parent) && !isset($_SESSION['edit'])))){
1073 $message[]= _("The required field 'Given name' is not set.");
1074 }
1075 if ($this->uid == "" && $this->acl_is_writeable("uid",(!is_object($this->parent) && !isset($_SESSION['edit'])))){
1076 $message[]= _("The required field 'Login' is not set.");
1077 }
1078 if (!(isset($this->config->current['DNMODE']) && $this->config->current['DNMODE'] == "uid")){
1079 $ldap->cat($this->new_dn);
1080 if ($ldap->count() != 0 && $this->dn != $this->new_dn && $this->dn == 'new'){
1081 $message[]= _("There's already a person with this 'Name'/'Given name' combination in the database.");
1082 }
1083 }
1084 }
1086 /* Check for valid input */
1087 if ($this->is_modified && !is_uid($this->uid)){
1088 $message[]= _("The field 'Login' contains invalid characters. Lowercase, numbers and dashes are allowed.");
1089 }
1090 if (!is_url($this->labeledURI)){
1091 $message[]= _("The field 'Homepage' contains an invalid URL definition.");
1092 }
1093 if (preg_match ("/[\\\\]/", $this->sn)){
1094 $message[]= _("The field 'Name' contains invalid characters.");
1095 }
1096 if (preg_match ("/[\\\\]/", $this->givenName)){
1097 $message[]= _("The field 'Given name' contains invalid characters.");
1098 }
1100 /* Check phone numbers */
1101 if (!is_phone_nr($this->telephoneNumber)){
1102 $message[]= _("The field 'Phone' contains an invalid phone number.");
1103 }
1104 if (!is_phone_nr($this->facsimileTelephoneNumber)){
1105 $message[]= _("The field 'Fax' contains an invalid phone number.");
1106 }
1107 if (!is_phone_nr($this->mobile)){
1108 $message[]= _("The field 'Mobile' contains an invalid phone number.");
1109 }
1110 if (!is_phone_nr($this->pager)){
1111 $message[]= _("The field 'Pager' contains an invalid phone number.");
1112 }
1114 /* Check for reserved characers */
1115 if (preg_match ('/[,+"?\'()=<>;]/', $this->givenName)){
1116 $message[]= _("The field 'Given name' contains invalid characters.");
1117 }
1118 if (preg_match ('/[,+"?\'()=<>;]/', $this->sn)){
1119 $message[]= _("The field 'Name' contains invalid characters.");
1120 }
1122 return $message;
1123 }
1126 /* Indicate whether a password change is needed or not */
1127 function password_change_needed()
1128 {
1129 return ($this->pw_storage != $this->last_pw_storage);
1130 }
1133 /* Load a jpegPhoto from LDAP, this is going to be simplified later on */
1134 function load_picture()
1135 {
1136 $ldap = $this->config->get_ldap_link();
1137 $ldap->cd ($this->dn);
1138 $data = $ldap->get_attribute($this->dn,"jpegPhoto");
1140 if((!$data) || ($data == "*removed*")){
1142 /* In case we don't get an entry, load a default picture */
1143 $this->set_picture ();//"./images/default.jpg");
1144 $this->jpegPhoto= "*removed*";
1145 }else{
1147 /* Set picture */
1148 $this->photoData= $data;
1149 $_SESSION['binary']= $this->photoData;
1150 $_SESSION['binarytype']= "image/jpeg";
1151 $this->jpegPhoto= "";
1152 }
1153 }
1156 /* Load a certificate from LDAP, this is going to be simplified later on */
1157 function load_cert()
1158 {
1159 $ds= ldap_connect($this->config->current['SERVER']);
1160 ldap_set_option($ds, LDAP_OPT_PROTOCOL_VERSION, 3);
1161 if (function_exists("ldap_set_rebind_proc") && isset($this->config->current['RECURSIVE']) && $this->config->current['RECURSIVE'] == "true") {
1162 ldap_set_option($this->cid, LDAP_OPT_REFERRALS, 1);
1163 ldap_set_rebind_proc($ds, array(&$this, "rebind"));
1164 }
1165 if(isset($this->config->current['TLS']) &&
1166 $this->config->current['TLS'] == "true"){
1168 ldap_start_tls($ds);
1169 }
1171 $r= ldap_bind($ds);
1172 $sr= @ldap_read($ds, $this->dn, "userCertificate=*", array("userCertificate"));
1174 if ($sr) {
1175 $ei= @ldap_first_entry($ds, $sr);
1177 if ($ei) {
1178 if (!$info = @ldap_get_values_len($ds, $ei, "userCertificate;binary")){
1179 $this->userCertificate= "";
1180 } else {
1181 $this->userCertificate= $info[0];
1182 }
1183 }
1184 } else {
1185 $this->userCertificate= "";
1186 }
1188 ldap_unbind($ds);
1189 }
1192 /* Load picture from file to object */
1193 function set_picture($filename ="")
1194 {
1195 if (!is_file($filename) || $filename =="" ){
1196 $filename= "./images/default.jpg";
1197 $this->jpegPhoto= "*removed*";
1198 }
1200 $fd = fopen ($filename, "rb");
1201 $this->photoData= fread ($fd, filesize ($filename));
1202 $_SESSION['binary']= $this->photoData;
1203 $_SESSION['binarytype']= "image/jpeg";
1204 $this->jpegPhoto= "";
1206 fclose ($fd);
1207 }
1210 /* Load certificate from file to object */
1211 function set_cert($cert, $filename)
1212 {
1213 if(!$thsi->acl_is_writeable("Certificate",(!is_object($this->parent) && !isset($_SESSION['edit'])))) return;
1214 $fd = fopen ($filename, "rb");
1215 if (filesize($filename)>0) {
1216 $this->$cert= fread ($fd, filesize ($filename));
1217 fclose ($fd);
1218 $this->is_modified= TRUE;
1219 } else {
1220 print_red(_("Could not open specified certificate!"));
1221 }
1222 }
1224 /* Adapt from given 'dn' */
1225 function adapt_from_template($dn)
1226 {
1227 plugin::adapt_from_template($dn);
1229 /* Get base */
1230 $this->base= preg_replace('/^[^,]+,'.get_people_ou().'/i', '', $dn);
1232 if ($this->config->current['GOVERNMENTMODE']){
1234 /* Walk through govattrs */
1235 foreach ($this->govattrs as $val){
1237 if (isset($this->attrs["$val"][0])){
1239 /* If attribute is set, replace dynamic parts:
1240 %sn, %givenName and %uid. Fill these in our local variables. */
1241 $value= $this->attrs["$val"][0];
1243 foreach (array("sn", "givenName", "uid") as $repl){
1244 if (preg_match("/%$repl/i", $value)){
1245 $value= preg_replace ("/%$repl/i",
1246 $this->parent->$repl, $value);
1247 }
1248 }
1249 $this->$val= $value;
1250 }
1251 }
1252 }
1254 /* Get back uid/sn/givenName */
1255 if ($this->parent !== NULL){
1256 $this->uid= $this->parent->uid;
1257 $this->sn= $this->parent->sn;
1258 $this->givenName= $this->parent->givenName;
1259 }
1260 }
1263 /* This avoids that users move themselves out of their rights.
1264 */
1265 function allowedBasesToMoveTo()
1266 {
1267 /* Get bases */
1268 $bases = $this->get_allowed_bases();
1269 return($bases);
1270 }
1273 function getCopyDialog()
1274 {
1275 $str = "";
1277 $_SESSION['binary'] = $this->photoData;
1278 $_SESSION['binarytype']= "image/jpeg";
1280 /* Get random number for pictures */
1281 srand((double)microtime()*1000000);
1282 $rand = rand(0, 10000);
1284 $smarty = get_smarty();
1286 $smarty->assign("passwordTodo","clear");
1288 if(isset($_POST['passwordTodo'])){
1289 $smarty->assign("passwordTodo",$_POST['passwordTodo']);
1290 }
1292 $smarty->assign("sn", $this->sn);
1293 $smarty->assign("givenName",$this->givenName);
1294 $smarty->assign("uid", $this->uid);
1295 $smarty->assign("rand", $rand);
1296 $str = $smarty->fetch(get_template_path("paste_generic.tpl",TRUE,dirname(__FILE__)));
1299 $ret = array();
1300 $ret['string'] = $str;
1301 $ret['status'] = "";
1302 return($ret);
1303 }
1305 function saveCopyDialog()
1306 {
1307 /* Set_acl_base */
1308 $this->set_acl_base("cn=dummy,".get_people_ou().$this->base);
1310 if((isset($_FILES['picture_file']['tmp_name'])) && ($_FILES['picture_file']['size'] > 0)){
1311 $this->set_picture($_FILES['picture_file']['tmp_name']);
1312 }
1314 /* Remove picture? */
1315 if (isset($_POST['picture_remove'])){
1316 $this->jpegPhoto= "*removed*";
1317 $this->set_picture ("./images/default.jpg");
1318 $this->is_modified= TRUE;
1319 }
1321 $attrs = array("uid","givenName","sn");
1322 foreach($attrs as $attr){
1323 if(isset($_POST[$attr])){
1324 $this->$attr = $_POST[$attr];
1325 }
1326 }
1327 }
1330 function PrepareForCopyPaste($source)
1331 {
1332 plugin::PrepareForCopyPaste($source);
1334 /* Reset certificate information addepted from source user
1335 to avoid setting the same user certificate for the destination user. */
1336 $this->userPKCS12= "";
1337 $this->userSMIMECertificate= "";
1338 $this->userCertificate= "";
1339 $this->certificateSerialNumber= "";
1340 $this->old_certificateSerialNumber= "";
1341 $this->old_userPKCS12= "";
1342 $this->old_userSMIMECertificate= "";
1343 $this->old_userCertificate= "";
1344 }
1347 function plInfo()
1348 {
1350 $govattrs= array(
1351 "gouvernmentOrganizationalUnit" => _("Unit"),
1352 "houseIdentifier" => _("House identifier"),
1353 "vocation" => _("Vocation"),
1354 "ivbbLastDeliveryCollective" => _("Last delivery"),
1355 "gouvernmentOrganizationalPersonLocality" => _("Person locality"),
1356 "gouvernmentOrganizationalUnitDescription" => _("Unit description"),
1357 "gouvernmentOrganizationalUnitSubjectArea" => _("Subject area"),
1358 "functionalTitle" => _("Functional title"),
1359 "certificateSerialNumber" => _("Certificate serial number"),
1360 "publicVisible" => _("Public visible"),
1361 "street" => _("Street"),
1362 "role" => _("Role"),
1363 "postalCode" => _("Postal code"));
1365 $ret = array(
1366 "plShortName" => _("Generic"),
1367 "plDescription" => _("Generic user settings"),
1368 "plSelfModify" => TRUE,
1369 "plDepends" => array(),
1370 "plPriority" => 1,
1371 "plSection" => array("personal" => _("My account")),
1372 "plCategory" => array("users" => array("description" => _("Users"),
1373 "objectClass" => "gosaAccount")),
1375 "plProvidedAcls" => array(
1376 "base" => _("Base"),
1377 "userPassword" => _("User password"),
1378 "sn" => _("Surename"),
1379 "givenName" => _("Given name"),
1380 "uid" => _("User identification"),
1381 "personalTitle" => _("Personal title"),
1382 "academicTitle" => _("Academic title"),
1383 "homePostalAddress" => _("Home postal address"),
1384 "homePhone" => _("Home phone number"),
1385 "labeledURI" => _("Homepage"),
1386 "o" => _("Organization"),
1387 "ou" => _("Department"),
1388 "dateOfBirth" => _("Date of birth"),
1389 "gender" => _("Gender"),
1390 "preferredLanguage" => _("Preferred language"),
1391 "departmentNumber" => _("Department number"),
1392 "employeeNumber" => _("Employee number"),
1393 "employeeType" => _("Employee type"),
1394 "l" => _("Location"),
1395 "st" => _("State"),
1396 "userPicture" => _("User picture"),
1397 "roomNumber" => _("Room number"),
1398 "telephoneNumber" => _("Telefon number"),
1399 "mobile" => _("Mobile number"),
1400 "pager" => _("Pager number"),
1401 "Certificate" => _("User certificates"),
1403 "postalAddress" => _("Postal address"),
1404 "facsimileTelephoneNumber" => _("Fax number"))
1405 );
1407 /* Append government attributes if required */
1408 global $config;
1409 if (isset($config->current['GOVERNMENTMODE']) && preg_match('/true/i', $config->current['GOVERNMENTMODE'])){
1410 foreach($govattrs as $attr => $desc){
1411 $ret["plProvidedAcls"][$attr] = $desc;
1412 }
1413 }
1415 return($ret);
1416 }
1417 }
1419 // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
1420 ?>