~ubuntu-branches/debian/jessie/phpldapadmin/jessie

« back to all changes in this revision

Viewing changes to lib/schema_functions.php

  • Committer: Bazaar Package Importer
  • Author(s): Fabio Tranchitella
  • Date: 2009-03-16 14:54:15 UTC
  • mfrom: (1.2.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20090316145415-7dsvj319dd02h83j
Tags: 1.1.0.6-1
* New upstream release. (Closes: #518578)
* debian/rules: removed "-m 644" from the dh_install call. (Closes: #518847)
* debian/postrm: remove config.php at purge time. (Closes: #519086)
* debian/patches/hungarian.dpatch: fixed a hungarian translation.
  (Closes: #505559)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
<?php
2
 
// $Header: /cvsroot/phpldapadmin/phpldapadmin/lib/schema_functions.php,v 1.92 2007/12/15 07:50:32 wurley Exp $
 
2
// $Header: /cvsroot/phpldapadmin/phpldapadmin/lib/schema_functions.php,v 1.92.2.1 2008/11/29 09:23:11 wurley Exp $
3
3
 
4
4
/**
5
5
 * Classes and functions for fetching and parsing schema from an LDAP server.
61
61
        var $must_attrs;
62
62
        # Arrays of attribute names that this objectClass allows, but does not require
63
63
        var $may_attrs;
 
64
        # Arrays of attribute names that this objectClass has been forced to MAY attrs, due to configuration
 
65
        var $force_may;
64
66
        # Boolean value indicating whether this objectClass is obsolete
65
67
        var $is_obsolete;
66
68
        # Array of objectClasses which inherit from this one (must be set at runtime explicitly by the caller)
76
78
                $this->sup_classes = array();
77
79
                $this->type = $ldapserver->schema_oclass_default;
78
80
                $this->must_attrs = array();
 
81
                $this->force_may = array();
79
82
                $this->may_attrs = array();
80
83
                $this->is_obsolete = false;
81
84
                $this->children_objectclasses = array();
265
268
 
266
269
                                        foreach ($attrs as $string) {
267
270
                                                $attr = new ObjectClass_ObjectClassAttribute($string,$this->name);
268
 
                                                array_push($this->must_attrs,$attr);
 
271
 
 
272
                                                if ($ldapserver->isForceMay($attr->name)) {
 
273
                                                        array_push($this->force_may,$attr);
 
274
                                                        array_push($this->may_attrs,$attr);
 
275
 
 
276
                                                } else
 
277
                                                        array_push($this->must_attrs,$attr);
269
278
                                        }
270
279
 
271
280
                                        if (DEBUG_ENABLED)
272
 
                                                debug_log('Case MUST returned (%s)',8,__FILE__,__LINE__,__METHOD__,$this->must_attrs);
 
281
                                                debug_log('Case MUST returned (%s) (%s)',8,__FILE__,__LINE__,__METHOD__,$this->must_attrs,$this->force_may);
273
282
                                        break;
274
283
 
275
284
                                case 'MAY':
304
313
                $this->description = preg_replace("/\'$/",'',$this->description);
305
314
 
306
315
                if (DEBUG_ENABLED)
307
 
                        debug_log('Returning () - NAME (%s), DESCRIPTION (%s), MUST (%s), MAY (%s)',9,__FILE__,__LINE__,__METHOD__,
308
 
                                $this->name,$this->description,$this->must_attrs,$this->may_attrs);
 
316
                        debug_log('Returning () - NAME (%s), DESCRIPTION (%s), MUST (%s), MAY (%s), FORCE MAY (%s)',9,__FILE__,__LINE__,__METHOD__,
 
317
                                $this->name,$this->description,$this->must_attrs,$this->may_attrs,$this->force_may);
309
318
        }
310
319
 
311
320
        /**
547
556
 
548
557
                $this->may_attrs = array_values(array_unique(array_merge($this->may_attrs,$new_may_attrs)));
549
558
        }
 
559
 
 
560
        /**
 
561
         * Determine if an array is listed in the force_may attrs
 
562
         */
 
563
        function isForceMay($attr) {
 
564
                foreach ($this->force_may as $forcemay)
 
565
                        if ($forcemay->getName() == $attr)
 
566
                                return true;
 
567
 
 
568
                return false;
 
569
        }
550
570
}
551
571
 
552
572
/**
628
648
        var $used_in_object_classes;
629
649
        # A list of object class names that require this attribute type.
630
650
        var $required_by_object_classes;
 
651
        # This attribute has been forced a MAY attribute by the configuration.
 
652
        var $forced_as_may;
631
653
 
632
654
        /**
633
655
         * Initialize the class' member variables
654
676
                $this->type = null;
655
677
                $this->used_in_object_classes = array();
656
678
                $this->required_by_object_classes = array();
 
679
                $this->forced_as_may = false;
657
680
        }
658
681
 
659
682
        /**
660
 
         * Creates a new AttributeType objcet from a raw LDAP AttributeType string.
 
683
         * Creates a new AttributeType object from a raw LDAP AttributeType string.
661
684
         */
662
685
        function AttributeType($raw_ldap_attr_string) {
663
686
                if (DEBUG_ENABLED)
1108
1131
        function getRequiredByObjectClasses() {
1109
1132
                return $this->required_by_object_classes;
1110
1133
        }
 
1134
 
 
1135
        /**
 
1136
         * This function will mark this attribute as a forced MAY attribute
 
1137
         */
 
1138
        function setForceMay() {
 
1139
                $this->forced_as_may = true;
 
1140
        }
1111
1141
}
1112
1142
 
1113
1143
/**