Code

Migrated to get_cfg_value
[gosa.git] / gosa-core / include / class_acl.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 acl extends plugin
24 {
25   /* Definitions */
26   var $plHeadline= "Access control";
27   var $plDescription= "Manage access control lists";
29   /* attribute list for save action */
30   var $attributes= array('gosaAclEntry');
31   var $objectclasses= array('gosaAcl');
33   /* Helpers */
34   var $dialogState= "head";
35   var $gosaAclEntry= array();
36   var $aclType= "";
37   var $aclObject= "";
38   var $aclContents= array();
39   var $target= "group";
40   var $aclTypes= array();
41   var $aclObjects= array();
42   var $aclFilter= "";
43   var $aclMyObjects= array();
44   var $users= array();
45   var $roles= array();
46   var $groups= array();
47   var $recipients= array();
48   var $isContainer= FALSE;
49   var $currentIndex= 0;
50   var $wasNewEntry= FALSE;
51   var $ocMapping= array();
52   var $savedAclContents= array();
53   var $myAclObjects = array();
55   function acl (&$config, $parent, $dn= NULL)
56   {
57     /* Include config object */
58     plugin::plugin($config, $dn);
60     /* Load ACL's */
61     $this->gosaAclEntry= array();
62     if (isset($this->attrs['gosaAclEntry'])){
63       for ($i= 0; $i<$this->attrs['gosaAclEntry']['count']; $i++){
64         $acl= $this->attrs['gosaAclEntry'][$i];
65         $this->gosaAclEntry= array_merge($this->gosaAclEntry, acl::explodeACL($acl));
66       }
67     }
68     ksort($this->gosaAclEntry);
70     /* Save parent - we've to know more about it than other plugins... */
71     $this->parent= &$parent;
73     /* Container? */
74     if (preg_match('/^(o|ou|c|l|dc)=/i', $dn)){
75       $this->isContainer= TRUE;
76     }
78     /* Users */
79     $ui= get_userinfo();
80     $tag= $ui->gosaUnitTag;
81     $ldap= $config->get_ldap_link();
82     $ldap->cd($config->current['BASE']);
83     if ($tag == ""){
84       $ldap->search('(objectClass=gosaAccount)', array('uid', 'cn'));
85     } else {
86       $ldap->search('(&(objectClass=gosaAccount)(gosaUnitTag='.$tag.'))', array('uid', 'cn'));
87     }
88     while ($attrs= $ldap->fetch()){
89       $this->users['U:'.$attrs['dn']]= $attrs['cn'][0].' ['.$attrs['uid'][0].']';
90     }
91     ksort($this->users);
93     /* Groups */
94     $ldap->cd($config->current['BASE']);
95 #    if ($tag == ""){
96       $ldap->search('(objectClass=posixGroup)', array('cn', 'description'));
97 #    } else {
98 #      $ldap->search('(&(objectClass=posixGroup)(gosaUnitTag='.$tag.'))', array('cn', 'description'));
99 #    }
100     while ($attrs= $ldap->fetch()){
101       $dsc= "";
102       if (isset($attrs['description'][0])){
103         $dsc= $attrs['description'][0];
104       }
105       $this->groups['G:'.$attrs['dn']]= $attrs['cn'][0].' ['.$dsc.']';
106     }
107     ksort($this->groups);
109     /* Roles */
110     $ldap->cd($config->current['BASE']);
111 #    if ($tag == ""){
112       $ldap->search('(objectClass=gosaRole)', array('cn', 'description','gosaAclTemplate','dn'));
113 #    } else {
114 #     $ldap->search('(&(objectClass=gosaRole)(gosaUnitTag='.$tag.'))', array('cn', 'description','gosaAclTemplate','dn'));
115 #    }
116     while ($attrs= $ldap->fetch()){
117       $dsc= "";
118       if (isset($attrs['description'][0])){
119         $dsc= $attrs['description'][0];
120       }
122       $role_id = $attrs['dn'];
124       $this->roles[$role_id]['acls'] =array();
125       for ($i= 0; $i < $attrs['gosaAclTemplate']['count']; $i++){
126         $acl= $attrs['gosaAclTemplate'][$i];
127         $this->roles[$role_id]['acls'] = array_merge($this->roles[$role_id]['acls'],acl::explodeACL($acl));
128       }
129       $this->roles[$role_id]['description'] = $dsc;
130       $this->roles[$role_id]['cn'] = $attrs['cn'][0];
131     }
133     /* Objects */
134     $tmp= session::get('plist');
135     $plist= $tmp->info;
136     $cats = array();
137     if (isset($this->parent) && $this->parent !== NULL){
138       $oc= array();
139       foreach ($this->parent->by_object as $key => $obj){
140         $oc= array_merge($oc, $obj->objectclasses);
141         if(isset($obj->acl_category)){
142           $cats[preg_replace("/\//","",$obj->acl_category)] = preg_replace("/\//","",$obj->acl_category);
143         }
144       }
145       if (in_array_ics('organizationalUnit', $oc)){
146         $this->isContainer= TRUE;
147       }
148     } else {
149       $oc=  $this->attrs['objectClass'];
150     }
152     /* Extract available categories from plugin info list */
153     foreach ($plist as $class => $acls){
155       /* Only feed categories */
156       if (isset($acls['plCategory'])){
158         /* Walk through supplied list and feed only translated categories */
159         foreach($acls['plCategory'] as $idx => $data){
161           /* Non numeric index means -> base object containing more informations */
162           if (preg_match('/^[0-9]+$/', $idx)){
164             if (!isset($this->ocMapping[$data])){
165               $this->ocMapping[$data]= array();
166               $this->ocMapping[$data][]= '0';
167             }
169             if(isset($cats[$data])){
170               $this->myAclObjects[$data.'/'.$class]= $acls['plDescription'];
171             }
172             $this->ocMapping[$data][]= $class;
173           } else {
174             if (!isset($this->ocMapping[$idx])){
175               $this->ocMapping[$idx]= array();
176               $this->ocMapping[$idx][]= '0';
177             }
178             $this->ocMapping[$idx][]= $class;
179             $this->aclObjects[$idx]= $data['description'];
181             /* Additionally filter the classes we're interested in in "self edit" mode */
182             if (is_array($data['objectClass'])){
183               foreach($data['objectClass'] as $objectClass){
184                 if (in_array_ics($objectClass, $oc)){
185                   $this->myAclObjects[$idx.'/'.$class]= $acls['plDescription'];
186                   break;
187                 }
188               }
189             } else {
190               if (in_array_ics($data['objectClass'], $oc)){
191                 $this->myAclObjects[$idx.'/'.$class]= $acls['plDescription'];
192               }
193             }
194           }
196         }
197       }
198     }
199     $this->aclObjects['all']= '*&nbsp;'._("All categories");
200     $this->ocMapping['all']= array('0' => 'all');
202     /* Sort categories */
203     asort($this->aclObjects);
205     /* Fill acl types */
206     if ($this->isContainer){
207       $this->aclTypes= array("reset" => _("Reset ACLs"),
208                              "one" => _("One level"),
209                              "base" => _("Current object"),
210                              "sub" => _("Complete subtree"),
211                              "psub" => _("Complete subtree (permanent)"),
212                              "role" => _("Use ACL defined in role"));
213     } else {
214       $this->aclTypes= array("base" => _("Current object"),
215           "role" => _("Use ACL defined in role"));
216     }
217     asort($this->aclTypes);
218     $this->targets= array("user" => _("Users"), "group" => _("Groups"));
219     asort($this->targets);
221     /* Finally - we want to get saved... */
222     $this->is_account= TRUE;
223   }
226   function execute()
227   {
228     /* Call parent execute */
229     plugin::execute();
231     $tmp= session::get('plist');
232     $plist= $tmp->info;
234     /* Handle posts */
235     if (isset($_POST['new_acl'])){
236       $this->dialogState= 'create';
237       $this->dialog= TRUE;
238       $this->currentIndex= count($this->gosaAclEntry);
239       $this->loadAclEntry(TRUE);
240     }
242     $new_acl= array();
243     $aclDialog= FALSE;
244     $firstedit= FALSE;
245     foreach($_POST as $name => $post){
247       /* Actions... */
248       if (preg_match('/^acl_edit_.*_x/', $name)){
249         $this->dialogState= 'create';
250         $firstedit= TRUE;
251         $this->dialog= TRUE;
252         $this->currentIndex= preg_replace('/^acl_edit_([0-9]+).*$/', '\1', $name);
253         $this->loadAclEntry();
254         continue;
255       }
256       if (preg_match('/^acl_del_.*_x/', $name)){
257         unset($this->gosaAclEntry[preg_replace('/^acl_del_([0-9]+).*$/', '\1', $name)]);
258         continue;
259       }
261       if (preg_match('/^cat_edit_.*_x/', $name)){
262         $this->aclObject= preg_replace('/^cat_edit_([^_]+)_.*$/', '\1', $name);
263         $this->dialogState= 'edit';
264         foreach ($this->ocMapping[$this->aclObject] as $oc){
265           if (isset($this->aclContents[$oc])){
266             $this->savedAclContents[$oc]= $this->aclContents[$oc];
267           }
268         }
269         continue;
270       }
271       if (preg_match('/^cat_del_.*_x/', $name)){
272         $idx= preg_replace('/^cat_del_([^_]+)_.*$/', '\1', $name);
273         foreach ($this->ocMapping[$idx] as $key){
274           unset($this->aclContents["$idx/$key"]);
275         }
276         continue;
277       }
279       /* Sorting... */
280       if (preg_match('/^sortup_.*_x/', $name)){
281         $index= preg_replace('/^sortup_([0-9]+).*$/', '\1', $name);
282         if ($index > 0){
283           $tmp= $this->gosaAclEntry[$index];
284           $this->gosaAclEntry[$index]= $this->gosaAclEntry[$index-1];
285           $this->gosaAclEntry[$index-1]= $tmp;
286         }
287         continue;
288       }
289       if (preg_match('/^sortdown_.*_x/', $name)){
290         $index= preg_replace('/^sortdown_([0-9]+).*$/', '\1', $name);
291         if ($index < count($this->gosaAclEntry)-1){
292           $tmp= $this->gosaAclEntry[$index];
293           $this->gosaAclEntry[$index]= $this->gosaAclEntry[$index+1];
294           $this->gosaAclEntry[$index+1]= $tmp;
295         }
296         continue;
297       }
299       /* ACL saving... */
300       if (preg_match('/^acl_.*_[^xy]$/', $name)){
301         $aclDialog= TRUE;
302         list($dummy, $object, $attribute, $value)= split('_', $name);
304         /* Skip for detection entry */
305         if ($object == 'dummy') {
306           continue;
307         }
309         /* Ordinary ACLs */
310         if (!isset($new_acl[$object])){
311           $new_acl[$object]= array();
312         }
313         if (isset($new_acl[$object][$attribute])){
314           $new_acl[$object][$attribute].= $value;
315         } else {
316           $new_acl[$object][$attribute]= $value;
317         }
318       }
320       if(isset($_POST['selected_role'])){
321         $this->aclContents = "";
322         $this->aclContents = base64_decode($_POST['selected_role']);
323       }
324     }
326     if($this->acl_is_writeable("")){
327       
328       /* Only be interested in new acl's, if we're in the right _POST place */
329       if ($aclDialog && $this->aclObject != "" && is_array($this->ocMapping[$this->aclObject])){
331         foreach ($this->ocMapping[$this->aclObject] as $oc){
333           if(isset($this->aclContents[$oc]) && is_array($this->aclContents)){
334             unset($this->aclContents[$oc]);
335             unset($this->aclContents[$this->aclObject.'/'.$oc]);
336           }else{
337 #          trigger_error("Huhm?");
338           }
339           if (isset($new_acl[$oc]) && is_array($new_acl)){
340             $this->aclContents[$oc]= $new_acl[$oc];
341           }
342           if (isset($new_acl[$this->aclObject.'/'.$oc]) && is_array($new_acl)){
343             $this->aclContents[$this->aclObject.'/'.$oc]= $new_acl[$this->aclObject.'/'.$oc];
344           }
345         }
346       }
348       /* Save new acl in case of base edit mode */
349       if ($this->aclType == 'base' && !$firstedit){
350         $this->aclContents= $new_acl;
351       }
352     }
354     /* Cancel new acl? */
355     if (isset($_POST['cancel_new_acl'])){
356       $this->dialogState= 'head';
357       $this->dialog= FALSE;
358       if ($this->wasNewEntry){
359         unset ($this->gosaAclEntry[$this->currentIndex]);
360       }
361     }
363     /* Store ACL in main object? */
364     if (isset($_POST['submit_new_acl'])){
365       $this->gosaAclEntry[$this->currentIndex]['type']= $this->aclType;
366       $this->gosaAclEntry[$this->currentIndex]['members']= $this->recipients;
367       $this->gosaAclEntry[$this->currentIndex]['acl']= $this->aclContents;
368       $this->gosaAclEntry[$this->currentIndex]['filter']= $this->aclFilter;
369       $this->dialogState= 'head';
370       $this->dialog= FALSE;
371     }
373     /* Cancel edit acl? */
374     if (isset($_POST['cancel_edit_acl'])){
375       $this->dialogState= 'create';
376       foreach ($this->ocMapping[$this->aclObject] as $oc){
377         if (isset($this->savedAclContents[$oc])){
378           $this->aclContents[$oc]= $this->savedAclContents[$oc];
379         }
380       }
381     }
383     /* Save edit acl? */
384     if (isset($_POST['submit_edit_acl'])){
385       $this->dialogState= 'create';
386     }
388     /* Add acl? */
389     if (isset($_POST['add_acl']) && $_POST['aclObject'] != ""){
390       $this->dialogState= 'edit';
391       $this->savedAclContents= array();
392       foreach ($this->ocMapping[$this->aclObject] as $oc){
393         if (isset($this->aclContents[$oc])){
394           $this->savedAclContents[$oc]= $this->aclContents[$oc];
395         }
396       }
397     }
399     /* Add to list? */
400     if (isset($_POST['add']) && isset($_POST['source'])){
401       foreach ($_POST['source'] as $key){
402         if ($this->target == 'user'){
403           $this->recipients[$key]= $this->users[$key];
404         }
405         if ($this->target == 'group'){
406           $this->recipients[$key]= $this->groups[$key];
407         }
408       }
409       ksort($this->recipients);
410     }
412     /* Remove from list? */
413     if (isset($_POST['del']) && isset($_POST['recipient'])){
414       foreach ($_POST['recipient'] as $key){
415           unset($this->recipients[$key]);
416       }
417     }
419     /* Save common values */
420     if($this->acl_is_writeable("")){
421       foreach (array("aclType","aclFilter", "aclObject", "target") as $key){
422         if (isset($_POST[$key])){
423           $this->$key= validate($_POST[$key]);
424         }
425       }
426     }
428     /* Create templating instance */
429     $smarty= get_smarty();
431     if ($this->dialogState == 'head'){
432       /* Draw list */
433       $aclList= new divSelectBox("aclList");
434       $aclList->SetHeight(450);
435       
436       /* Fill in entries */
437       foreach ($this->gosaAclEntry as $key => $entry){
438         if(!$this->acl_is_readable("")) continue;
440         $action ="";      
441   
442         $field1= array("string" => $this->aclTypes[$entry['type']], "attach" => "style='width:150px'");
443         $field2= array("string" => $this->assembleAclSummary($entry));
445         if($this->acl_is_writeable("")){
446           $action.= "<input type='image' name='sortup_$key' alt='up' title='"._("Up")."' src='images/lists/sort-up.png' align='top'>";
447           $action.= "<input type='image' name='sortdown_$key' alt='down' title='"._("Down")."' src='images/lists/sort-down.png'>";
448         }
450         $action.= "<input class='center' type='image' src='images/lists/edit.png' alt='"._("Edit")."' name='acl_edit_$key' title='".msgPool::editButton(_("ACL"))."'>";
452         if($this->acl_is_removeable()){
453           $action.= "<input class='center' type='image' src='images/lists/trash.png' alt='"._("Delete")."' name='acl_del_$key' title='".msgPool::delButton(_("ACL"))."'>";
454         }
456         $field3= array("string" => $action, "attach" => "style='border-right:0px;width:50px;text-align:right;'");
457         $aclList->AddEntry(array($field1, $field2, $field3));
458       }
460       $smarty->assign("aclList", $aclList->DrawList());
461     }
463     if ($this->dialogState == 'create'){
464       /* Draw list */
465       $aclList= new divSelectBox("aclList");
466       $aclList->SetHeight(150);
468       /* Add settings for all categories to the (permanent) list */
469       foreach ($this->aclObjects as $section => $dsc){
470         $summary= "";
471         foreach($this->ocMapping[$section] as $oc){
472           if (isset($this->aclContents[$oc]) && count($this->aclContents[$oc]) && isset($this->aclContents[$oc][0]) &&
473               $this->aclContents[$oc][0] != ""){
475             $summary.= "$oc, ";
476             continue;
477           }
478           if (isset($this->aclContents["$section/$oc"]) && count($this->aclContents["$section/$oc"])){
479             $summary.= "$oc, ";
480             continue;
481           }
482           if (isset($this->aclContents[$oc]) && !isset($this->aclContents[$oc][0]) && count($this->aclContents[$oc])){
483             $summary.= "$oc, ";
484           }
485         }
487         /* Set summary... */
488         if ($summary == ""){
489           $summary= '<i>'._("No ACL settings for this category!").'</i>';
490         } else {
491           $summary= sprintf(_("Contains ACLs for these objects: %s"), preg_replace('/, $/', '', $summary));
492         }
494         $field1= array("string" => $dsc, "attach" => "style='width:100px'");
495         $field2= array("string" => $summary);
496         $action= "<input class='center' type='image' src='images/lists/edit.png' alt='"._("Edit")."' name='cat_edit_$section' title='".msgPool::editButton(_("category ACL"))."'>";
497         $action.= "<input class='center' type='image' src='images/lists/trash.png' alt='"._("Delete")."' name='cat_del_$section' title='".msgPool::delButton(_("category ACL"))."'>";
498         $field3= array("string" => $action, "attach" => "style='border-right:0px;width:50px'");
499         $aclList->AddEntry(array($field1, $field2, $field3));
500       }
502       $smarty->assign("aclList", $aclList->DrawList());
503       $smarty->assign("aclType", $this->aclType);
504       $smarty->assign("aclFilter", $this->aclFilter);
505       $smarty->assign("aclTypes", $this->aclTypes);
506       $smarty->assign("target", $this->target);
507       $smarty->assign("targets", $this->targets);
509       /* Assign possible target types */
510       $smarty->assign("targets", $this->targets);
511       foreach ($this->attributes as $attr){
512         $smarty->assign($attr, $this->$attr);
513       }
516       /* Generate list */
517       $tmp= array();
518       foreach (array("user" => "users", "group" => "groups") as $field => $arr){
519         if ($this->target == $field){
520           foreach ($this->$arr as $key => $value){
521             if (!isset($this->recipients[$key])){
522               $tmp[$key]= $value;
523             }
524           }
525         }
526       }
527       $smarty->assign('sources', $tmp);
528       $smarty->assign('recipients', $this->recipients);
530       /* Acl selector if scope is base */
531       if ($this->aclType == 'base'){
532         $smarty->assign('aclSelector', $this->buildAclSelector($this->myAclObjects));
533       }
535       /* Role selector if scope is base */
536       if ($this->aclType == 'role'){
537         $smarty->assign('roleSelector', "Role selector");#, $this->buildRoleSelector($this->myAclObjects));
538         $smarty->assign('roleSelector', $this->buildRoleSelector($this->roles));
539       }
540     }
542     if ($this->dialogState == 'edit'){
543       $smarty->assign('headline', sprintf(_("Edit ACL for '%s' - scope is '%s'"), $this->aclObjects[$this->aclObject], $this->aclTypes[$this->aclType]));
545       /* Collect objects for selected category */
546       foreach ($this->ocMapping[$this->aclObject] as $idx => $class){
547         if ($idx == 0){
548           continue;
549         }
550         $aclObjects[$this->aclObject.'/'.$class]= $plist[$class]['plDescription'];
551       }
552       if ($this->aclObject == 'all'){
553         $aclObjects['all']= _("All objects in current subtree");
554       }
556       /* Role selector if scope is base */
557       if ($this->aclType == 'role'){
558         $smarty->assign('roleSelector', $this->buildRoleSelector($this->roles));
559       } else {
560         $smarty->assign('aclSelector', $this->buildAclSelector($aclObjects));
561       }
562     }
564     /* Show main page */
565     $smarty->assign("dialogState", $this->dialogState);
566    
567     /* Assign acls */ 
568     $smarty->assign("acl_createable",$this->acl_is_createable());
569     $smarty->assign("acl_writeable" ,$this->acl_is_writeable(""));
570     $smarty->assign("acl_readable"  ,$this->acl_is_readable(""));
571     $smarty->assign("acl_removeable",$this->acl_is_removeable());
573     return ($smarty->fetch (get_template_path('acl.tpl')));
574   }
577   function sort_by_priority($list)
578   {
579     $tmp= session::get('plist');
580     $plist= $tmp->info;
581     asort($plist);
582     $newSort = array();
584     foreach($list as $name => $translation){
585       $na  =  preg_replace("/^.*\//","",$name);
586       $prio = 0;
587       if(isset($plist[$na]['plPriority'])){
588         $prio=  $plist[$na]['plPriority'] ;
589       }
591       $newSort[$name] = $prio;
592     }
594     asort($newSort);
596     $ret = array();
597     foreach($newSort as $name => $prio){
598       $ret[$name] = $list[$name];
599     }
600     return($ret);
601   }
604   function buildRoleSelector($list)
605   {
606     $D_List =new divSelectBox("Acl_Roles");
607  
608     $selected = $this->aclContents;
609     if(!is_string($this->aclContents) || !isset($list[$this->aclContents])){
610       $selected = key($list);
611     }
613     $str ="";
614     foreach($list as $dn => $values){
616       if($dn == $selected){    
617         $option = "<input type='radio' name='selected_role' value='".base64_encode($dn)."' checked>";
618       }else{
619         $option = "<input type='radio' name='selected_role' value='".base64_encode($dn)."'>";
620       }
621  
622       $field1 = array("string" => $option) ;
623       $field2 = array("string" => $values['cn'], "attach" => "style='width:200px;'") ;
624       $field3 = array("string" => $values['description'],"attach" => "style='border-right:0px;'") ;
626       $D_List->AddEntry(array($field1,$field2,$field3));
627     }
628     return($D_List->DrawList());
629   } 
632   function buildAclSelector($list)
633   {
634     $display= "<input type='hidden' name='acl_dummy_0_0_0' value='1'>";
635     $cols= 3;
636     $tmp= session::get('plist');
637     $plist= $tmp->info;
638     asort($plist);
640     /* Add select all/none buttons */
641     $style = "style='width:100px;'";
643     if($this->acl_is_writeable("")){
644       $display .= "<input ".$style." type='button' name='toggle_all_create' onClick=\"acl_toggle_all('_0_c$');\" value='Toggle C'>";
645       $display .= "<input ".$style." type='button' name='toggle_all_move'   onClick=\"acl_toggle_all('_0_m$');\" value='Toggle M'>";
646       $display .= "<input ".$style." type='button' name='toggle_all_remove' onClick=\"acl_toggle_all('_0_d$');\" value='Toggle D'> - ";
647       $display .= "<input ".$style." type='button' name='toggle_all_read'   onClick=\"acl_toggle_all('_0_r$');\" value='Toggle R'>";
648       $display .= "<input ".$style." type='button' name='toggle_all_write'  onClick=\"acl_toggle_all('_0_w$');\" value='Toggle W'> - ";
650       $display .= "<input ".$style." type='button' name='toggle_all_sub_read'  onClick=\"acl_toggle_all('[^0]_r$');\" value='R+'>";
651       $display .= "<input ".$style." type='button' name='toggle_all_sub_write'  onClick=\"acl_toggle_all('[^0]_w$');\" value='W+'>";
653       $display .= "<br>";
655       $style = "style='width:50px;'";
656       $display .= "<input ".$style." type='button' name='set_true_all_create' onClick=\"acl_set_all('_0_c$',true);\" value='C+'>";
657       $display .= "<input ".$style." type='button' name='set_false_all_create' onClick=\"acl_set_all('_0_c$',false);\" value='C-'>";
658       $display .= "<input ".$style." type='button' name='set_true_all_move' onClick=\"acl_set_all('_0_m$',true);\" value='M+'>";
659       $display .= "<input ".$style." type='button' name='set_false_all_move' onClick=\"acl_set_all('_0_m$',false);\" value='M-'>";
660       $display .= "<input ".$style." type='button' name='set_true_all_remove' onClick=\"acl_set_all('_0_d$',true);\" value='D+'>";
661       $display .= "<input ".$style." type='button' name='set_false_all_remove' onClick=\"acl_set_all('_0_d$',false);\" value='D-'> - ";
662       $display .= "<input ".$style." type='button' name='set_true_all_read' onClick=\"acl_set_all('_0_r$',true);\" value='R+'>";
663       $display .= "<input ".$style." type='button' name='set_false_all_read' onClick=\"acl_set_all('_0_r$',false);\" value='R-'>";
664       $display .= "<input ".$style." type='button' name='set_true_all_write' onClick=\"acl_set_all('_0_w$',true);\" value='W+'>";
665       $display .= "<input ".$style." type='button' name='set_false_all_write' onClick=\"acl_set_all('_0_w$',false);\" value='W-'> - ";
667       $display .= "<input ".$style." type='button' name='set_true_all_read' onClick=\"acl_set_all('[^0]_r$',true);\" value='R+'>";
668       $display .= "<input ".$style." type='button' name='set_false_all_read' onClick=\"acl_set_all('[^0]_r$',false);\" value='R-'>";
669       $display .= "<input ".$style." type='button' name='set_true_all_write' onClick=\"acl_set_all('[^0]_w$',true);\" value='W+'>";
670       $display .= "<input ".$style." type='button' name='set_false_all_write' onClick=\"acl_set_all('[^0]_w$',false);\" value='W-'>";
671     }
673     /* Build general objects */
674     $list =$this->sort_by_priority($list);
675     foreach ($list as $key => $name){
677       /* Create sub acl if it does not exist */
678       if (!isset($this->aclContents[$key])){
679         $this->aclContents[$key]= array();
680         $this->aclContents[$key][0]= '';
681       }
682       $currentAcl= $this->aclContents[$key];
684       /* Get the overall plugin acls 
685        */
686       $overall_acl ="";
687       if(isset($currentAcl[0])){
688         $overall_acl = $currentAcl[0];
689       }
691       /* Object header */
692       if(session::get('js')) {
693         if(isset($_SERVER['HTTP_USER_AGENT']) && preg_match("/gecko/i",$_SERVER['HTTP_USER_AGENT'])) {
694           $display.= "\n<table style='width:100%;border:1px solid #A0A0A0' cellspacing=0 cellpadding=2>".
695                      "\n  <tr>".
696                      "\n    <td style='background-color:#C8C8C8;height:1.8em;' colspan=".($cols-1)."><b>"._("Object").": $name</b></td>".
697                      "\n    <td align='right' style='background-color:#C8C8C8;height:1.8em;'>".
698                      "\n    <input type='button' onclick='divtoggle(\"".preg_replace("/[^a-z0-9]/i","_",$name)."\");' value='"._("Show/hide advanced settings")."' /></td>".
699                      "\n  </tr>";
700         } else if (isset($_SERVER['HTTP_USER_AGENT']) && preg_match("/ie/i",$_SERVER['HTTP_USER_AGENT'])) {
701           $display.= "\n<table style='width:100%;border:1px solid #A0A0A0' cellspacing=0 cellpadding=2>".
702                      "\n  <tr>".
703                      "\n    <td style='background-color:#C8C8C8;height:1.8em;' colspan=".($cols-1)."><b>"._("Object").": $name</b></td>".
704                      "\n    <td align='right' style='background-color:#C8C8C8;height:1.8em;'>".
705                      "\n    <input type='button' onclick='divtoggle(\"".preg_replace("/[^a-z0-9]/i","_",$name)."\");' value='"._("Show/hide advanced settings")."' /></td>".
706                      "\n  </tr>";
707         } else {
708           $display.= "\n<table style='width:100%;border:1px solid #A0A0A0' cellspacing=0 cellpadding=2>".
709                      "\n  <tr>".
710                      "\n    <td style='background-color:#C8C8C8;height:1.8em;' colspan=$cols><b>"._("Object").": $name</b></td>".
711                      "\n  </tr>";
712         }
713       } else {
714           $display.= "\n<table style='width:100%;border:1px solid #A0A0A0' cellspacing=0 cellpadding=2>".
715                      "\n  <tr>".
716                      "\n    <td style='background-color:#C8C8C8;height:1.8em;' colspan=$cols><b>"._("Object").": $name</b></td>".
717                      "\n  </tr>";
718       }
720       /* Generate options */
721       $spc= "&nbsp;&nbsp;";
722 #      if ($this->isContainer && $this->aclType != 'base'){
723         $options= $this->mkchkbx($key."_0_c",  _("Create objects"), preg_match('/c/', $overall_acl)).$spc;
724         $options.= $this->mkchkbx($key."_0_m", _("Move objects"), preg_match('/m/', $overall_acl)).$spc;
725         $options.= $this->mkchkbx($key."_0_d", _("Remove objects"), preg_match('/d/', $overall_acl)).$spc;
726         if ($plist[preg_replace('%^.*/%', '', $key)]['plSelfModify']){
727           $options.= $this->mkchkbx($key."_0_s", _("Modifyable by owner"), preg_match('/s/', $overall_acl)).$spc;
728         }
729  #     } else {
730  #       $options= $this->mkchkbx($key."_0_m", _("Move object"), preg_match('/m/', $overall_acl)).$spc;
731  #       $options.= $this->mkchkbx($key."_0_d", _("Remove object"), preg_match('/d/', $overall_acl)).$spc;
732  #       if ($plist[preg_replace('%^.*/%', '', $key)]['plSelfModify']){
733  #         $options.= $this->mkchkbx($key."_0_s", _("Modifyable by owner"), preg_match('/s/', $overall_acl)).$spc;
734  #       }
735  #     }
737       /* Global options */
738       $more_options= $this->mkchkbx($key."_0_r",  _("read"), preg_match('/r/', $overall_acl)).$spc;
739       $more_options.= $this->mkchkbx($key."_0_w", _("write"), preg_match('/w/', $overall_acl));
741       $display.= "\n  <tr>".
742                  "\n    <td style='background-color:#E0E0E0' colspan=".($cols-1).">$options</td>".
743                  "\n    <td style='background-color:#D4D4D4'>&nbsp;"._("Complete object").": $more_options</td>".
744                  "\n  </tr>";
746       /* Walk through the list of attributes */
747       $cnt= 1;
748       $splist= $plist[preg_replace('%^.*/%', '', $key)]['plProvidedAcls'];
749 #      asort($splist);
750       if(session::get('js')) {
751         if(isset($_SERVER['HTTP_USER_AGENT']) && preg_match("/gecko/i",$_SERVER['HTTP_USER_AGENT'])) {
752           $display.= "\n  <tr id='tr_".preg_replace("/[^a-z0-9]/i","_",$name)."' style='vertical-align:top;height:0px;'>".
753                      "\n    <td colspan=".$cols.">".
754                      "\n      <div id='".preg_replace("/[^a-z0-9]/i","_",$name)."' style='overflow:hidden;visibility:hidden;height:0px;vertical-align:top;width:100%;'>".
755                      "\n        <table style='width:100%;'>";
756         } else if (isset($_SERVER['HTTP_USER_AGENT']) && preg_match("/ie/i",$_SERVER['HTTP_USER_AGENT'])) {
757           $display.= "\n  <tr id='tr_".preg_replace("/[^a-z0-9]/i","_",$name)."' style='vertical-align:top;height:0px;'>".
758                      "\n    <td colspan=".$cols.">".
759                      "\n      <div id='".preg_replace("/[^a-z0-9]/i","_",$name)."' style='position:absolute;overflow:hidden;visibility:hidden;height:0px;vertical-align:top;width:100%;'>".
760                      "\n        <table style='width:100%;'>";
761         }
762       }
763       foreach($splist as $attr => $dsc){
765         /* Skip pl* attributes, they are internal... */
766         if (preg_match('/^pl[A-Z]+.*$/', $attr)){
767           continue;
768         }
770         /* Open table row */
771         if ($cnt == 1){
772           $display.= "\n  <tr>";
773         }
775         /* Close table row */
776         if ($cnt == $cols){
777           $cnt= 1;
778           $rb= "";
779           $end= "\n  </tr>";
780         } else {
781           $cnt++;
782           $rb= "border-right:1px solid #A0A0A0;";
783           $end= "";
784         }
786         /* Collect list of attributes */
787         $state= "";
788         if (isset($currentAcl[$attr])){
789           $state= $currentAcl[$attr];
790         }
791         $display.= "\n    <td style='border-top:1px solid #A0A0A0;${rb}width:".(int)(100/$cols)."%'>".
792                    "\n      <b>$dsc</b> ($attr)<br>".$this->mkrwbx($key."_".$attr, $state)."</td>$end";
793       }
794       
795       /* Fill missing td's if needed */
796       if (--$cnt != $cols && $cnt != 0){
797        $display.= str_repeat("\n    <td style='border-top:1px solid #A0A0A0; width:".(int)(100/$cols)."%'>&nbsp;</td>", $cols-$cnt); 
798       }
800       if(session::get('js')) {
801         if(isset($_SERVER['HTTP_USER_AGENT']) && (preg_match("/gecko/i",$_SERVER['HTTP_USER_AGENT'])) || (preg_match("/ie/i",$_SERVER['HTTP_USER_AGENT']))) {
802           $display.= "\n        </table>".
803                      "\n      </div>".
804                      "\n    </td>".
805                      "\n  </tr>";
806         }
807       }
809       $display.= "\n</table><br />\n";
810     }
812     return ($display);
813   }
816   function mkchkbx($name, $text, $state= FALSE)
817   {
818     $state= $state?"checked":"";
819     if($this->acl_is_writeable("")){
820       return "\n      <input id='acl_".preg_replace("/[^a-z0-9]/i","_",$name)."' type=checkbox name='acl_$name' $state>".
821         "\n      <label for='acl_".preg_replace("/[^a-z0-9]/i","_",$name)."'>$text</label>";
822     }else{
823       return "\n <input type='checkbox' disabled name='dummy_".microtime(1)."' $state>$text";
824     }
825   }
828   function mkrwbx($name, $state= "")
829   {
830     $rstate= preg_match('/r/', $state)?'checked':'';
831     $wstate= preg_match('/w/', $state)?'checked':'';
832       
833     if($this->acl_is_writeable("")){
834       return ("\n      <input id='acl_".preg_replace("/[^a-z0-9]/i","_",$name)."_r' type=checkbox name='acl_${name}_r' $rstate>".
835           "\n      <label for='acl_".preg_replace("/[^a-z0-9]/i","_",$name)."_r'>"._("read")."</label>".
836           "\n      <input id='acl_".preg_replace("/[^a-z0-9]/i","_",$name)."_w' type=checkbox name='acl_${name}_w' $wstate>".
837           "\n      <label for='acl_".preg_replace("/[^a-z0-9]/i","_",$name)."_w'>"._("write")."</label>");
838     }else{
839       return ("\n      <input disabled type=checkbox name='dummy_".microtime(1)."' $rstate>"._("read").
840           "\n      <input disabled type=checkbox name='dummy_".microtime(1)."' $wstate>"._("write"));
841     }
842   }
845   static function explodeACL($acl)
846   {
848     $list= split(':', $acl);
849     if(count($list) == 5){
850       list($index, $type,$member,$permission,$filter)= $list;
851       $filter = base64_decode($filter);
852     }else{
853       $filter = "";
854       list($index, $type,$member,$permission)= $list;
855     }
857     $a= array( $index => array("type" => $type,
858                                "filter"=> $filter,
859                                "members" => acl::extractMembers($acl,$type == "role")));
860    
861     /* Handle different types */
862     switch ($type){
864       case 'psub':
865       case 'sub':
866       case 'one':
867       case 'base':
868         $a[$index]['acl']= acl::extractACL($acl);
869         break;
870       
871       case 'role':
872         $a[$index]['acl']= base64_decode(preg_replace('/^[^:]+:[^:]+:([^:]+).*$/', '\1', $acl));
873         break;
875       case 'reset':
876         break;
877       
878       default:
879         msg_dialog::display(_("Internal error"), sprintf(_("Unkown ACL type '%s'!"), $type), ERROR_DIALOG);
880         $a= array();
881     }
882     return ($a);
883   }
886   static function extractMembers($acl,$role = FALSE)
887   {
888     global $config;
889     $a= array();
891     /* Rip acl off the string, seperate by ',' and place it in an array */
892     if($role){
893       $ms= preg_replace('/^[^:]+:[^:]+:[^:]+:([^:]+).*$/', '\1', $acl);
894     }else{
895       $ms= preg_replace('/^[^:]+:[^:]+:([^:]+).*$/', '\1', $acl);
896     }
897     if ($ms == $acl){
898       return $a;
899     }
900     $ma= split(',', $ms);
902     /* Decode dn's, fill with informations from LDAP */
903     $ldap= $config->get_ldap_link();
904     foreach ($ma as $memberdn){
905       $dn= base64_decode($memberdn);
906       $ldap->cat($dn, array('cn', 'objectClass', 'description', 'uid'));
908       /* Found entry... */
909       if ($ldap->count()){
910         $attrs= $ldap->fetch();
911         if (in_array_ics('gosaAccount', $attrs['objectClass'])){
912           $a['U:'.$dn]= $attrs['cn'][0]." [".$attrs['uid'][0]."]";
913         } else {
914           $a['G:'.$dn]= $attrs['cn'][0];
915           if (isset($attrs['description'][0])){
916             $a['G:'.$dn].= " [".$attrs['description'][0]."]";
917           }
918         }
920       /* ... or not */
921       } else {
922         $a['U:'.$dn]= sprintf(_("Unknown entry '%s'!"), $dn);
923       }
924     }
926     return ($a);
927   }
930   static function extractACL($acl)
931   {
932     /* Rip acl off the string, seperate by ',' and place it in an array */
933     $as= preg_replace('/^[^:]+:[^:]+:[^:]*:([^:]*).*$/', '\1', $acl);
934     $aa= split(',', $as);
935     $a= array();
937     /* Dis-assemble single ACLs */
938     foreach($aa as $sacl){
939       
940       /* Dis-assemble field ACLs */
941       $ao= split('#', $sacl);
942       $gobject= "";
943       foreach($ao as $idx => $ssacl){
945         /* First is department with global acl */
946         $object= preg_replace('/^([^;]+);.*$/', '\1', $ssacl);
947         $gacl=   preg_replace('/^[^;]+;(.*)$/', '\1', $ssacl);
948         if ($idx == 0){
949           /* Create hash for this object */
950           $gobject= $object;
951           $a[$gobject]= array();
953           /* Append ACL if set */
954           if ($gacl != ""){
955             $a[$gobject]= array($gacl);
956           }
957         } else {
959           /* All other entries get appended... */
960           list($field, $facl)= split(';', $ssacl);
961           $a[$gobject][$field]= $facl;
962         }
964       }
965     }
967     return ($a);
968   }
970   
971   function assembleAclSummary($entry)
972   {
973     $summary= "";
975     /* Summarize ACL */
976     if (isset($entry['acl'])){
977       $acl= "";
979       if($entry['type'] == "role"){
981         if(isset($this->roles[$entry['acl']])){  
982           $summary.= sprintf(_("Role: %s"), $this->roles[$entry['acl']]['cn']);
983         }else{
984           $summary.= sprintf(_("Role: %s"), "<i>"._("unknown role")."</i>");
985         }
986       }else{
987         foreach ($entry['acl'] as $name => $object){
988           if (count($object)){
989             $acl.= "$name, ";
990           }
991         }
992         $summary.= sprintf(_("Contains settings for these objects: %s"), preg_replace('/, $/', '', $acl));
993       }
994     }
996     /* Summarize members */
997     if ($summary != ""){
998       $summary.= ", ";
999     }
1000     if (count($entry['members'])){
1001       $summary.= _("Members").": ";
1002       foreach ($entry['members'] as $cn){
1003         $cn= preg_replace('/ \[.*$/', '', $cn);
1004         $summary.= $cn.", ";
1005       }
1006     } else {
1007       $summary.= _("ACL takes effect for all users");
1008     }
1010     return (preg_replace('/, $/', '', $summary));
1011   }
1014   function loadAclEntry($new= FALSE)
1015   {
1016     /* New entry gets presets... */
1017     if ($new){
1018       $this->aclType= 'base';
1019       $this->aclFilter= "";
1020       $this->recipients= array();
1021       $this->aclContents= array();
1022     } else {
1023       $acl= $this->gosaAclEntry[$this->currentIndex];
1024       $this->aclType= $acl['type'];
1025       $this->recipients= $acl['members'];
1026       $this->aclContents= $acl['acl'];
1027       $this->aclFilter= $acl['filter'];
1028     }
1030     $this->wasNewEntry= $new;
1031   }
1034   function aclPostHandler()
1035   {
1036     if (isset($_POST['save_acl'])){
1037       $this->save();
1038       return TRUE;
1039     }
1041     return FALSE;
1042   }
1044   
1045   function PrepareForCopyPaste($source)
1046   {
1047     plugin::PrepareForCopyPaste($source);
1048     
1049     $dn = $source['dn'];
1050     $acl_c = new acl($this->config, $this->parent,$dn);
1051     $this->gosaAclEntry = $acl_c->gosaAclEntry;
1052   }
1055   function save()
1056   {
1057     /* Assemble ACL's */
1058     $tmp_acl= array();
1059   
1060     foreach ($this->gosaAclEntry as $prio => $entry){
1061       $final= "";
1062       $members= "";
1063       if (isset($entry['members'])){
1064         foreach ($entry['members'] as $key => $dummy){
1065           $members.= base64_encode(preg_replace('/^.:/', '', $key)).',';
1066         }
1067       }
1069       if($entry['type'] != "role"){
1070         $final= $prio.":".$entry['type'].":".preg_replace('/,$/', '', $members);
1071       }else{
1072         $final= $prio.":".$entry['type'].":".base64_encode($entry['acl']).":".preg_replace('/,$/', '', $members);
1073       }
1075       /* ACL's if needed */
1076       if ($entry['type'] != "reset" && $entry['type'] != "role"){
1077         $acl= ":";
1078         if (isset($entry['acl'])){
1079           foreach ($entry['acl'] as $object => $contents){
1081             /* Only save, if we've some contents in there... */
1082             if (count($contents)){
1083               $acl.= $object.";";
1085               foreach($contents as $attr => $permission){
1087                 /* First entry? Its the one for global settings... */
1088                 if ($attr == '0'){
1089                   $acl.= $permission;
1090                 } else {
1091                   $acl.= '#'.$attr.';'.$permission;
1092                 }
1094               }
1095               $acl.= ',';
1096             }
1097             
1098           }
1099         }
1100         $final.= preg_replace('/,$/', '', $acl);
1101       }
1103       /* Append additional filter options 
1104        */
1105       if(!empty($entry['filter'])){
1106         $final .= ":".base64_encode($entry['filter']);
1107       }
1109       $tmp_acl[]= $final;
1110     } 
1112     /* Call main method */
1113     plugin::save();
1115     /* Finally (re-)assign it... */
1116     $this->attrs['gosaAclEntry']= $tmp_acl;
1118     /* Remove acl from this entry if it is empty... */
1119     if (!count($tmp_acl)){
1120       /* Remove attribute */
1121       if ($this->initially_was_account){
1122         $this->attrs['gosaAclEntry']= array();
1123       } else {
1124         if (isset($this->attrs['gosaAclEntry'])){
1125           unset($this->attrs['gosaAclEntry']);
1126         }
1127       }
1129       /* Remove object class */
1130       $this->attrs['objectClass']= array_remove_entries(array('gosaAcl'), $this->attrs['objectClass']);
1131     }    
1133     /* Do LDAP modifications */
1134     $ldap= $this->config->get_ldap_link();
1135     $ldap->cd($this->dn);
1136     $this->cleanup();
1137     $ldap->modify ($this->attrs);
1139     if(count($this->attrs)){
1140       new log("modify","acls/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
1141     }
1143     if (!$ldap->success()){
1144       msg_dialog::display(_("LDAP error"), msgPool::ldaperror($ldap->get_error(), $this->dn, LDAP_MOD, get_class()));
1145     }
1147     /* Refresh users ACLs */
1148     $ui= get_userinfo();
1149     $ui->loadACL();
1150     session::set('ui',$ui);
1151   }
1154   function remove_from_parent()
1155   {
1156     plugin::remove_from_parent();
1158     /* include global link_info */
1159     $ldap= $this->config->get_ldap_link();
1161     $ldap->cd($this->dn);
1162     $this->cleanup();
1163     $ldap->modify ($this->attrs);
1165     new log("remove","acls/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
1167     /* Optionally execute a command after we're done */
1168     $this->handle_post_events("remove",array("uid" => $this->uid));
1169   }
1171   
1172   /* Return plugin informations for acl handling */
1173   static function plInfo()
1174   {
1175     return (array(
1176           "plShortName"   => _("ACL"),
1177           "plDescription" => _("ACL")._("Access control list").")",
1178           "plSelfModify"  => FALSE,
1179           "plDepends"     => array(),
1180           "plPriority"    => 0,
1181           "plSection"     => array("administration"),
1182           "plCategory"    => array("acl" => array("description"  => _("ACL")."&nbsp;&amp;&nbsp;"._("ACL roles"),
1183                                                           "objectClass"  => array("gosaAcl","gosaRole"))),
1184           "plProvidedAcls"=> array(
1185             "cn"          => _("Role name"),
1186             "description" => _("Role description"))
1188           ));
1189   }
1192   /* Remove acls defined for $src */
1193   function remove_acl()
1194   {
1195     $this->remove_acl_for_dn($this->dn);
1196   }
1199   /* Remove acls defined for $src */
1200   function remove_acl_for_dn($src = "")
1201   {
1202     if($src == ""){
1203       $src = $this->dn;
1204     }
1205     $ldap = $this->config->get_ldap_link();
1206     $ldap->cd($this->config->current['BASE']);
1207     $ldap->search("(&(objectClass=gosaAcl)(gosaAclEntry=*".base64_encode($src)."*))",array("gosaAclEntry","dn"));
1208     while($attrs = $ldap->fetch()){
1209       $acl = new acl($this->config,$this->parent,$attrs['dn']);
1210       foreach($acl->gosaAclEntry as $id => $entry){
1211         foreach($entry['members'] as $m_id => $member){
1212           if($m_id == "U:".$src){
1213             unset($acl->gosaAclEntry[$id]['members'][$m_id]);
1214             gosa_log("modify","users/acl",$attrs['dn'],array(),sprintf("Removed acl for user %s on object %s.",$src,$attrs['dn']));
1215           }
1216           if($m_id == "G:".$src){
1217             unset($acl->gosaAclEntry[$id]['members'][$m_id]);
1218             gosa_log("modify","groups/acl",$attrs['dn'],array(),sprintf("Removed acl for group %s on object %s.",$src,$attrs['dn']));
1219           }
1220         }
1221       }
1222       $acl -> save();
1223     }
1224   }
1226   function update_acl_membership($src,$dst)
1227   {
1228     $ldap = $this->config->get_ldap_link();
1229     $ldap->cd($this->config->current['BASE']);
1230     $ldap->search("(&(objectClass=gosaAcl)(gosaAclEntry=*".base64_encode($src)."*))",array("gosaAclEntry","dn"));
1231     while($attrs = $ldap->fetch()){
1232       $acl = new acl($this->config,$this->parent,$attrs['dn']);
1233       foreach($acl->gosaAclEntry as $id => $entry){
1234         foreach($entry['members'] as $m_id => $member){
1235           if($m_id == "U:".$src){
1236             unset($acl->gosaAclEntry[$id]['members'][$m_id]);
1237             $new = "U:".$dst;
1238             $acl->gosaAclEntry[$id]['members'][$new] = $new;
1239             gosa_log("modify","users/acl",$attrs['dn'],array(),sprintf("Updated acl for user %s on object %s.",$src,$attrs['dn']));
1240           }
1241           if($m_id == "G:".$src){
1242             unset($acl->gosaAclEntry[$id]['members'][$m_id]);
1243             $new = "G:".$dst;
1244             $acl->gosaAclEntry[$id]['members'][$new] = $new;
1245             gosa_log("modify","groups/acl",$attrs['dn'],array(),sprintf("Updated acl for group %s on object %s.",$src,$attrs['dn']));
1246           }
1247         }
1248       }
1249       $acl -> save();
1250     }
1251   }
1255 // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
1256 ?>