Code

Updated config registry
[gosa.git] / gosa-core / include / class_configRegistry.inc
1 <?php
3 class configRegistry{
5     public $config = NULL;
6     public $properties = array();
7     public $ldapStoredProperties = array(); 
8     public $fileStoredProperties = array(); 
9     public $classToName = array(); 
11     public $status = 'none';
13     // Excludes property values defined in ldap 
14     public $ignoreLdapProperties = FALSE;
16     // Contains all classes with plInfo
17     public $classesWithInfo = array();
18     public $pluginRequirements  = array();
19     public $categoryToClass  = array();
21     public $objectClasses = array();
23     public $detectedSchemaIssues = array();
24     public $schemaCheckFailed = FALSE;
25     public $schemaCheckFinished = FALSE;
26     public $pluginsDeactivated = array();
28     function __construct($config)
29     {
30         $this->config = &$config;
32         // Detect classes that have a plInfo method 
33         global $class_mapping;
34         foreach ($class_mapping as $cname => $path){
35             $cmethods = get_class_methods($cname);
36             if (is_array($cmethods) && in_array_ics('plInfo',$cmethods)){
38                 // Get plugin definitions
39                 $def = call_user_func(array($cname, 'plInfo'));;
41                 // Register Post Events (postmodfiy,postcreate,postremove,checkhook)
42                 if(count($def)){
43                     $this->classesWithInfo[$cname] = $def;
44                 }
45             }
46         }
48         // (Re)Load properties
49         $this->reload();
50     }
53     function validateSchemata($force = FALSE, $disableIncompatiblePlugins = FALSE)
54     {
55         // We can check the schemata only with a valid LDAP connection
56         if(empty($this->config->current['CONFIG'])){
57             return(TRUE); 
58         }
60         // Don't do things twice unless forced
61         if($this->schemaCheckFinished && !$force) return($this->schemaCheckFailed); 
63         // Prepare result array
64         $this->detectedSchemaIssues = array();
65         $this->detectedSchemaIssues['missing'] = array();
66         $this->detectedSchemaIssues['versionMismatch'] = array();
68         // Clear last results 
69         $this->pluginsDeactivated = array();
71         // Read objectClasses from ldap
72         if(!count($this->objectClasses)){
73             $ldap = $this->config->get_ldap_link();
74             $ldap->cd($this->config->current['BASE']);
75             $this->objectClasses = $ldap->get_objectclasses();
76         }
78         // Collect required schema infos
79         $this->pluginRequirements = array('ldapSchema' => array());
80         $this->categoryToClass = array();
81         foreach($this->classesWithInfo as $cname => $defs){
82             if(isset($defs['plRequirements'])){
83                 $this->pluginRequirements[$cname] = $defs['plRequirements'];
84             }
85         }
87         // Check schema requirements now        $missing = $invalid = array();
88         foreach($this->pluginRequirements as $cname => $requirements){
90             // Check LDAP schema requirements for this plugins
91             $failure = FALSE;
92             if(isset($requirements['ldapSchema'])){
93                 foreach($requirements['ldapSchema'] as $oc => $version){
94                     if(!$this->ocAvailable($oc)){
95                         $this->detectedSchemaIssues['missing'][] = $oc;
96                         $this->schemaCheckFailed = TRUE;
97                         $failure = TRUE;
98                     }elseif(!empty($version)){
99                         $currentVersion = $this->getObjectClassVersion($oc);
100                         if(!empty($currentVersion) && !$this->ocVersionMatch($version, $currentVersion)){
101                             if($currentVersion == -1){
102                                 $currentVersion = _("unknown");
103                             }
104                             $this->detectedSchemaIssues['versionMismatch'] = 
105                                 sprintf(_("%s has version %s but %s required!"), bold($oc),bold($currentVersion),bold($version));
106                             $this->schemaCheckFailed = TRUE;
107                             $failure = TRUE;
108                         }
109                     }
110                 }
111             }
113             // Display corresponding plugins now 
114             if($disableIncompatiblePlugins && $failure && isset($requirements['onFailureDisablePlugin'])){
115                 foreach($requirements['onFailureDisablePlugin'] as $name){
116                     $this->pluginsDeactivated[] = $name;
117                 } 
118             }
119         }
120         $this->schemaCheckFinished =TRUE;
121         return(!$this->schemaCheckFailed);
122     }
124         
125     function displayErrors()
126     {
127         if(count($this->detectedSchemaIssues['missing'])){
128             msg_dialog::display(_("Schema validation error"), 
129                     _("The following objectClasses are missing:").
130                     "<div class='scrollContainer' style='height:100px'>".
131                     msgPool::buildList($this->detectedSchemaIssues['missing']).
132                     "</div>",
133                     ERROR_DIALOG);
134         }    
135         if(count($this->detectedSchemaIssues['versionMismatch'])){
136             msg_dialog::display(_("Schema validation error"), 
137                     _("The following objectClasses do not match the version requirements:").
138                     "<div class='scrollContainer' style='height:100px'>".
139                     msgPool::buildList($this->detectedSchemaIssues['versionMismatch']).
140                     "</div>",
141                     ERROR_DIALOG);
142         }    
143     }
146     function ocVersionMatch($required, $installed)
147     {
148         $operator = preg_replace('/^([=<>]*).*$/',"\\1",$required);
149         $required = preg_replace('/^[=<>]*(.*)$/',"\\1",$required);
150         return(version_compare($installed,$required, $operator)); 
151     }
153     
154     function getObjectClassVersion($oc)
155     {
156         if(!isset($this->objectClasses[$oc])){
157             return(NULL);
158         }else{
159             $version = -1; // unknown
160             if(preg_match("/(v[^)]*)/", $this->objectClasses[$oc]['DESC'])){
161                 $version = preg_replace('/^.*\(v([^)]*)\).*$/',"\\1", $this->objectClasses[$oc]['DESC']);
162             }
163         }
164         return($version);
165     }
166     
168     // check wheter an objectClass is installed or not.
169     function ocAvailable($name)
170     {
171         return(isset($this->objectClasses[$name]));
172     }
175     function reload($force = FALSE)
176     {
177         // Do not reload the properties everytime, once we have  
178         //  everything loaded and registrered skip the reload.
179         // Status is 'finished' once we had a ldap connection (logged in)
180         if(!$force && $this->status == 'finished') return;
182         // Reset everything
183         $this->ldapStoredProperties = array();
184         $this->fileStoredProperties = array();
185         $this->properties = array();
186         $this->mapByName = array();
188         // Search for config flags defined in the config file (TAB section)
189         foreach($this->config->data['TABS'] as $tabname => $tabdefs){
190             foreach($tabdefs as $info){
192                 // Check if the info is valid
193                 if(isset($info['NAME']) && isset($info['CLASS'])){
195                     // Check if there is nore than just the plugin definition
196                     if(count($info) > 2){
197                         foreach($info as $name => $value){
198                             
199                             if(!in_array($name, array('CLASS','NAME'))){
200                                 $class= $info['CLASS'];    
201                                 $this->fileStoredProperties[$class][strtolower($name)] = $value;
202                             }
203                         }
204                     }
205                 }
206             }
207         }
209         // Search for config flags defined in the config file (MENU section)
210         foreach($this->config->data['MENU'] as $section => $entries){
211             foreach($entries as $entry){
212                 if(count($entry) > 2 && isset($entry['CLASS'])){
213                     $class = $entry['CLASS'];
214                     foreach($entry as $name => $value){
215                         if(!in_array($name, array('CLASS','ACL'))){
216                             $this->fileStoredProperties[strtolower($class)][strtolower($name)] = $value;
217                         }
218                     }
219                 }
220             }
221         }
223         // Search for config flags defined in the config file (MAIN section)
224         foreach($this->config->data['MAIN'] as $name => $value){
225             $this->fileStoredProperties['core'][strtolower($name)] = $value;
226         }
228         // Search for config flags defined in the config file (Current LOCATION section)
229         if(isset($this->config->current)){
230             foreach($this->config->current as $name => $value){
231                 $this->fileStoredProperties['core'][strtolower($name)] = $value;
232             }
233         }
235         // Skip searching for LDAP defined properties if 'ignoreLdapProperties' is set to 'true'
236         //  in the config. 
237         $this->ignoreLdapProperties = FALSE;
238         if(isset($this->fileStoredProperties['core'][strtolower('ignoreLdapProperties')]) && 
239             preg_match("/(true|on)/i", $this->fileStoredProperties['core'][strtolower('ignoreLdapProperties')])){
240             $this->ignoreLdapProperties = TRUE;
241         }
243         // Search for all config flags defined in the LDAP - BUT only if we ARE logged in. 
244         if(!empty($this->config->current['CONFIG'])){
245             $ldap = $this->config->get_ldap_link();
246             $ldap->cd($this->config->current['CONFIG']);
247             $ldap->search('(&(objectClass=gosaConfig)(gosaSetting=*))', array('cn','gosaSetting'));
248             while($attrs = $ldap->fetch()){
249                 $class = $attrs['cn'][0];
250                 for($i=0; $i<$attrs['gosaSetting']['count']; $i++){
251                     list($name,$value) = preg_split("/:/",$attrs['gosaSetting'][$i],2);
252                     $this->ldapStoredProperties[$class][$name] = $value;
253                 }
254             }
255             $this->status = 'finished';
256         }
258         // Register plugin properties.
259         foreach ($this->classesWithInfo as $cname => $def){
261             // Detect class name
262             $name = $cname;
263             $name = (isset($def['plShortName'])) ? $def['plShortName'] : $cname;
264             $name = (isset($def['plDescription'])) ? $def['plDescription'] : $cname;
266             // Register post events
267             $this->classToName[$cname] = $name;
268             $data = array('name' => 'postcreate','type' => 'command');
269             $this->register($cname, $data);    
270             $data = array('name' => 'postremove','type' => 'command');
271             $this->register($cname, $data);    
272             $data = array('name' => 'postmodify','type' => 'command');
273             $this->register($cname, $data);    
274             $data = array('name' => 'check', 'type' => 'command');
275             $this->register($cname, $data);    
277             // Register properties 
278             if(isset($def['plProperties'])){
279                 foreach($def['plProperties'] as $property){
280                     $this->register($cname, $property);
281                 }
282             }
283         }
284     }
286     function register($class,$data)
287     {
288         $id = count($this->properties);
289         $this->properties[$id] = new gosaProperty($this,$class,$data);
290         $p = strtolower("{$class}::{$data['name']}");
291         $this->mapByName[$p] = $id;
292     }
294     public function getAllProperties()
295     {
296         return($this->properties);
297     }
299     function propertyExists($class,$name)
300     {       
301         $p = strtolower("{$class}::{$name}");
302         return(isset($this->mapByName[$p]));
303     }
305     private function getId($class,$name)
306     {
307         $p = strtolower("{$class}::{$name}");
308         if(!isset($this->mapByName[$p])){
309             return(-1);
310         }       
311         return($this->mapByName[$p]);    
312     }
314     function getProperty($class,$name)
315     {
316         if($this->propertyExists($class,$name)){
317             return($this->properties[$this->getId($class,$name)]);
318         }
319         return(NULL); 
320     }
322     function getPropertyValue($class,$name)
323     {   
324         if($this->propertyExists($class,$name)){
325             $tmp = $this->getProperty($class,$name);
326             return($tmp->getValue());
327         }
328         return("");
329     }
331     function setPropertyValue($class,$name, $value)
332     {   
333         if($this->propertyExists($class,$name)){
334             $tmp = $this->getProperty($class,$name);
335             return($tmp->setValue($value));
336         }
337         return("");
338     }
340     function saveChanges()
341     {
342         $migrate = array();
343         foreach($this->properties as $prop){
345             // Is this property modified
346             if(in_array($prop->getStatus(),array('modified','removed'))){
348                 // Check if we've to migrate something before we can make the changes effective. 
349                 if($prop->migrationRequired()){
350                     $migrate[] = $prop;
351                 }else{
352                     $prop->save();
353                 }
354             }
355         }
356         return($migrate);
357     }
361 class gosaProperty
363     protected $name = "";
364     protected $class = "";
365     protected $value = "";
366     protected $tmp_value = "";  // Used when modified but not saved 
367     protected $type = "string";
368     protected $default = "";
369     protected $defaults = "";
370     protected $description = "";
371     protected $check = "";
372     protected $migrate = "";
373     protected $mandatory = FALSE;
374     protected $group = "default";
375     protected $parent = NULL;
376     protected $data = array();
378     protected $migrationClass = NULL;
380     /*!  The current property status
381      *     'ldap'       Property is stored in ldap 
382      *     'file'       Property is stored in the config file
383      *     'undefined'  Property is currently not stored anywhere
384      *     'modified'   Property has been modified (should be saved)
385      */
386     protected $status = 'undefined';
388     protected $attributes = array('name','type','default','description','check',
389             'migrate','mandatory','group','defaults');
394     function __construct($parent,$classname,$data)
395     {
396         // Set some basic infos 
397         $this->parent = &$parent;
398         $this->class = $classname;
399         $this->data  = $data;
401         // Get all relevant information from the data array (comes from plInfo)    
402         foreach($this->attributes as $aName){
403             if(isset($data[$aName])){
404                 $this->$aName = $data[$aName];
405             }
406         }      
408         // Initialize with the current value
409         $this->_restoreCurrentValue(); 
411     }
413     function migrationRequired()
414     {
415         // Instantiate migration class 
416         if(!empty($this->migrate) && $this->migrationClass == NULL){
417             if(!class_available($this->migrate)){
418                 trigger_error("Cannot start migration for gosaProperty::'{$this->getName()}' class not found ({$this->migrate})!");
419             }else{
420                 $class = $this->migrate;
421                 $tmp = new $class($this->parent->config,$this);
422                 if(! $tmp instanceof propertyMigration){ 
423                     trigger_error("Cannot start migration for gosaProperty::'{$this->getName()}' doesn't implement propertyMigration!");
424                 }else{
425                     $this->migrationClass = $tmp;
426                 }
427             }
428         }
429         if(empty($this->migrate) || $this->migrationClass == NULL){
430             return(FALSE);
431         }
432         return($this->migrationClass->checkForIssues());
433     }
435     function getMigrationClass()
436     {
437         return($this->migrationClass);
438     }
440     function check()
441     {
442         $val = $this->getValue(TRUE);
443         $return = TRUE;
444         if($this->mandatory && empty($val)){
445             $return = FALSE;
446         }
448         $check = $this->getCheck();
449         if(!empty($val) && !empty($check)){
450             $res = call_user_func(preg_split("/::/", $this->check),$messages=TRUE, $this->class,$this->name,$val, $this->type);
451             if(!$res){
452                 $return = FALSE;
453             }
454         }
455         return($return);
456     }
458     static function isBool($message,$class,$name,$value, $type)
459     {
460         $match = in_array($value,array('true','false',''));
462         // Display the reason for failing this check.         
463         if($message && ! $match){
464             msg_dialog::display(_("Warning"), 
465                     sprintf(_("The value '%s' specified for '%s:%s' is invalid. A bool value is required here!"), 
466                         bold($value),bold($class),bold($name)), 
467                     WARNING_DIALOG);
468         }
469     
470         return($match);
471     }
473     static function isString($message,$class,$name,$value, $type)
474     {
475         $match = TRUE;
476     
477         // Display the reason for failing this check.         
478         if($message && ! $match){
479             msg_dialog::display(_("Warning"), 
480                     sprintf(_("The value '%s' specified for '%s:%s' is invalid. A string value is required here!"), 
481                         bold($value),bold($class),bold($name)), 
482                     WARNING_DIALOG);
483         }
485         return($match);
486     }
488     static function isInteger($message,$class,$name,$value, $type)
489     {
490         $match = is_numeric($value) && !preg_match("/[^0-9]/", $value);
492         // Display the reason for failing this check.         
493         if($message && ! $match){
494             msg_dialog::display(_("Warning"), 
495                     sprintf(_("The value '%s' specified for '%s:%s' is invalid. A numeric value is required here!"), 
496                         bold($value),bold($class),bold($name)), 
497                     WARNING_DIALOG);
498         }
500         return($match);
501     }
503     static function isPath($message,$class,$name,$value, $type)
504     {
505         $match = preg_match("#^(/[^/]*/){1}#", $value);
506     
507         // Display the reason for failing this check.         
508         if($message && ! $match){
509             msg_dialog::display(_("Warning"), 
510                     sprintf(_("The path '%s' specified for '%s:%s' is invalid!"), 
511                         bold($value),bold($class),bold($name)), 
512                     WARNING_DIALOG);
513         }
515         return($match);
516     }
518     static function isReadablePath($message,$class,$name,$value, $type)
519     {
520         $match = !empty($value)&&is_dir($value)&&is_writeable($value);
521    
522         // Display the reason for failing this check.         
523         if($message && ! $match){
524             if(!is_dir($value)){
525                 msg_dialog::display(_("Warning"), 
526                         sprintf(_("The folder '%s' specified for '%s:%s' does not exists!"), 
527                             bold($value),bold($class),bold($name)), 
528                         WARNING_DIALOG);
529             }elseif(!is_readable($value)){
530                 msg_dialog::display(_("Warning"), 
531                         sprintf(_("The folder '%s' specified for '%s:%s' cannot be used for reading!"), 
532                             bold($value),bold($class),bold($name)), 
533                         WARNING_DIALOG);
534             }
535         }
537         return($match);
538     }
540     static function isWriteablePath($message,$class,$name,$value, $type)
541     {
542         $match = !empty($value)&&is_dir($value)&&is_writeable($value);
543    
544         // Display the reason for failing this check.         
545         if($message && ! $match){
546             if(!is_dir($value)){
547                 msg_dialog::display(_("Warning"), 
548                         sprintf(_("The folder '%s' specified for '%s:%s' does not exists!"), 
549                             bold($value),bold($class),bold($name)), 
550                         WARNING_DIALOG);
551             }elseif(!is_writeable($value)){
552                 msg_dialog::display(_("Warning"), 
553                         sprintf(_("The folder '%s' specified for '%s:%s' cannot be used for writing!"), 
554                             bold($value),bold($class),bold($name)), 
555                         WARNING_DIALOG);
556             }
557         }
559         return($match);
560     }
562     static function isReadableFile($message,$class,$name,$value, $type)
563     {
564         $match = !empty($value) && is_readable($value) && is_file($value);
566         // Display the reason for failing this check.         
567         if($message && ! $match){
568                 
569             if(!is_file($value)){
570                 msg_dialog::display(_("Warning"), 
571                         sprintf(_("The file '%s' specified for '%s:%s' does not exists!"), 
572                             bold($value),bold($class),bold($name)), 
573                         WARNING_DIALOG);
574             }elseif(!is_readable($value)){
575                 msg_dialog::display(_("Warning"), 
576                         sprintf(_("The file '%s' specified for '%s:%s' cannot be read!"), 
577                             bold($value),bold($class),bold($name)), 
578                         WARNING_DIALOG);
579             }
580         }
582         return($match);
583     }
585     static function isCommand($message,$class,$name,$value, $type)
586     {
587         $match = TRUE;
589         // Display the reason for failing this check.         
590         if($message && ! $match){
591             msg_dialog::display(_("Warning"), 
592                     sprintf(_("The command '%s' specified for '%s:%s' is invalid!"), 
593                         bold($value),bold($class),bold($name)), 
594                     WARNING_DIALOG);
595         }
596         
597         return($match);
598     }
600     static function isDn($message,$class,$name,$value, $type)
601     {
602         $match = preg_match("/^([a-z]*=[^=,]*,)*[^=]*=[^=]*$/i", $value);
604         // Display the reason for failing this check.         
605         if($message && ! $match){
606             msg_dialog::display(_("Warning"), 
607                     sprintf(_("The dn '%s' specified for '%s:%s' is invalid!"), 
608                         bold($value),bold($class),bold($name)), 
609                     WARNING_DIALOG);
610         }
611         
612         return($match);
613     }
615     static function isRdn($message,$class,$name,$value, $type)
616     {
617         $match = preg_match("/^([a-z]*=[^=,]*,)*[^=]*=[^=,]*,?$/i", $value);
619         // Display the reason for failing this check.         
620         if($message && ! $match){
621             msg_dialog::display(_("Warning"), 
622                     sprintf(_("The rdn '%s' specified for '%s:%s' is invalid!"), 
623                         bold($value),bold($class),bold($name)), 
624                     WARNING_DIALOG);
625         }
626         
627         return($match);
628     }
630     private function _restoreCurrentValue()
631     {
632         // First check for values in the LDAP Database.
633         if(isset($this->parent->ldapStoredProperties[$this->class][$this->name])){
634             $this->setStatus('ldap');
635             $this->value = $this->parent->ldapStoredProperties[$this->class][$this->name];
636             return;
637         }
639         // Second check for values in the config file.
640         if(isset($this->parent->fileStoredProperties[strtolower($this->class)][strtolower($this->name)])){
641             $this->setStatus('file');
642             $this->value = $this->parent->fileStoredProperties[strtolower($this->class)][strtolower($this->name)];
643             return;
644         }
646         // If there still wasn't found anything then fallback to the default.
647         if($this->getStatus() == 'undefined'){
648             $this->value = $this->getDefault();
649         }
650     }
652     function getMigrate() { return($this->migrate); }
653     function getCheck() { return($this->check); }
654     function getName() { return($this->name); }
655     function getClass() { return($this->class); }
656     function getGroup() { return($this->group); }
657     function getType() { return($this->type); }
658     function getDescription() { return($this->description); }
659     function getDefault() { return($this->default); }
660     function getDefaults() { return($this->defaults); }
661     function getStatus() { return($this->status); }
662     function isMandatory() { return($this->mandatory); }
664     function setValue($str) 
665     {
666         if(in_array($this->getStatus(), array('modified'))){
667             $this->tmp_value = $str; 
668         }elseif($this->value != $str){
669             $this->setStatus('modified'); 
670             $this->tmp_value = $str; 
671         }
672     }
674     function getValue($temporary = FALSE) 
675     { 
676         if($temporary){
677             if(in_array($this->getStatus(), array('modified','removed'))){
678                 return($this->tmp_value); 
679             }else{
680                 return($this->value); 
681             }
682         }else{ 
684             // Do not return ldap values if we've to ignore them.
685             if($this->parent->ignoreLdapProperties){
686                 if(isset($this->parent->fileStoredProperties[strtolower($this->class)][strtolower($this->name)])){
687                     return($this->parent->fileStoredProperties[strtolower($this->class)][strtolower($this->name)]);
688                 }else{
689                     return($this->getDefault());
690                 }
691             }else{
692                 return($this->value); 
693             }
694         }
695     }
697     function restoreDefault() 
698     {
699         if(in_array($this->getStatus(),array('ldap'))){
700             $this->setStatus('removed'); 
702             // Second check for values in the config file.
703             if(isset($this->parent->fileStoredProperties[strtolower($this->class)][strtolower($this->name)])){
704                 $this->tmp_value = $this->parent->fileStoredProperties[strtolower($this->class)][strtolower($this->name)];
705             }else{
706                 $this->tmp_value = $this->getDefault();
707             }
708         }
709     }
711     function save()
712     {
713         if($this->getStatus() == 'modified'){
714             $ldap = $this->parent->config->get_ldap_link();
715             $ldap->cd($this->parent->config->current['BASE']);
716             $dn = "cn={$this->class},".$this->parent->config->current['CONFIG'];
717             $ldap->cat($dn);
718             if(!$ldap->count()){
719                 $ldap->cd($dn);
720                 $data = array(
721                         'cn' => $this->class, 
722                         'objectClass' => array('top','gosaConfig'),
723                         'gosaSetting' => $this->name.":".$this->tmp_value);
725                 $ldap->add($data);
726                 if(!$ldap->success()){
727                     echo $ldap->get_error();
728                 }
730             }else{
731                 $attrs = $ldap->fetch();
732                 $data = array();
733                 $found = false;
734                 if(isset($attrs['gosaSetting']['count'])){
735                     for($i = 0;$i<$attrs['gosaSetting']['count']; $i ++){
736                         $set = $attrs['gosaSetting'][$i];
737                         if(preg_match("/^{$this->name}:/", $set)){
738                             $set = "{$this->name}:{$this->tmp_value}";
739                             $found = true;
740                         }
741                         $data['gosaSetting'][] = $set;
742                     }
743                 }
744                 if(!$found) $data['gosaSetting'][] = "{$this->name}:{$this->tmp_value}";
745                 $ldap->cd($dn);
746                 $ldap->modify($data);
747                 if(!$ldap->success()){
748                     echo $ldap->get_error();
749                 }
750             }
751             $this->value = $this->tmp_value;
752             $this->setStatus('ldap'); 
753         }elseif($this->getStatus() == 'removed'){
754             $ldap = $this->parent->config->get_ldap_link();
755             $ldap->cd($this->parent->config->current['BASE']);
756             $dn = "cn={$this->class},".$this->parent->config->current['CONFIG'];
757             $ldap->cat($dn);
758             $attrs = $ldap->fetch();
759             $data = array('gosaSetting' => array());
760             for($i = 0;$i<$attrs['gosaSetting']['count']; $i ++){
761                 $set = $attrs['gosaSetting'][$i];
762                 if(preg_match("/^{$this->name}:/", $set)){
763                     continue;
764                 }
765                 $data['gosaSetting'][] = $set;
766             }
767             $ldap->cd($dn);
768             $ldap->modify($data);
769             if(!$ldap->success()){
770                 echo $ldap->get_error();
771             }
772             $this->_restoreCurrentValue();
773         }
774     }
776     private function setStatus($state) 
777     {
778         if(!in_array($state, array('ldap','file','undefined','modified','removed'))) {
779             trigger_error("Unknown property status given '{$state}' for {$this->class}:{$this->name}!");
780         }else{
781             $this->status = $state; 
782         }
783     }
785     function isValid() 
786     { 
787         return(TRUE);    
788     }
793 interface propertyMigration
795     function __construct($config,$property);
799 ?>