From 51bd60bd338ddb1e540d6dface6c4ef0a96ca69a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=B4me=20Chilliet?= <come@opensides.be> Date: Tue, 13 Jun 2017 12:12:42 +0200 Subject: [PATCH] Fixes #5587 Adding ACL categories for all objects that have templates enabled --- include/class_config.inc | 1 + include/class_template.inc | 20 +++++++++++++++++++- 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/include/class_config.inc b/include/class_config.inc index f54334346..5abea57a1 100644 --- a/include/class_config.inc +++ b/include/class_config.inc @@ -980,6 +980,7 @@ class config $this->data['OBJECTS'][$obj]['management'] = $class; if (isset($class::$skipTemplates) && ($class::$skipTemplates == FALSE)) { $this->data['OBJECTS'][$obj]['templateActive'] = TRUE; + $this->data['CATEGORIES'][$cat]['classes'][] = 'template'; } } } diff --git a/include/class_template.inc b/include/class_template.inc index c6ba99e99..20170011e 100644 --- a/include/class_template.inc +++ b/include/class_template.inc @@ -40,7 +40,8 @@ class template return array( 'plShortName' => _('Template'), 'plDescription' => _('Object template, used to create several objects with similar values'), - 'plCategory' => array('user'), + /* Categories for templates are computed in config class */ + 'plCategory' => array(), 'plProvidedAcls' => array( 'template_cn' => _('Template name') @@ -48,6 +49,23 @@ class template ); } + static function getTemplatedTypes() + { + $result = array(); + $types = objects::types(); + foreach ($types as $type) { + if (in_array($type, departmentManagement::getDepartmentTypes())) { + continue; + } + $infos = objects::infos($type); + if ($infos['templateActive']) { + $result[$type] = $infos['name']; + } + } + asort($result); + return $result; + } + function __construct($type, $dn, $targetdn = NULL) { $this->type = $type; -- GitLab