From 4e03cab56f605a855f6b947b87fdac223ac77e8c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=B4me=20Chilliet?= <come.bernigaud@opensides.be> Date: Tue, 1 Mar 2016 12:30:07 +0100 Subject: [PATCH] Fixes #4529 The category in department and organization should be a dropdown filled from the configuration backend --- contrib/openldap/core-fd-conf.schema | 8 +++++++- plugins/admin/departments/class_department.inc | 11 ++++++++++- plugins/config/class_configInLdap.inc | 7 +++++++ 3 files changed, 24 insertions(+), 2 deletions(-) diff --git a/contrib/openldap/core-fd-conf.schema b/contrib/openldap/core-fd-conf.schema index d35e9e1f8..2b6939272 100644 --- a/contrib/openldap/core-fd-conf.schema +++ b/contrib/openldap/core-fd-conf.schema @@ -392,6 +392,12 @@ attributetype ( 1.3.6.1.4.1.38414.8.18.6 NAME 'fdAclTabOnObjects' SYNTAX 1.3.6.1.4.1.1466.115.121.1.7 SINGLE-VALUE ) +attributetype ( 1.3.6.1.4.1.38414.8.18.7 NAME 'fdDepartmentCategories' + DESC 'FusionDirectory - available categories for departments' + EQUALITY caseExactIA5Match + SUBSTR caseExactIA5SubstringsMatch + SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 ) + # Plugins attributetype ( 1.3.6.1.4.1.38414.8.19.1 NAME 'fdOGroupRDN' @@ -566,7 +572,7 @@ objectclass ( 1.3.6.1.4.1.38414.8.2.1 NAME 'fusionDirectoryConf' fdDisplayErrors $ fdLdapMaxQueryTime $ fdLdapStats $ fdDebugLevel $ fdEnableSnapshots $ fdSnapshotBase $ fdTabHook $ fdShells $ fdDisplayHookOutput $ - fdAclTabOnObjects $ + fdAclTabOnObjects $ fdDepartmentCategories $ fdRfc2307bis $ fdCopyPaste $ fdSnapshotURI $ fdSnapshotAdminDn $ fdSnapshotAdminPassword $ fdPersonalTitleInDN $ fdAccountRDN $ fdSslCaCertPath $ fdSslKeyPath $ fdSslCertPath $ diff --git a/plugins/admin/departments/class_department.inc b/plugins/admin/departments/class_department.inc index 52c64854c..a7d6d9fa3 100644 --- a/plugins/admin/departments/class_department.inc +++ b/plugins/admin/departments/class_department.inc @@ -73,7 +73,7 @@ class department extends simplePlugin _('Description'), sprintf(_('Short description of this %s'), $name), 'description', TRUE ), - new StringAttribute( + new SelectAttribute( _('Category'), sprintf(_('Category of this %s'), $name), 'businessCategory', FALSE ), @@ -141,6 +141,15 @@ class department extends simplePlugin parent::__construct($config, $dn, $object); + $categoriesList = $this->config->get_cfg_value('DepartmentCategories', array()); + + /* Insert current value to possibilities */ + $businessCategory = $this->attributesAccess['businessCategory']->getValue(); + if (($businessCategory != "") && !in_array($businessCategory, $categoriesList)) { + $categoriesList[] = $businessCategory; + } + $this->attributesAccess['businessCategory']->setChoices($categoriesList); + $this->attributesAccess[$this->getNamingAttr()]->setUnique(TRUE); } diff --git a/plugins/config/class_configInLdap.inc b/plugins/config/class_configInLdap.inc index e59cf87e8..f46e1c880 100644 --- a/plugins/config/class_configInLdap.inc +++ b/plugins/config/class_configInLdap.inc @@ -444,6 +444,13 @@ class configInLdap extends simplePlugin _('For very specific ACL rights setting where you might need to give right on a single object.'), 'fdAclTabOnObjects' ), + new SetAttribute( + new StringAttribute ( + _('Available department categories'), _('Available categories in the departments dropdown'), + 'fdDepartmentCategories', FALSE + ), + array() + ), ) ), ); -- GitLab