Code

Added additional cmd checks
[gosa.git] / gosa-core / plugins / admin / departments / class_departmentGeneric.inc
1 <?php
2 /*
3  * This code is part of GOsa (http://www.gosa-project.org)
4  * Copyright (C) 2003-2008 GONICUS GmbH
5  *
6  * ID: $$Id$$
7  *
8  * This program is free software; you can redistribute it and/or modify
9  * it under the terms of the GNU General Public License as published by
10  * the Free Software Foundation; either version 2 of the License, or
11  * (at your option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License
19  * along with this program; if not, write to the Free Software
20  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
21  */
23 class department extends plugin
24 {
25         /* department attributes */
26         var $ou= "";
27         var $description= "";
28         var $base= "";
29         var $st= "";
30         var $l= "";
31         var $postalAddress= "";
32         var $businessCategory= "";
33         var $telephoneNumber= "";
34         var $facsimileTelephoneNumber= "";
35         var $is_administrational_unit= false;
36         var $gosaUnitTag= "";
37   var $view_logged = FALSE;
39         /* Headpage attributes */
40         var $last_dep_sorting= "invalid";
41         var $departments= array();
42   var $must_be_tagged = false;
44         /* attribute list for save action */
45         var $attributes= array("ou", "description", "businessCategory", "st", "l", "postalAddress",
46                         "telephoneNumber", "facsimileTelephoneNumber", "gosaUnitTag");
47         var $objectclasses= array("top", "gosaDepartment", "organizationalUnit");
48   var $initially_was_tagged = false;
50   var $orig_base = "";
51   var $orig_ou = "";
53         function department (&$config, $dn)
54         {
56                 plugin::plugin($config, $dn);
57                 $this->is_account= TRUE;
58                 $this->ui= get_userinfo();
59                 $this->dn= $dn;
60                 $this->orig_dn= $dn;
61                 $this->orig_ou= $this->ou;
62                 $this->config= $config;
64                 /* Set base */
65                 if ($this->dn == "new"){
66                         $ui= get_userinfo();
67                         if(session::is_set('CurrentMainBase')){
68                                 $this->base = session::get('CurrentMainBase');
69                         }else{
70                                 $this->base= dn2base($ui->dn);
71                         }
72                 } else {
73                         $this->base= preg_replace ("/^[^,]+,/", "", $this->dn);
74                 }
76     $this->orig_base = $this->base;
78                 /* Is administrational Unit? */
79                 if ($dn != "new" && in_array_ics('gosaAdministrativeUnit', $this->attrs['objectClass'])){
80                         $this->is_administrational_unit= true;
81       $this->initially_was_tagged = true;
82                 }
83         }
85         function execute()
86         {
87                 /* Call parent execute */
88                 plugin::execute();
90     /* Log view */
91     if($this->is_account && !$this->view_logged){
92       $this->view_logged = TRUE;
93       new log("view","department/".get_class($this),$this->dn);
94     }
96                 /* Reload departments */
97                 $this->config->get_departments($this->dn);
98                 $this->config->make_idepartments();
99                 $smarty= get_smarty();
101     $tmp = $this->plInfo();
102     foreach($tmp['plProvidedAcls'] as $name => $translation){
103       $smarty->assign($name."ACL",$this->getacl($name));
104     }
106                 /* Base select dialog */
107                 $once = true;
108                 foreach($_POST as $name => $value){
109                         if((preg_match("/^chooseBase/",$name) && $once) && ($this->acl_is_moveable())){
110                                 $once = false;
111                                 $this->dialog = new baseSelectDialog($this->config,$this,$this->get_allowed_bases());
112                                 $this->dialog->setCurrentBase($this->base);
113                         }
114                 }
116                 /* Dialog handling */
117                 if(is_object($this->dialog)){
118                         /* Must be called before save_object */
119                         $this->dialog->save_object();
121                         if($this->dialog->isClosed()){
122                                 $this->dialog = false;
123                         }elseif($this->dialog->isSelected()){
125         /* A new base was selected, check if it is a valid one */
126         $tmp = $this->get_allowed_bases();
127         if(isset($tmp[$this->dialog->isSelected()])){
128           $this->base = $this->dialog->isSelected();
129         }
130   
131                                 $this->dialog= false;
132                         }else{
133                                 return($this->dialog->execute());
134                         }
135                 }
137                 /* Hide all departments, that are subtrees of this department */
138     $bases = $this->get_allowed_bases();
139                 if(($this->dn == "new")||($this->dn == "")){
140                         $tmp = $bases;
141                 }else{
142                         $tmp    = array();      
143                         foreach($bases as $dn=>$base){
144                                 $fixed = str_replace("/","\\",$this->dn);
145                                 /* Only attach departments which are not a subtree of this one */
146                                 if(!preg_match("/".$fixed."/",$dn)){
147                                         $tmp[$dn]=$base;
148                                 }
149                         }
150                 }
151                 $smarty->assign("bases", $tmp);
153                 foreach ($this->attributes as $val){
154                         $smarty->assign("$val", $this->$val);
155                 }
156                 $smarty->assign("base_select", $this->base);
158     /* Set admin unit flag */
159     if ($this->is_administrational_unit) {
160       $smarty->assign("unitTag", "checked");
161     } else {
162       $smarty->assign("unitTag", "");
163     }
165                 return($smarty->fetch (get_template_path('generic.tpl', TRUE)));
166         }
168         function clear_fields()
169         {
170                 $this->dn   = "";
171                 $this->base = "";
173                 foreach ($this->attributes as $val){
174                         $this->$val= "";
175                 }
176         }
178         function remove_from_parent()
179         {
180                 $ldap= $this->config->get_ldap_link();
181                 $ldap->cd ($this->dn);
182                 $ldap->recursive_remove();
183     new log("remove","department/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
184     if (!$ldap->success()){
185       msg_dialog::display(_("LDAP error"), msgPool::ldaperror($ldap->get_error(), $this->dn, LDAP_DEL, get_class()));
186     }
188                 /* Optionally execute a command after we're done */
189                 $this->handle_post_events('remove');
190         }
192         function must_be_tagged()
193         {
194                 return $this->must_be_tagged;
195         }
197         /* Save data to object */
198         function save_object()
199         {
200                 if (isset($_POST['dep_generic_posted'])){
202       /* Create a base backup and reset the
203          base directly after calling plugin::save_object();
204          Base will be set seperatly a few lines below */
205       $base_tmp = $this->base;
206       plugin::save_object();
207       $this->base = $base_tmp;
209       /* Set new base if allowed */
210       $tmp = $this->get_allowed_bases();
211       if(isset($_POST['base'])){
212         if(isset($tmp[$_POST['base']])){
213           $this->base= $_POST['base'];
214         }
215       }
217       /* Save tagging flag */
218       if ($this->acl_is_writeable("unitTag")){
219         if (isset($_POST['unitTag'])){
220           $this->is_administrational_unit= true;
221         } else {
222           $this->is_administrational_unit= false;
223         }
224       }
225     }
226         }
229         /* Check values */
230         function check()
231         {
232                 /* Call common method to give check the hook */
233                 $message= plugin::check();
235                 /* Check for presence of this department */
236                 $ldap= $this->config->get_ldap_link();
237     $ldap->ls ("(&(ou=".$this->ou.")(objectClass=organizationalUnit))", $this->base, array('dn'));
238     if ($this->orig_dn == "new" && $ldap->count()){
239                         $message[]= msgPool::duplicated(_("Name"));
240                 } elseif ($this->orig_dn != $this->dn && $ldap->count()){
241                         $message[]= msgPool::duplicated(_("Name"));
242                 }
244                 /* All required fields are set? */
245                 if ($this->ou == ""){
246                         $message[]= msgPool::required(_("Name"));
247                 }
248                 if ($this->description == ""){
249                         $message[]= msgPool::required(_("Description"));
250                 }
252     if(tests::is_department_name_reserved($this->ou,$this->base)){
253       $message[]= msgPool::reserved(_("Name"));
254     }
256                 if (preg_match ('/[#+:=>\\\\\/]/', $this->ou)){
257                         $message[]= msgPool::invalid(_("Name"), $this->ou, "/[^#+:=>\\\\\/]/");
258                 }
259                 if (!tests::is_phone_nr($this->telephoneNumber)){
260                         $message[]= msgPool::invalid(_("Phone"), $this->telephoneNumber, "/[\/0-9 ()+*-]/");
261                 }
262                 if (!tests::is_phone_nr($this->facsimileTelephoneNumber)){
263                         $message[]= msgPool::invalid(_("Fax"), $this->facsimileTelephoneNumber, "/[\/0-9 ()+*-]/");
264                 }
266     /* Check if we are allowed to create or move this object
267      */
268     if($this->orig_dn == "new" && !$this->acl_is_createable($this->base)){
269       $message[] = msgPool::permCreate();
270     }elseif($this->orig_dn != "new" && $this->base != $this->orig_base && !$this->acl_is_moveable($this->base)){
271       $message[] = msgPool::permMove();
272     }
274     return $message;
275         }
278         /* Save to LDAP */
279         function save()
280         {
281                 $ldap= $this->config->get_ldap_link();
283     /* Add tag objects if needed */
284     if ($this->is_administrational_unit){
286       /* If this wasn't tagged before add oc an reset unit tag */
287       if(!$this->initially_was_tagged){
288         $this->objectclasses[]= "gosaAdministrativeUnit";
289         $this->gosaUnitTag= "";
291         /* It seams that this method is called twice, 
292            set this to true. to avoid adding this oc twice */
293         $this->initially_was_tagged = true;
294       }
296       if ($this->gosaUnitTag == ""){
298         /* It's unlikely, but check if already used... */
299         $try= 5;
300         $ldap->cd($this->config->current['BASE']);
301         while ($try--){
303           /* Generate microtime stamp as tag */
304           list($usec, $sec)= explode(" ", microtime());
305           $time_stamp= preg_replace("/\./", "", $sec.$usec);
307           $ldap->search("(&(objectClass=gosaAdministrativeUnit)(gosaUnitTag=$time_stamp))",array("gosaUnitTag"));
308           if ($ldap->count() == 0){
309             break;
310           }
311         }
312         if($try == 0) {
313           msg_dialog::display(_("Fatal error"), _("Cannot find an unused tag for this administrative unit!"), WARNING_DIALOG);
314           return;
315         }
316         $this->gosaUnitTag= preg_replace("/\./", "", $sec.$usec);
317       }
318     }
319     $this->skipTagging = TRUE;
320     plugin::save();
323     /* Remove tag information if needed */
324     if (!$this->is_administrational_unit && $this->initially_was_tagged){
325       $tmp= array();
327       /* Remove gosaAdministrativeUnit from this plugin */
328       $has_unit_tag= false;
329       foreach($this->attrs['objectClass'] as $oc){
330         if (!preg_match("/^gosaAdministrativeUnit$/i", $oc)){
331           $tmp[]= $oc;
332         }
333         if (preg_match("/^gosaAdministrativeUnitTag$/i", $oc)){
334           $has_unit_tag= true;
335         }
336       }
337       $this->attrs['objectClass']= $tmp;
338       $this->attrs['gosaUnitTag']= array();
339       $this->gosaUnitTag = "";
340     }
343                 /* Write back to ldap */
344                 $ldap->cat($this->dn, array('dn'));
345                 $ldap->cd($this->dn);
347                 if ($ldap->count()){
348                         $this->cleanup();
349                         $ldap->modify ($this->attrs); 
350       new log("modify","department/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
351                         $this->handle_post_events('modify');
352                 } else {
353                         $ldap->add($this->attrs);
354                         $this->handle_post_events('add');
355       new log("create","department/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
356                 }
357     if (!$ldap->success()){
358       msg_dialog::display(_("LDAP error"), msgPool::ldaperror($ldap->get_error(), $this->dn, 0, get_class()));
359     }
361     /* The parameter forces only to set must_be_tagged, and don't touch any objects 
362        This will be done later */
363     $this->tag_objects(true);
364     
365     /* Optionally execute a command after we're done */
366                 $this->postcreate();
367     return(false);
368         }
371         /* Tag objects to have the gosaAdministrativeUnitTag */
372         function tag_objects($OnlySetTagFlag = false)
373         {
374     if(!$OnlySetTagFlag){
375       $smarty= get_smarty();
376       /* Print out html introduction */
377       echo '  <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
378         <html>
379         <head>
380         <title></title>
381         <style type="text/css">@import url("themes/default/style.css");</style>
382         <script language="javascript" src="include/focus.js" type="text/javascript"></script>
383         </head>
384         <body style="background: none; margin:4px;" id="body" >
385         ';
386       echo "<h3>".sprintf(_("Tagging '%s'."),"<i>".@LDAP::fix($this->dn)."</i>")."</h3>";
387     }
389     $add= $this->is_administrational_unit;
390     $len= strlen($this->dn);
391     $ldap= $this->config->get_ldap_link();
392     $ldap->cd($this->dn);
393     if ($add){
394             $ldap->search('(!(&(objectClass=gosaAdministrativeUnitTag)(gosaUnitTag='.
395                                                     $this->gosaUnitTag.')))', array('dn'));
396     } else {
397             $ldap->search('objectClass=gosaAdministrativeUnitTag', array('dn'));
398     }
400     $objects = array();
401     while ($attrs= $ldap->fetch()){
402       $objects[] = $attrs;
403     }
404     foreach($objects as $attrs){
406             /* Skip self */
407             if ($attrs['dn'] == $this->dn){
408                     continue;
409             }
411             /* Check for confilicting administrative units */
412             $fix= true;
413             foreach ($this->config->adepartments as $key => $tag){
414                     /* This one is shorter than our dn, its not relevant... */
415                     if ($len >= strlen($key)){
416                             continue;
417                     }
419                     /* This one matches with the latter part. Break and don't fix this entry */
420                     if (preg_match('/(^|,)'.normalizePreg($key).'$/', $attrs['dn'])){
421                             $fix= false;
422                             break;
423                     }
424             }
426             /* Fix entry if needed */
427             if ($fix){
428                     if($OnlySetTagFlag){
429                             $this->must_be_tagged =true;
430                             return;
431                     }
432                     $this->handle_object_tagging($attrs['dn'], $this->gosaUnitTag, TRUE );
433         echo "<script language=\"javascript\" type=\"text/javascript\">scrollDown2();</script>" ;
434             }
435     }
436     
437     if(!$OnlySetTagFlag){
438       $this->must_be_tagged = FALSE;
439             echo '<p class="seperator">&nbsp;</p>';
440       echo "<div style='width:100%;text-align:right;'><form name='form' method='post' action='?plug=".$_GET['plug']."' target='_parent'>
441         <br><input type='submit' name='back' value='"._("Continue")."'>
442         </form></div>";
443       echo "<script language=\"javascript\" type=\"text/javascript\">scrollDown2();</script>" ;
444     }
445         }
448         /* Move/Rename complete trees */
449         function recursive_move($src_dn, $dst_dn,$force = false)
450         {
451     /* Print header to have styles included */
452     $smarty= get_smarty();
454     echo '  <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
455       <html>
456       <head>
457       <title></title>
458       <style type="text/css">@import url("themes/default/style.css");</style>
459       <script language="javascript" src="include/focus.js" type="text/javascript"></script>
460       </head>
461       <body style="background: none; margin:4px;" id="body" >
462       ';
463     echo "<h3>".sprintf(_("Moving '%s' to '%s'"),"<i>".@LDAP::fix($src_dn)."</i>","<i>".@LDAP::fix($dst_dn)."</i>")."</h3>";
466     /* Check if the destination entry exists */
467     $ldap= $this->config->get_ldap_link();
469     /* Check if destination exists - abort */
470     $ldap->cat($dst_dn, array('dn'));
471     if ($ldap->fetch()){
472       trigger_error("Recursive_move ".@LDAP::fix($dst_dn)." already exists.",
473           E_USER_WARNING);
474       echo sprintf("Recursive_move: '%s' already exists", @LDAP::fix($dst_dn))."<br>"; 
475       return (FALSE);
476     }
478     /* Perform a search for all objects to be moved */
479     $objects= array();
480     $ldap->cd($src_dn);
481     $ldap->search("(objectClass=*)", array("dn"));
482     while($attrs= $ldap->fetch()){
483       $dn= $attrs['dn'];
484       $objects[$dn]= strlen($dn);
485     }
487     /* Sort objects by indent level */
488     asort($objects);
489     reset($objects);
491     /* Copy objects from small to big indent levels by replacing src_dn by dst_dn */
492     foreach ($objects as $object => $len){
495       $src= str_replace("\\","\\\\",$object);
496       $dst= preg_replace("/".str_replace("\\","\\\\",$src_dn)."$/", "$dst_dn", $object);
497       $dst= str_replace($src_dn,$dst_dn,$object);
499       echo "<b>"._("Object").":</b> ".@LDAP::fix($src)."<br>";
501       $this->update_acls($object, $dst,TRUE);
503       if (!$this->copy($src, $dst)){
504         echo "<font color='#FF0000'><br>".sprintf(_("FAILED to copy %s, aborting operation"),@LDAP::fix($src))."</font>";
505         return (FALSE);
506       }
507       echo "<script language=\"javascript\" type=\"text/javascript\">scrollDown2();</script>" ;
508       flush();
509     }
511     /* Remove src_dn */
512     $ldap->cd($src_dn);
513     $ldap->recursive_remove();
514     $this->orig_dn  = $this->dn = $dst_dn;
515     $this->orig_base= $this->base;     
516     $this->entryCSN = getEntryCSN($this->dn);
518     echo '<p class="seperator">&nbsp;</p>';
520     echo "<div style='width:100%;text-align:right;'><form name='form' method='post' action='?plug=".$_GET['plug']."' target='_parent'>
521       <br><input type='submit' name='back' value='"._("Continue")."'>
522       </form></div>";
524     echo "<script language=\"javascript\" type=\"text/javascript\">scrollDown2();</script>" ;
525     echo "</body></html>";
527     return (TRUE);
528   }
531   /* Return plugin informations for acl handling */ 
532   static function plInfo()
533   {
534     return (array("plShortName"   => _("Generic"),
535                   "plDescription" => _("Departments"),
536                   "plSelfModify"  => FALSE,
537                   "plPriority"    => 0,
538                   "plDepends"     => array(),
539                   "plSection"     => array("admin"),
540                   "plCategory"    => array("department" => array("objectClass" => "gosaDepartment", "description" => _("Departments"))),
541             
542                   "plProvidedAcls" => array(
543                     "description"       => _("Description"),
544                     "c"                 => _("Country"),
545                     "base"              => _("Base"),
546                     "l"                 => _("Location"),
547                     "telephoneNumber"   => _("Telephone"),
548                     "ou"                => _("Department name"),
549                     "businessCategory"  => _("Category"),
550                     "st"                => _("State"),
551                     "postalAddress"     => _("Address"),
552                     "gosaUnitTag"       => _("Administrative settings"),
553                     "facsimileTelephoneNumber" => _("Fax"))
554                   ));
555   }
557   function handle_object_tagging($dn= "", $tag= "", $show= false)
558   {
559     /* No dn? Self-operation... */
560     if ($dn == ""){
561       $dn= $this->dn;
563       /* No tag? Find it yourself... */
564       if ($tag == ""){
565         $len= strlen($dn);
567         @DEBUG (DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__, "No tag for $dn - looking for one...", "Tagging");
568         $relevant= array();
569         foreach ($this->config->adepartments as $key => $ntag){
571           /* This one is bigger than our dn, its not relevant... */
572           if ($len <= strlen($key)){
573             continue;
574           }
576           /* This one matches with the latter part. Break and don't fix this entry */
577           if (preg_match('/(^|,)'.normalizePreg($key).'$/', $dn)){
578             @DEBUG (DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__, "DEBUG: Possibly relevant: $key", "Tagging");
579             $relevant[strlen($key)]= $ntag;
580             continue;
581           }
583         }
585         /* If we've some relevant tags to set, just get the longest one */
586         if (count($relevant)){
587           ksort($relevant);
588           $tmp= array_keys($relevant);
589           $idx= end($tmp);
590           $tag= $relevant[$idx];
591           $this->gosaUnitTag= $tag;
592         }
593       }
594     }
596     /* Set tag? */
597     if ($tag != ""){
598       /* Set objectclass and attribute */
599       $ldap= $this->config->get_ldap_link();
600       $ldap->cat($dn, array('gosaUnitTag', 'objectClass'));
601       $attrs= $ldap->fetch();
602       if(isset($attrs['gosaUnitTag'][0]) && $attrs['gosaUnitTag'][0] == $tag){
603         if ($show) {
604           echo sprintf(_("Object '%s' is already tagged"), @LDAP::fix($dn))."<br>";
605           flush();
606         }
607         return;
608       }
609       if (count($attrs)){
610         if ($show){
611           echo sprintf(_("Adding tag (%s) to object '%s'"), $tag, @LDAP::fix($dn))."<br>";
612           flush();
613         }
614         $nattrs= array("gosaUnitTag" => $tag);
615         $nattrs['objectClass']= array();
616         for ($i= 0; $i<$attrs['objectClass']['count']; $i++){
617           $oc= $attrs['objectClass'][$i];
618           if ($oc != "gosaAdministrativeUnitTag"){
619             $nattrs['objectClass'][]= $oc;
620           }
621         }
622         $nattrs['objectClass'][]= "gosaAdministrativeUnitTag";
623         $ldap->cd($dn);
624         $ldap->modify($nattrs);
625         if (!$ldap->success()){
626           msg_dialog::display(_("LDAP error"), msgPool::ldaperror($ldap->get_error(), $dn, LDAP_MOD, get_class()));
627         }
628       } else {
629         @DEBUG (DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__, "Not tagging ($tag) $dn - seems to have moved away", "Tagging");
630       }
632     } else {
633       /* Remove objectclass and attribute */
634       $ldap= $this->config->get_ldap_link();
635       $ldap->cat($dn, array('gosaUnitTag', 'objectClass'));
636       $attrs= $ldap->fetch();
637       if (isset($attrs['objectClass']) && !in_array_ics("gosaAdministrativeUnitTag", $attrs['objectClass'])){
638         @DEBUG (DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__, "$dn is not tagged", "Tagging");
639         return;
640       }
641       if (count($attrs)){
642         if ($show){
643           echo sprintf(_("Removing tag from object '%s'"), @LDAP::fix($dn))."<br>";
644           flush();
645         }
646         $nattrs= array("gosaUnitTag" => array());
647         $nattrs['objectClass']= array();
648         for ($i= 0; $i<$attrs['objectClass']['count']; $i++){
649           $oc= $attrs['objectClass'][$i];
650           if ($oc != "gosaAdministrativeUnitTag"){
651             $nattrs['objectClass'][]= $oc;
652           }
653         }
654         $ldap->cd($dn);
655         $ldap->modify($nattrs);
656         if (!$ldap->success()){
657           msg_dialog::display(_("LDAP error"), msgPool::ldaperror($ldap->get_error(), $dn, LDAP_MOD, get_class()));
658         }
659       } else {
660         @DEBUG (DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__, "Not removing tag ($tag) $dn - seems to have moved away", "Tagging");
661       }
662     }
663   }
666   
667   /*! \brief    Returns a list of all available departments for this object.
668                 If this object is new, all departments we are allowed to create a new user in are returned.
669                 If this is an existing object, return all deps. we are allowed to move tis object too.
671       @return   Array [dn] => "..name"  // All deps. we are allowed to act on.
672   */
673   function get_allowed_bases()
674   {
675     $ui = get_userinfo();
676     $deps = array();
678     /* Is this a new object ? Or just an edited existing object */
679     if(!$this->initially_was_account && $this->is_account){
680       $new = true;
681     }else{
682       $new = false;
683     }
685     $ideps = $this->config->idepartments;
686     if(!isset($ideps[$this->base])){
687       $ideps[$this->base] = ".";
688     }
689     foreach($deps as $dn => $name){
690       if($new && $this->acl_is_createable($dn)){
691         $deps[$dn] = $name;
692       }elseif(!$new && $this->acl_is_moveable($dn)){
693         $deps[$dn] = $name;
694       }
695     }
697     /* Add current base */
698     if(isset($this->base) && isset($ideps[$this->base])){
699       $deps[$this->base] = $ideps[$this->base];
700     }else{
701       trigger_error("Cannot return list of departments, no default base found in class ".get_class($this).". ".$this->base);
702     }
703     return($deps);
704   }
708 // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
709 ?>