Code

Fake dn , entries
[gosa.git] / gosa-core / plugins / admin / acl / class_aclRole.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 aclrole extends acl
24 {
25   /* Definitions */
26   var $plHeadline= "Access control roles";
27   var $plDescription= "Edit AC roles";
29   /* attribute list for save action */
30   var $attributes= array('gosaAclTemplate',"cn","description");
31   var $objectclasses= array('top','gosaRole');
33   /* Helpers */
34   var $dialogState= "head";
35   var $aclType= "";
36   var $aclObject= "";
37   var $aclContents= array();
38   var $target= "group";
39   var $aclTypes= array();
40   var $aclObjects= array();
41   var $recipients= array();
42   var $isContainer= TRUE;
43   var $currentIndex= 0;
44   var $wasNewEntry= FALSE;
45   var $ocMapping= array();
46   var $savedAclContents= array();
47   var $myAclObjects = array();
49   /* Role attributes */
50   var $gosaAclTemplate= "";
51   var $cn = "";
52   var $description = "";
53   var $orig_dn;
54   var $orig_base;
55   var $base ="";
57   function aclrole (&$config,  $dn= NULL)
58   {
59     /* Include config object */
60     plugin::plugin($config, $dn);
62     if($this->dn == "new"){
63       $this->base  = session::get('CurrentMainBase');
64     }else{
65       $this->base = preg_replace("/^[^,]+,[^,]+,/","",$this->dn);
66       new log("view","aclroles/".get_class($this),$this->dn);
67     }
68    
69     /* Load ACL's */
70     $this->gosaAclTemplate= array();
71     if (isset($this->attrs["gosaAclTemplate"])){
72       for ($i= 0; $i<$this->attrs["gosaAclTemplate"]['count']; $i++){
73         $acl= $this->attrs["gosaAclTemplate"][$i];
74         $this->gosaAclTemplate= array_merge($this->gosaAclTemplate, $this->explodeACL($acl));
75       }
76     }
77     ksort($this->gosaAclTemplate);
79     /* Extract available categories from plugin info list */
80     $tmp= session::get('plist');
81     $plist= $tmp->info;
82     $oc = array();
83     foreach ($plist as $class => $acls){
85       /* Only feed categories */
86       if (isset($acls['plCategory'])){
88         /* Walk through supplied list and feed only translated categories */
89         foreach($acls['plCategory'] as $idx => $data){
91           /* Non numeric index means -> base object containing more informations */
92           if (preg_match('/^[0-9]+$/', $idx)){
93             if (!isset($this->ocMapping[$data])){
94               $this->ocMapping[$data]= array();
95               $this->ocMapping[$data][]= '0';
96             }
97             $this->ocMapping[$data][]= $class;
98           } else {
99             if (!isset($this->ocMapping[$idx])){
100               $this->ocMapping[$idx]= array();
101               $this->ocMapping[$idx][]= '0';
102             }
103             $this->ocMapping[$idx][]= $class;
104             $this->aclObjects[$idx]= $data['description'];
106             /* Additionally filter the classes we're interested in in "self edit" mode */
107             if (is_array($data['objectClass'])){
108               foreach($data['objectClass'] as $objectClass){
109                 if (in_array_ics($objectClass, $oc)){
110                   $this->myAclObjects[$idx.'/'.$class]= $acls['plDescription'];
111                   break;
112                 }
113               }
114             } else {
115               if (in_array_ics($data['objectClass'], $oc)){
116                 $this->myAclObjects[$idx.'/'.$class]= $acls['plDescription'];
117               }
118             }
119           }
121         }
122       }
123     }
124     $this->aclObjects['all']= '*&nbsp;'._("All categories");
125     $this->ocMapping['all']= array('0' => 'all');
127     /* Sort categories */
128     asort($this->aclObjects);
130     /* Fill acl types */
131     $this->aclTypes= array( "reset" => _("Reset ACL"),
132                              "one" => _("One level"),
133                              "base" => _("Current object"),
134                              "sub" => _("Complete subtree"),
135                              "psub" => _("Complete subtree (permanent)"));
136     asort($this->aclTypes);
138     /* Finally - we want to get saved... */
139     $this->is_account= TRUE;
140     $this->orig_base = $this->base;
141     $this->orig_dn = $this->dn;
142   }
145   function execute()
146   {
147     /* Call parent execute */
148     plugin::execute();
150     /* Base select dialog */
151     $once = true;
152     foreach($_POST as $name => $value){
153       if((preg_match("/^chooseBase/",$name) && $once) && ($this->acl_is_moveable())){
154         $once = false;
155         $this->dialog = new baseSelectDialog($this->config,$this,$this->get_allowed_bases());
156         $this->dialog->setCurrentBase($this->base);
157       }
158     }
160     /* Dialog handling */
161     if(is_object($this->dialog)){
162       /* Must be called before save_object */
163       $this->dialog->save_object();
165       if($this->dialog->isClosed()){
166         $this->dialog = false;
167       }elseif($this->dialog->isSelected()){
169         /* Check if selected base is valid */
170         $tmp = $this->get_allowed_bases();
171         if(isset($tmp[$this->dialog->isSelected()])){
172           $this->base = $this->dialog->isSelected();
173         }
174         $this->dialog= false;
175       }else{
176         return($this->dialog->execute());
177       }
178     }
180     $tmp= session::get('plist');
181     $plist= $tmp->info;
183     /* Handle posts */
184     if (isset($_POST['new_acl'])){
185       $this->dialogState= 'create';
186       $this->dialog= TRUE;
187       $this->currentIndex= count($this->gosaAclTemplate);
188       $this->loadAclEntry(TRUE);
189     }
191     $new_acl= array();
192     $aclDialog= FALSE;
193     $firstedit= FALSE;
194     foreach($_POST as $name => $post){
196       /* Actions... */
197       if (preg_match('/^acl_edit_.*_x/', $name)){
198         $this->dialogState= 'create';
199         $firstedit= TRUE;
200         $this->dialog= TRUE;
201         $this->currentIndex= preg_replace('/^acl_edit_([0-9]+).*$/', '\1', $name);
202         $this->loadAclEntry();
203         continue;
204       }
205       if (preg_match('/^acl_del_.*_x/', $name)){
206         unset($this->gosaAclTemplate[preg_replace('/^acl_del_([0-9]+).*$/', '\1', $name)]);
207         continue;
208       }
210       if (preg_match('/^cat_edit_.*_x/', $name)){
211         $this->aclObject= preg_replace('/^cat_edit_([^_]+)_.*$/', '\1', $name);
212         $this->dialogState= 'edit';
213         foreach ($this->ocMapping[$this->aclObject] as $oc){
214           if (isset($this->aclContents[$oc])){
215             $this->savedAclContents[$oc]= $this->aclContents[$oc];
216           }
217         }
218         continue;
219       }
220       if (preg_match('/^cat_del_.*_x/', $name)){
221         $idx= preg_replace('/^cat_del_([^_]+)_.*$/', '\1', $name);
222         foreach ($this->ocMapping[$idx] as $key){
223           unset($this->aclContents["$idx/$key"]);
224         }
225         continue;
226       }
228       /* Sorting... */
229       if (preg_match('/^sortup_.*_x/', $name)){
230         $index= preg_replace('/^sortup_([0-9]+).*$/', '\1', $name);
231         if ($index > 0){
232           $tmp= $this->gosaAclTemplate[$index];
233           $this->gosaAclTemplate[$index]= $this->gosaAclTemplate[$index-1];
234           $this->gosaAclTemplate[$index-1]= $tmp;
235         }
236         continue;
237       }
238       if (preg_match('/^sortdown_.*_x/', $name)){
239         $index= preg_replace('/^sortdown_([0-9]+).*$/', '\1', $name);
240         if ($index < count($this->gosaAclTemplate)-1){
241           $tmp= $this->gosaAclTemplate[$index];
242           $this->gosaAclTemplate[$index]= $this->gosaAclTemplate[$index+1];
243           $this->gosaAclTemplate[$index+1]= $tmp;
244         }
245         continue;
246       }
248       /* ACL saving... */
249       if (preg_match('/^acl_.*_[^xy]$/', $name)){
250         $aclDialog= TRUE;
251         list($dummy, $object, $attribute, $value)= split('_', $name);
253         /* Skip for detection entry */
254         if ($object == 'dummy') {
255           continue;
256         }
258         /* Ordinary ACL */
259         if (!isset($new_acl[$object])){
260           $new_acl[$object]= array();
261         }
262         if (isset($new_acl[$object][$attribute])){
263           $new_acl[$object][$attribute].= $value;
264         } else {
265           $new_acl[$object][$attribute]= $value;
266         }
267       }
268     }
269     
270     /* Only be interested in new acl's, if we're in the right _POST place */
271     if ($aclDialog && $this->aclObject != "" && is_array($this->ocMapping[$this->aclObject])){
273       foreach ($this->ocMapping[$this->aclObject] as $oc){
274         unset($this->aclContents[$oc]);
275         unset($this->aclContents[$this->aclObject.'/'.$oc]);
276         if (isset($new_acl[$oc])){
277           $this->aclContents[$oc]= $new_acl[$oc];
278         }
279         if (isset($new_acl[$this->aclObject.'/'.$oc])){
280           $this->aclContents[$this->aclObject.'/'.$oc]= $new_acl[$this->aclObject.'/'.$oc];
281         }
282       }
283     }
285     /* Save new acl in case of base edit mode */
286     if (1 == 0 && $this->aclType == 'base' && !$firstedit){
287       $this->aclContents= $new_acl;
288     }
290     /* Cancel new acl? */
291     if (isset($_POST['cancel_new_acl'])){
292       $this->dialogState= 'head';
293       $this->dialog= FALSE;
294       if ($this->wasNewEntry){
295         unset ($this->gosaAclTemplate[$this->currentIndex]);
296       }
297     }
299     /* Store ACL in main object? */
300     if (isset($_POST['submit_new_acl'])){
301       $this->gosaAclTemplate[$this->currentIndex]['type']= $this->aclType;
302       $this->gosaAclTemplate[$this->currentIndex]['members']= $this->recipients;
303       $this->gosaAclTemplate[$this->currentIndex]['acl']= $this->aclContents;
304       $this->dialogState= 'head';
305       $this->dialog= FALSE;
306     }
308     /* Cancel edit acl? */
309     if (isset($_POST['cancel_edit_acl'])){
310       $this->dialogState= 'create';
311       foreach ($this->ocMapping[$this->aclObject] as $oc){
312         if (isset($this->savedAclContents[$oc])){
313           $this->aclContents[$oc]= $this->savedAclContents[$oc];
314         }
315       }
316     }
318     /* Save edit acl? */
319     if (isset($_POST['submit_edit_acl'])){
320       $this->dialogState= 'create';
321     }
323     /* Add acl? */
324     if (isset($_POST['add_acl']) && $_POST['aclObject'] != ""){
325       $this->dialogState= 'edit';
326       $this->savedAclContents= array();
327       foreach ($this->ocMapping[$this->aclObject] as $oc){
328         if (isset($this->aclContents[$oc])){
329           $this->savedAclContents[$oc]= $this->aclContents[$oc];
330         }
331       }
332     }
334     /* Save common values */
335     foreach (array("aclType", "aclObject", "target") as $key){
336       if (isset($_POST[$key])){
337         $this->$key= validate($_POST[$key]);
338       }
339     }
341     /* Create templating instance */
342     $smarty= get_smarty();
344     $smarty->assign("bases", $this->get_allowed_bases());
345     $smarty->assign("base_select", $this->base);
347     $tmp = $this->plInfo();
348     foreach($tmp['plProvidedAcls'] as $name => $translation){
349       $smarty->assign($name."ACL",$this->getacl($name));
350     }
352     if ($this->dialogState == 'head'){
353       /* Draw list */
354       $aclList= new divSelectBox("aclList");
355       $aclList->SetHeight(350);
356       
357       /* Fill in entries */
358       foreach ($this->gosaAclTemplate as $key => $entry){
359         $field1= array("string" => $this->aclTypes[$entry['type']], "attach" => "style='width:100px'");
360         $field2= array("string" => $this->assembleAclSummary($entry));
361         $action= "<input type='image' name='sortup_$key' alt='up' title='"._("Up")."' src='images/lists/sort-up.png' align='top'>";
362         $action.= "<input type='image' name='sortdown_$key' alt='down' title='"._("Down")."' src='images/lists/sort-down.png'>";
363         $action.= "<input class='center' type='image' src='images/lists/edit.png' alt='"._("Edit")."' name='acl_edit_$key' title='".msgPool::editButton(_("ACL"))."'>";
364         $action.= "<input class='center' type='image' src='images/lists/trash.png' alt='"._("Delete")."' name='acl_del_$key' title='".msgPool::delButton(_("ACL"))."'>";
366         $field3= array("string" => $action, "attach" => "style='border-right:0px;width:50px;text-align:right;'");
367         $aclList->AddEntry(array($field1, $field2, $field3));
368       }
370       $smarty->assign("aclList", $aclList->DrawList());
371     }
373     if ($this->dialogState == 'create'){
374       /* Draw list */
375       $aclList= new divSelectBox("aclList");
376       $aclList->SetHeight(450);
378       /* Add settings for all categories to the (permanent) list */
379       foreach ($this->aclObjects as $section => $dsc){
380         $summary= "";
381         foreach($this->ocMapping[$section] as $oc){
382           if (isset($this->aclContents[$oc]) && count($this->aclContents[$oc]) && isset($this->aclContents[$oc][0]) &&
383               $this->aclContents[$oc][0] != ""){
385             $summary.= "$oc, ";
386             continue;
387           }
388           if (isset($this->aclContents["$section/$oc"]) && count($this->aclContents["$section/$oc"]) && isset($this->aclContents["$section/$oc"][0]) &&
389               $this->aclContents["$section/$oc"][0] != ""){
391             $summary.= "$oc, ";
392             continue;
393           }
394           if (isset($this->aclContents[$oc]) && !isset($this->aclContents[$oc][0]) && count($this->aclContents[$oc])){
395             $summary.= "$oc, ";
396           }
397         }
399         /* Set summary... */
400         if ($summary == ""){
401           $summary= '<i>'._("No ACL settings for this category").'</i>';
402         } else {
403           $summary= sprintf(_("ACL for these objects: %s"), preg_replace('/, $/', '', $summary));
404         }
406         $field1= array("string" => $dsc, "attach" => "style='width:140px'");
407         $field2= array("string" => $summary);
408         $action= "<input class='center' type='image' src='images/lists/edit.png' alt='"._("Edit")."' name='cat_edit_$section' title='"._("Edit category ACL")."'>";
409         $action.= "<input class='center' type='image' src='images/lists/trash.png' alt='"._("Delete")."' name='cat_del_$section' title='"._("Reset category ACL")."'>";
410         $field3= array("string" => $action, "attach" => "style='border-right:0px;width:50px'");
411         $aclList->AddEntry(array($field1, $field2, $field3));
412       }
414       $smarty->assign("aclList", $aclList->DrawList());
415       $smarty->assign("aclType", $this->aclType);
416       $smarty->assign("aclTypes", $this->aclTypes);
417       $smarty->assign("target", $this->target);
419       if ($this->aclType == 'base'){
420         $smarty->assign('aclSelector', $this->buildAclSelector($this->myAclObjects));
421       }
422     }
424     if ($this->dialogState == 'edit'){
425       $smarty->assign('headline', sprintf(_("Edit ACL for '%s', scope is '%s'"), $this->aclObjects[$this->aclObject], $this->aclTypes[$this->aclType]));
427       /* Collect objects for selected category */
428       foreach ($this->ocMapping[$this->aclObject] as $idx => $class){
429         if ($idx == 0){
430           continue;
431         }
432         $aclObjects[$this->aclObject.'/'.$class]= $plist[$class]['plDescription'];
433       }
434       if ($this->aclObject == 'all'){
435         $aclObjects['all']= _("All objects in current subtree");
436       }
437       $smarty->assign('aclSelector', $this->buildAclSelector($aclObjects));
438     }
440     /* Show main page */
441     $smarty->assign("dialogState", $this->dialogState);
443     /* Assign cn and decription if this is a role */
444     foreach(array("cn","description") as $name){
445       $smarty->assign($name,$this->$name);
446     }
447     return ($smarty->fetch (get_template_path('acl_role.tpl',dirname(__FILE__))));
448   }
450   function sort_by_priority($list)
451   {
452     $tmp= session::get('plist');
453     $plist= $tmp->info;
454     asort($plist);
455     $newSort = array();
457     foreach($list as $name => $translation){
458       $na  =  preg_replace("/^.*\//","",$name);
459       if (!isset($plist[$na]['plPriority'])){
460         $prio= 0;
461       } else {
462         $prio=  $plist[$na]['plPriority'] ;
463       }
465       $newSort[$name] = $prio;
466     }
468     asort($newSort);
470     $ret = array();
471     foreach($newSort as $name => $prio){
472       $ret[$name] = $list[$name];
473     }
474     return($ret);
475   }
477   function loadAclEntry($new= FALSE)
478   {
479     /* New entry gets presets... */
480     if ($new){
481       $this->aclType= 'sub';
482       $this->recipients= array();
483       $this->aclContents= array();
484     } else {
485       $acl= $this->gosaAclTemplate[$this->currentIndex];
486       $this->aclType= $acl['type'];
487       $this->recipients= $acl['members'];
488       $this->aclContents= $acl['acl'];
489     }
491     $this->wasNewEntry= $new;
492   }
495   function aclPostHandler()
496   {
497     if (isset($_POST['save_acl'])){
498       $this->save();
499       return TRUE;
500     }
502     return FALSE;
503   }
506   function save()
507   {
508     /* Assemble ACL's */
509     $tmp_acl= array();
510     foreach ($this->gosaAclTemplate as $prio => $entry){
511       $final= "";
512       $members= "";
513       if (isset($entry['members'])){
514         foreach ($entry['members'] as $key => $dummy){
515           $members.= base64_encode(preg_replace('/^.:/', '', $key)).',';
516         }
517       }
518       $final= $prio.":".$entry['type'].":".preg_replace('/,$/', '', $members);
520       /* ACL's if needed */
521       if ($entry['type'] != "reset" && $entry['type'] != "role"){
522         $acl= ":";
523         if (isset($entry['acl'])){
524           foreach ($entry['acl'] as $object => $contents){
526             /* Only save, if we've some contents in there... */
527             if (count($contents)){
528               $acl.= $object.";";
530               foreach($contents as $attr => $permission){
532                 /* First entry? Its the one for global settings... */
533                 if ($attr == '0'){
534                   $acl.= $permission;
535                 } else {
536                   $acl.= '#'.$attr.';'.$permission;
537                 }
539               }
540               $acl.= ',';
541             }
542             
543           }
544         }
545         $final.= preg_replace('/,$/', '', $acl);
546       }
548       $tmp_acl[]= $final;
549     } 
551     /* Call main method */
552     plugin::save();
554     /* Finally (re-)assign it... */
555     $this->attrs["gosaAclTemplate"]= $tmp_acl;
557     /* Remove acl from this entry if it is empty... */
558     if (!count($tmp_acl)){
559       /* Remove attribute */
560       if ($this->initially_was_account){
561         $this->attrs["gosaAclTempalte"]= array();
562       } else {
563         if (isset($this->attrs["gosaAclTemplate"])){
564           unset($this->attrs["gosaAclTemplate"]);
565         }
566       }
567     }
569     /* Do LDAP modifications */
570     $ldap= $this->config->get_ldap_link();
572     /* Check if object already exists */
573     $ldap->cat($this->dn);
574     if($ldap->count()){
575       $ldap->cd($this->dn);
576       $this->cleanup();
577       $ldap->modify ($this->attrs);
578       new log("modify","aclroles/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
579     }else{
580       $ldap->cd($this->config->current['BASE']);
581       $ldap->create_missing_trees(preg_replace("/^[^,]+,/","",$this->dn));
582       $ldap->cd($this->dn);
583       $ldap->add($this->attrs);
584       new log("create","aclroles/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
585     }
587     if (!$ldap->success()){
588       msg_dialog::display(_("LDAP error"), msgPool::ldaperror($ldap->get_error(), $this->dn, "", get_class()));
589     }
591     /* Refresh users ACL */
592     $ui= get_userinfo();
593     $ui->loadACL();
594     session::set('ui',$ui);
595   }
598   function remove_from_parent()
599   {
600     $ldap = $this->config->get_ldap_link();
601     $serach_for = "*:role:".base64_encode($this->dn).":*"; 
602     $ldap->search ("(&(objectClass=gosaACL)(gosaAclEntry=".$serach_for."))",array('dn','cn','sn','givenName','uid'));
603     $all_names = "";
606     $cnt = 3;
607     while(($attrs = $ldap->fetch()) && $cnt){
608       $name = $attrs['dn'];
609       $name = preg_replace("/[ ]/","&nbsp;",$name);
610       $name = "<i>'".$name."'</i>";
611       $all_names .= $name.", ";
612       $cnt --;
613     }
615     if(!empty($all_names)){
616       $all_names = preg_replace("/, $/","",$all_names);
617       if(!$cnt){
618         $all_names .= ", ...";
619       }
620       $all_names = "<span style='text-align:left;'>".$all_names."</span>";
621       msg_dialog::display(_("Object in use"), sprintf(_("This role cannot be removed while it is in use by these objects:")."<br><br>%s", $all_names), WARNING_DIALOG);
622       return;
623     }
624         
625     $ldap->rmDir($this->dn);
626     new log("remove","aclroles/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
627     if (!$ldap->success()){
628       msg_dialog::display(_("LDAP error"), msgPool::ldaperror($ldap->get_error(), $this->dn, "", get_class()));
629     }
631     /* Optionally execute a command after we're done */
632     $this->handle_post_events("remove");
634     /* Delete references to object groups */
635     $ldap->cd ($this->config->current['BASE']);
636     $ldap->search ("(&(objectClass=gosaGroupOfNames)(member=".LDAP::prepare4filter($this->dn)."))", array("cn"));
637     while ($ldap->fetch()){
638       $og= new ogroup($this->config, $ldap->getDN());
639       unset($og->member[$this->dn]);
640       $og->save ();
641       if (!$ldap->success()){
642         msg_dialog::display(_("LDAP error"), msgPool::ldaperror($ldap->get_error(), $og->dn, "", get_class()));
643       }
644     }
645   }
648   function save_object()
649   {
650     plugin::save_object();
651     if(isset($_POST['acl_role_posted'])){
652      
653       /* Get base selection */
654       if(isset($_POST['base'])){
655         $tmp = $this->get_allowed_bases();
656         if(isset($tmp[$_POST['base']])){
657           $this->base = $_POST['base'];
658         }
659       }
660     }
661   }
664   function saveCopyDialog()
665   {
666     if(isset($_POST['cn'])){
667       $this->cn = $_POST['cn'];
668     }
669   }
670   
672   function getCopyDialog()
673   {
674     $smarty = get_smarty();
675     $smarty->assign("cn",$this->cn);
676     $str = $smarty->fetch(get_template_path("paste_role.tpl",TRUE,dirname(__FILE__)));
677     $ret = array();
678     $ret['string'] = $str;
679     $ret['status'] = "";
680     return($ret);
681   }
683   
684   function PrepareForCopyPaste($source)
685   {
686     plugin::PrepareForCopyPaste($source);
687     
688     $source_o = new aclrole($this->config,$source['dn']);
689     $this->gosaAclTemplate = $source_o->gosaAclTemplate;
690   }
691   
693   /* Return plugin informations for acl handling  */
694   static function plInfo()
695   {
696     return (array(
697           "plShortName" => _("Role"),
698           "plDescription" => _("Access control roles"),
699           "plSelfModify"  => FALSE,
700           "plDepends"     => array(),
701           "plPriority"    => 0,
702           "plSection"     => array("admin"),
703           "plCategory"    => array("aclroles" => array("objectClass" => "gosaRole", "description" => _("Access control roles"))),
705           "plProvidedAcls"    => array(
706             "cn"                => _("Name"),
707             "base"              => _("Base"),
708             "description"       => _("Description"))
709         ));
710   }
712   function check()
713   {
714     $message = plugin::check();
716     if(empty($this->cn)){
717       $message[] = msgPool::required(_("Name"));
718     }
719    
720     if(!count($this->gosaAclTemplate)){
721       $message[] = msgPool::required(_("ACL"));
722     }
723  
724     /* Check if we are allowed to create or move this object
725      */
726     if($this->orig_dn == "new" && !$this->acl_is_createable($this->base)){
727       $message[] = msgPool::permCreate();
728     }elseif($this->orig_dn != "new" && $this->base != $this->orig_base && !$this->acl_is_moveable($this->base)){
729       $message[] = msgPool::permMove();
730     }
732     return($message);
733   }
737 // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
738 ?>