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 var $type ="ou";
40 var $namingAttr = "ou";
42 /* Headpage attributes */
43 var $last_dep_sorting= "invalid";
44 var $departments= array();
45 var $must_be_tagged = false;
47 /* attribute list for save action */
48 var $attributes= array("ou", "description", "businessCategory", "st", "l", "postalAddress",
49 "telephoneNumber", "facsimileTelephoneNumber", "gosaUnitTag");
50 var $objectclasses= array("top", "gosaDepartment", "organizationalUnit");
51 var $initially_was_tagged = false;
53 var $orig_base = "";
54 var $orig_ou = "";
56 function department (&$config, $dn)
57 {
59 plugin::plugin($config, $dn);
60 $this->is_account= TRUE;
61 $this->ui= get_userinfo();
62 $this->dn= $dn;
63 $this->orig_dn= $dn;
65 /* Save current naming attribuet
66 */
67 $nA = $this->namingAttr;
68 $orig_nA = "orig_".$nA;
69 $this->$orig_nA = $this->$nA;
71 $this->config= $config;
73 /* Set base */
74 if ($this->dn == "new"){
75 $ui= get_userinfo();
76 if(session::is_set('CurrentMainBase')){
77 $this->base = session::get('CurrentMainBase');
78 }else{
79 $this->base= dn2base($ui->dn);
80 }
81 } else {
82 $this->base= preg_replace ("/^[^,]+,/", "", $this->dn);
83 }
85 $this->orig_base = $this->base;
87 /* Is administrational Unit? */
88 if ($dn != "new" && in_array_ics('gosaAdministrativeUnit', $this->attrs['objectClass'])){
89 $this->is_administrational_unit= true;
90 $this->initially_was_tagged = true;
91 }
92 }
94 function execute()
95 {
96 /* Call parent execute */
97 plugin::execute();
99 /* Log view */
100 if($this->is_account && !$this->view_logged){
101 $this->view_logged = TRUE;
102 new log("view","department/".get_class($this),$this->dn);
103 }
105 /* Reload departments */
106 $this->config->get_departments($this->dn);
107 $this->config->make_idepartments();
108 $smarty= get_smarty();
110 $tmp = $this->plInfo();
111 foreach($tmp['plProvidedAcls'] as $name => $translation){
112 $smarty->assign($name."ACL",$this->getacl($name));
113 }
115 /* Base select dialog */
116 $once = true;
117 foreach($_POST as $name => $value){
118 if((preg_match("/^chooseBase/",$name) && $once) && ($this->acl_is_moveable())){
119 $once = false;
120 $this->dialog = new baseSelectDialog($this->config,$this,$this->get_allowed_bases());
121 $this->dialog->setCurrentBase($this->base);
122 }
123 }
125 /* Dialog handling */
126 if(is_object($this->dialog)){
127 /* Must be called before save_object */
128 $this->dialog->save_object();
130 if($this->dialog->isClosed()){
131 $this->dialog = false;
132 }elseif($this->dialog->isSelected()){
134 /* A new base was selected, check if it is a valid one */
135 $tmp = $this->get_allowed_bases();
136 if(isset($tmp[$this->dialog->isSelected()])){
137 $this->base = $this->dialog->isSelected();
138 }
140 $this->dialog= false;
141 }else{
142 return($this->dialog->execute());
143 }
144 }
146 /* Hide all departments, that are subtrees of this department */
147 $bases = $this->get_allowed_bases();
148 if(($this->dn == "new")||($this->dn == "")){
149 $tmp = $bases;
150 }else{
151 $tmp = array();
152 foreach($bases as $dn=>$base){
153 $fixed = str_replace("/","\\",$this->dn);
154 /* Only attach departments which are not a subtree of this one */
155 if(!preg_match("/".$fixed."/",$dn)){
156 $tmp[$dn]=$base;
157 }
158 }
159 }
160 $smarty->assign("bases", $tmp);
162 foreach ($this->attributes as $val){
163 $smarty->assign("$val", $this->$val);
164 }
165 $smarty->assign("base_select", $this->base);
167 /* Set admin unit flag */
168 if ($this->is_administrational_unit) {
169 $smarty->assign("unitTag", "checked");
170 } else {
171 $smarty->assign("unitTag", "");
172 }
174 $smarty->assign("dep_type",$this->type);
176 switch($this->type){
177 case 'c' : $tpl ="country.tpl";break;
178 case 'o' : $tpl ="organization.tpl";break;
179 case 'l' : $tpl ="locality.tpl";break;
180 case 'ou' : $tpl ="generic.tpl";break;
181 case 'alias' : $tpl ="alias.tpl";break;
182 case 'referal' : $tpl ="referal.tpl";break;
183 default : $tpl ="generic.tpl";
184 }
186 return($smarty->fetch (get_template_path($tpl, TRUE)));
187 }
189 function clear_fields()
190 {
191 $this->dn = "";
192 $this->base = "";
194 foreach ($this->attributes as $val){
195 $this->$val= "";
196 }
197 }
199 function remove_from_parent()
200 {
201 $ldap= $this->config->get_ldap_link();
202 $ldap->cd ($this->dn);
203 $ldap->recursive_remove();
204 new log("remove","department/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
205 if (!$ldap->success()){
206 msg_dialog::display(_("LDAP error"), msgPool::ldaperror($ldap->get_error(), $this->dn, LDAP_DEL, get_class()));
207 }
209 /* Optionally execute a command after we're done */
210 $this->handle_post_events('remove');
211 }
213 function must_be_tagged()
214 {
215 return $this->must_be_tagged;
216 }
218 /* Save data to object */
219 function save_object()
220 {
221 if (isset($_POST['dep_generic_posted'])){
223 /* Create a base backup and reset the
224 base directly after calling plugin::save_object();
225 Base will be set seperatly a few lines below */
226 $base_tmp = $this->base;
227 plugin::save_object();
228 $this->base = $base_tmp;
230 /* Set new base if allowed */
231 $tmp = $this->get_allowed_bases();
232 if(isset($_POST['base'])){
233 if(isset($tmp[$_POST['base']])){
234 $this->base= $_POST['base'];
235 }
236 }
238 /* Save tagging flag */
239 if ($this->acl_is_writeable("unitTag")){
240 if (isset($_POST['unitTag'])){
241 $this->is_administrational_unit= true;
242 } else {
243 $this->is_administrational_unit= false;
244 }
245 }
246 }
247 }
250 /* Check values */
251 function check()
252 {
253 /* Call common method to give check the hook */
254 $message= plugin::check();
256 /* Check for presence of this department */
257 $ldap= $this->config->get_ldap_link();
258 $ldap->ls ("(&(ou=".$this->ou.")(objectClass=organizationalUnit))", $this->base, array('dn'));
259 if ($this->orig_dn == "new" && $ldap->count()){
260 $message[]= msgPool::duplicated(_("Name"));
261 } elseif ($this->orig_dn != $this->dn && $ldap->count()){
262 $message[]= msgPool::duplicated(_("Name"));
263 }
265 /* All required fields are set? */
266 if ($this->ou == ""){
267 $message[]= msgPool::required(_("Name"));
268 }
269 if ($this->description == ""){
270 $message[]= msgPool::required(_("Description"));
271 }
273 if(tests::is_department_name_reserved($this->ou,$this->base)){
274 $message[]= msgPool::reserved(_("Name"));
275 }
277 if (preg_match ('/[#+:=>\\\\\/]/', $this->ou)){
278 $message[]= msgPool::invalid(_("Name"), $this->ou, "/[^#+:=>\\\\\/]/");
279 }
280 if (!tests::is_phone_nr($this->telephoneNumber)){
281 $message[]= msgPool::invalid(_("Phone"), $this->telephoneNumber, "/[\/0-9 ()+*-]/");
282 }
283 if (!tests::is_phone_nr($this->facsimileTelephoneNumber)){
284 $message[]= msgPool::invalid(_("Fax"), $this->facsimileTelephoneNumber, "/[\/0-9 ()+*-]/");
285 }
287 /* Check if we are allowed to create or move this object
288 */
289 if($this->orig_dn == "new" && !$this->acl_is_createable($this->base)){
290 $message[] = msgPool::permCreate();
291 }elseif($this->orig_dn != "new" && $this->base != $this->orig_base && !$this->acl_is_moveable($this->base)){
292 $message[] = msgPool::permMove();
293 }
295 return $message;
296 }
299 /* Save to LDAP */
300 function save()
301 {
302 $ldap= $this->config->get_ldap_link();
304 /* Add tag objects if needed */
305 if ($this->is_administrational_unit){
307 /* If this wasn't tagged before add oc an reset unit tag */
308 if(!$this->initially_was_tagged){
309 $this->objectclasses[]= "gosaAdministrativeUnit";
310 $this->gosaUnitTag= "";
312 /* It seams that this method is called twice,
313 set this to true. to avoid adding this oc twice */
314 $this->initially_was_tagged = true;
315 }
317 if ($this->gosaUnitTag == ""){
319 /* It's unlikely, but check if already used... */
320 $try= 5;
321 $ldap->cd($this->config->current['BASE']);
322 while ($try--){
324 /* Generate microtime stamp as tag */
325 list($usec, $sec)= explode(" ", microtime());
326 $time_stamp= preg_replace("/\./", "", $sec.$usec);
328 $ldap->search("(&(objectClass=gosaAdministrativeUnit)(gosaUnitTag=$time_stamp))",array("gosaUnitTag"));
329 if ($ldap->count() == 0){
330 break;
331 }
332 }
333 if($try == 0) {
334 msg_dialog::display(_("Fatal error"), _("Cannot find an unused tag for this administrative unit!"), WARNING_DIALOG);
335 return;
336 }
337 $this->gosaUnitTag= preg_replace("/\./", "", $sec.$usec);
338 }
339 }
340 $this->skipTagging = TRUE;
341 plugin::save();
344 /* Remove tag information if needed */
345 if (!$this->is_administrational_unit && $this->initially_was_tagged){
346 $tmp= array();
348 /* Remove gosaAdministrativeUnit from this plugin */
349 $has_unit_tag= false;
350 foreach($this->attrs['objectClass'] as $oc){
351 if (!preg_match("/^gosaAdministrativeUnit$/i", $oc)){
352 $tmp[]= $oc;
353 }
354 if (preg_match("/^gosaAdministrativeUnitTag$/i", $oc)){
355 $has_unit_tag= true;
356 }
357 }
358 $this->attrs['objectClass']= $tmp;
359 $this->attrs['gosaUnitTag']= array();
360 $this->gosaUnitTag = "";
361 }
364 /* Write back to ldap */
365 $ldap->cat($this->dn, array('dn'));
366 $ldap->cd($this->dn);
368 if ($ldap->count()){
369 $this->cleanup();
370 $ldap->modify ($this->attrs);
371 new log("modify","department/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
372 $this->handle_post_events('modify');
373 } else {
374 $ldap->add($this->attrs);
375 $this->handle_post_events('add');
376 new log("create","department/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
377 }
378 if (!$ldap->success()){
379 msg_dialog::display(_("LDAP error"), msgPool::ldaperror($ldap->get_error(), $this->dn, 0, get_class()));
380 }
382 /* The parameter forces only to set must_be_tagged, and don't touch any objects
383 This will be done later */
384 $this->tag_objects(true);
386 /* Optionally execute a command after we're done */
387 $this->postcreate();
388 return(false);
389 }
392 /* Tag objects to have the gosaAdministrativeUnitTag */
393 function tag_objects($OnlySetTagFlag = false)
394 {
395 if(!$OnlySetTagFlag){
396 $smarty= get_smarty();
397 /* Print out html introduction */
398 echo ' <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
399 <html>
400 <head>
401 <title></title>
402 <style type="text/css">@import url("themes/default/style.css");</style>
403 <script language="javascript" src="include/focus.js" type="text/javascript"></script>
404 </head>
405 <body style="background: none; margin:4px;" id="body" >
406 ';
407 echo "<h3>".sprintf(_("Tagging '%s'."),"<i>".@LDAP::fix($this->dn)."</i>")."</h3>";
408 }
410 $add= $this->is_administrational_unit;
411 $len= strlen($this->dn);
412 $ldap= $this->config->get_ldap_link();
413 $ldap->cd($this->dn);
414 if ($add){
415 $ldap->search('(!(&(objectClass=gosaAdministrativeUnitTag)(gosaUnitTag='.
416 $this->gosaUnitTag.')))', array('dn'));
417 } else {
418 $ldap->search('objectClass=gosaAdministrativeUnitTag', array('dn'));
419 }
421 $objects = array();
422 while ($attrs= $ldap->fetch()){
423 $objects[] = $attrs;
424 }
425 foreach($objects as $attrs){
427 /* Skip self */
428 if ($attrs['dn'] == $this->dn){
429 continue;
430 }
432 /* Check for confilicting administrative units */
433 $fix= true;
434 foreach ($this->config->adepartments as $key => $tag){
435 /* This one is shorter than our dn, its not relevant... */
436 if ($len >= strlen($key)){
437 continue;
438 }
440 /* This one matches with the latter part. Break and don't fix this entry */
441 if (preg_match('/(^|,)'.normalizePreg($key).'$/', $attrs['dn'])){
442 $fix= false;
443 break;
444 }
445 }
447 /* Fix entry if needed */
448 if ($fix){
449 if($OnlySetTagFlag){
450 $this->must_be_tagged =true;
451 return;
452 }
453 $this->handle_object_tagging($attrs['dn'], $this->gosaUnitTag, TRUE );
454 echo "<script language=\"javascript\" type=\"text/javascript\">scrollDown2();</script>" ;
455 }
456 }
458 if(!$OnlySetTagFlag){
459 $this->must_be_tagged = FALSE;
460 echo '<p class="seperator"> </p>';
461 echo "<div style='width:100%;text-align:right;'><form name='form' method='post' action='?plug=".$_GET['plug']."' target='_parent'>
462 <br><input type='submit' name='back' value='"._("Continue")."'>
463 </form></div>";
464 echo "<script language=\"javascript\" type=\"text/javascript\">scrollDown2();</script>" ;
465 }
466 }
469 /* Move/Rename complete trees */
470 function recursive_move($src_dn, $dst_dn,$force = false)
471 {
472 /* Print header to have styles included */
473 $smarty= get_smarty();
475 echo ' <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
476 <html>
477 <head>
478 <title></title>
479 <style type="text/css">@import url("themes/default/style.css");</style>
480 <script language="javascript" src="include/focus.js" type="text/javascript"></script>
481 </head>
482 <body style="background: none; margin:4px;" id="body" >
483 ';
484 echo "<h3>".sprintf(_("Moving '%s' to '%s'"),"<i>".@LDAP::fix($src_dn)."</i>","<i>".@LDAP::fix($dst_dn)."</i>")."</h3>";
487 /* Check if the destination entry exists */
488 $ldap= $this->config->get_ldap_link();
490 /* Check if destination exists - abort */
491 $ldap->cat($dst_dn, array('dn'));
492 if ($ldap->fetch()){
493 trigger_error("Recursive_move ".@LDAP::fix($dst_dn)." already exists.",
494 E_USER_WARNING);
495 echo sprintf("Recursive_move: '%s' already exists", @LDAP::fix($dst_dn))."<br>";
496 return (FALSE);
497 }
499 /* Perform a search for all objects to be moved */
500 $objects= array();
501 $ldap->cd($src_dn);
502 $ldap->search("(objectClass=*)", array("dn"));
503 while($attrs= $ldap->fetch()){
504 $dn= $attrs['dn'];
505 $objects[$dn]= strlen($dn);
506 }
508 /* Sort objects by indent level */
509 asort($objects);
510 reset($objects);
512 /* Copy objects from small to big indent levels by replacing src_dn by dst_dn */
513 foreach ($objects as $object => $len){
516 $src= str_replace("\\","\\\\",$object);
517 $dst= preg_replace("/".str_replace("\\","\\\\",$src_dn)."$/", "$dst_dn", $object);
518 $dst= str_replace($src_dn,$dst_dn,$object);
520 echo "<b>"._("Object").":</b> ".@LDAP::fix($src)."<br>";
522 $this->update_acls($object, $dst,TRUE);
524 if (!$this->copy($src, $dst)){
525 echo "<font color='#FF0000'><br>".sprintf(_("FAILED to copy %s, aborting operation"),@LDAP::fix($src))."</font>";
526 return (FALSE);
527 }
528 echo "<script language=\"javascript\" type=\"text/javascript\">scrollDown2();</script>" ;
529 flush();
530 }
532 /* Remove src_dn */
533 $ldap->cd($src_dn);
534 $ldap->recursive_remove();
535 $this->orig_dn = $this->dn = $dst_dn;
536 $this->orig_base= $this->base;
537 $this->entryCSN = getEntryCSN($this->dn);
539 echo '<p class="seperator"> </p>';
541 echo "<div style='width:100%;text-align:right;'><form name='form' method='post' action='?plug=".$_GET['plug']."' target='_parent'>
542 <br><input type='submit' name='back' value='"._("Continue")."'>
543 </form></div>";
545 echo "<script language=\"javascript\" type=\"text/javascript\">scrollDown2();</script>" ;
546 echo "</body></html>";
548 return (TRUE);
549 }
552 /* Return plugin informations for acl handling */
553 static function plInfo()
554 {
555 return (array("plShortName" => _("Generic"),
556 "plDescription" => _("Departments"),
557 "plSelfModify" => FALSE,
558 "plPriority" => 0,
559 "plDepends" => array(),
560 "plSection" => array("admin"),
561 "plCategory" => array("department" => array("objectClass" => "gosaDepartment", "description" => _("Departments"))),
563 "plProvidedAcls" => array(
564 "description" => _("Description"),
565 "c" => _("Country"),
566 "base" => _("Base"),
567 "l" => _("Location"),
568 "telephoneNumber" => _("Telephone"),
569 "ou" => _("Department name"),
570 "businessCategory" => _("Category"),
571 "st" => _("State"),
572 "postalAddress" => _("Address"),
573 "gosaUnitTag" => _("Administrative settings"),
574 "facsimileTelephoneNumber" => _("Fax"))
575 ));
576 }
578 function handle_object_tagging($dn= "", $tag= "", $show= false)
579 {
580 /* No dn? Self-operation... */
581 if ($dn == ""){
582 $dn= $this->dn;
584 /* No tag? Find it yourself... */
585 if ($tag == ""){
586 $len= strlen($dn);
588 @DEBUG (DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__, "No tag for $dn - looking for one...", "Tagging");
589 $relevant= array();
590 foreach ($this->config->adepartments as $key => $ntag){
592 /* This one is bigger than our dn, its not relevant... */
593 if ($len <= strlen($key)){
594 continue;
595 }
597 /* This one matches with the latter part. Break and don't fix this entry */
598 if (preg_match('/(^|,)'.normalizePreg($key).'$/', $dn)){
599 @DEBUG (DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__, "DEBUG: Possibly relevant: $key", "Tagging");
600 $relevant[strlen($key)]= $ntag;
601 continue;
602 }
604 }
606 /* If we've some relevant tags to set, just get the longest one */
607 if (count($relevant)){
608 ksort($relevant);
609 $tmp= array_keys($relevant);
610 $idx= end($tmp);
611 $tag= $relevant[$idx];
612 $this->gosaUnitTag= $tag;
613 }
614 }
615 }
617 /* Set tag? */
618 if ($tag != ""){
619 /* Set objectclass and attribute */
620 $ldap= $this->config->get_ldap_link();
621 $ldap->cat($dn, array('gosaUnitTag', 'objectClass'));
622 $attrs= $ldap->fetch();
623 if(isset($attrs['gosaUnitTag'][0]) && $attrs['gosaUnitTag'][0] == $tag){
624 if ($show) {
625 echo sprintf(_("Object '%s' is already tagged"), @LDAP::fix($dn))."<br>";
626 flush();
627 }
628 return;
629 }
630 if (count($attrs)){
631 if ($show){
632 echo sprintf(_("Adding tag (%s) to object '%s'"), $tag, @LDAP::fix($dn))."<br>";
633 flush();
634 }
635 $nattrs= array("gosaUnitTag" => $tag);
636 $nattrs['objectClass']= array();
637 for ($i= 0; $i<$attrs['objectClass']['count']; $i++){
638 $oc= $attrs['objectClass'][$i];
639 if ($oc != "gosaAdministrativeUnitTag"){
640 $nattrs['objectClass'][]= $oc;
641 }
642 }
643 $nattrs['objectClass'][]= "gosaAdministrativeUnitTag";
644 $ldap->cd($dn);
645 $ldap->modify($nattrs);
646 if (!$ldap->success()){
647 msg_dialog::display(_("LDAP error"), msgPool::ldaperror($ldap->get_error(), $dn, LDAP_MOD, get_class()));
648 }
649 } else {
650 @DEBUG (DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__, "Not tagging ($tag) $dn - seems to have moved away", "Tagging");
651 }
653 } else {
654 /* Remove objectclass and attribute */
655 $ldap= $this->config->get_ldap_link();
656 $ldap->cat($dn, array('gosaUnitTag', 'objectClass'));
657 $attrs= $ldap->fetch();
658 if (isset($attrs['objectClass']) && !in_array_ics("gosaAdministrativeUnitTag", $attrs['objectClass'])){
659 @DEBUG (DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__, "$dn is not tagged", "Tagging");
660 return;
661 }
662 if (count($attrs)){
663 if ($show){
664 echo sprintf(_("Removing tag from object '%s'"), @LDAP::fix($dn))."<br>";
665 flush();
666 }
667 $nattrs= array("gosaUnitTag" => array());
668 $nattrs['objectClass']= array();
669 for ($i= 0; $i<$attrs['objectClass']['count']; $i++){
670 $oc= $attrs['objectClass'][$i];
671 if ($oc != "gosaAdministrativeUnitTag"){
672 $nattrs['objectClass'][]= $oc;
673 }
674 }
675 $ldap->cd($dn);
676 $ldap->modify($nattrs);
677 if (!$ldap->success()){
678 msg_dialog::display(_("LDAP error"), msgPool::ldaperror($ldap->get_error(), $dn, LDAP_MOD, get_class()));
679 }
680 } else {
681 @DEBUG (DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__, "Not removing tag ($tag) $dn - seems to have moved away", "Tagging");
682 }
683 }
684 }
688 /*! \brief Returns a list of all available departments for this object.
689 If this object is new, all departments we are allowed to create a new user in are returned.
690 If this is an existing object, return all deps. we are allowed to move tis object too.
692 @return Array [dn] => "..name" // All deps. we are allowed to act on.
693 */
694 function get_allowed_bases()
695 {
696 $ui = get_userinfo();
697 $deps = array();
699 /* Is this a new object ? Or just an edited existing object */
700 if(!$this->initially_was_account && $this->is_account){
701 $new = true;
702 }else{
703 $new = false;
704 }
706 $ideps = $this->config->idepartments;
707 if(!isset($ideps[$this->base])){
708 $ideps[$this->base] = ".";
709 }
710 foreach($deps as $dn => $name){
711 if($new && $this->acl_is_createable($dn)){
712 $deps[$dn] = $name;
713 }elseif(!$new && $this->acl_is_moveable($dn)){
714 $deps[$dn] = $name;
715 }
716 }
718 /* Add current base */
719 if(isset($this->base) && isset($ideps[$this->base])){
720 $deps[$this->base] = $ideps[$this->base];
721 }else{
722 trigger_error("Cannot return list of departments, no default base found in class ".get_class($this).". ".$this->base);
723 }
724 return($deps);
725 }
727 }
729 // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
730 ?>