From 80d027d56954d23bfe14306e49c32e71ea47dc13 Mon Sep 17 00:00:00 2001 From: Deon George Date: Thu, 8 Sep 2011 22:30:35 +1000 Subject: [PATCH] SF Bug #3373466 - Unable to define force_may attributes --- config/config.php.example | 6 +++--- lib/ds_ldap.php | 7 ++----- lib/ds_ldap_pla.php | 8 +++++--- 3 files changed, 10 insertions(+), 11 deletions(-) diff --git a/config/config.php.example b/config/config.php.example index 95d2499..652c859 100644 --- a/config/config.php.example +++ b/config/config.php.example @@ -491,8 +491,8 @@ $servers->setValue('server','name','My LDAP Server'); server may automatically calculate a default value. In Fedora Directory Server using the DNA Plugin one could ignore uidNumber, gidNumber and sambaSID. */ -// $servers->setValue('force_may','attrs',array('')); -# $servers->setValue('force_may','attrs',array('uidNumber','gidNumber','sambaSID')); +// $servers->setValue('server','force_may',array('')); +# $servers->setValue('server','force_may',array('uidNumber','gidNumber','sambaSID')); /********************************************* * Unique attributes * @@ -564,6 +564,6 @@ $servers->setValue('login','timeout',30); $servers->setValue('server','branch_rename',false); $servers->setValue('server','custom_sys_attrs',array('passwordExpirationTime','passwordAllowChangeTime')); $servers->setValue('server','custom_attrs',array('nsRoleDN','nsRole','nsAccountLock')); -$servers->setValue('force_may','attrs',array('uidNumber','gidNumber','sambaSID')); +$servers->setValue('server','force_may',array('uidNumber','gidNumber','sambaSID')); */ ?> diff --git a/lib/ds_ldap.php b/lib/ds_ldap.php index d3bb8d4..493d0cb 100644 --- a/lib/ds_ldap.php +++ b/lib/ds_ldap.php @@ -19,8 +19,6 @@ class ldap extends DS { private $_schema_entries = null; # Schema DN private $_schemaDN = null; - # Attributes that should be treated as MAY attributes, even though the scheme has them as MUST attributes. - private $force_may = array(); public function __construct($index) { if (defined('DEBUG_ENABLED') && DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS')) @@ -1912,14 +1910,13 @@ class ldap extends DS { * This function determines if the specified attribute is contained in the force_may list * as configured in config.php. * - * @return boolean True if the specified attribute is in the $force_may list and false - * otherwise. + * @return boolean True if the specified attribute is configured to be force as a may attribute */ function isForceMay($attr_name) { if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS')) debug_log('Entered (%%)',17,0,__FILE__,__LINE__,__METHOD__,$fargs); - return in_array($attr_name,$this->force_may); + return in_array($attr_name,unserialize(strtolower(serialize($this->getValue('server','force_may'))))); } /** diff --git a/lib/ds_ldap_pla.php b/lib/ds_ldap_pla.php index fe2274b..879e37d 100644 --- a/lib/ds_ldap_pla.php +++ b/lib/ds_ldap_pla.php @@ -13,9 +13,6 @@ * @subpackage DataStore */ class ldap_pla extends ldap { - # Attributes that should be treated as MAY attributes, even though the scheme has them as MUST attributes. - private $force_may = array(); - function __construct($index) { parent::__construct($index); @@ -89,6 +86,11 @@ class ldap_pla extends ldap { '*' )); + $this->default->server['force_may'] = array( + 'desc'=>'Force server MUST attributes as MAY attributes', + 'default'=>array( + )); + # Settings for auto_number $this->default->auto_number['enable'] = array( 'desc'=>'Enable the AUTO UID feature',