From 854231d0e2ca510998fe6fb959729e3c07f72c17 Mon Sep 17 00:00:00 2001 From: Roland Gruber Date: Mon, 18 Dec 2017 21:52:24 +0100 Subject: [PATCH] use type id in $allScopes --- lam/lib/baseModule.inc | 2 +- lam/lib/modules/posixGroup.inc | 15 +++++++++++++-- lam/templates/config/moduleSettings.php | 2 +- 3 files changed, 15 insertions(+), 4 deletions(-) diff --git a/lam/lib/baseModule.inc b/lam/lib/baseModule.inc index faecc7f0..936da685 100644 --- a/lam/lib/baseModule.inc +++ b/lam/lib/baseModule.inc @@ -638,7 +638,7 @@ abstract class baseModule { * We recommend to use the module name as prefix for them (e.g. posixAccount_homeDirectory) to avoid naming conflicts. * * @param array $scopes account types (user, group, host) - * @param array $allScopes list of all active account modules and their scopes (module => array(scopes)) + * @param array $allScopes list of all active account modules and their account type id (module => array(type id)) * @return mixed htmlElement or array of htmlElement * * @see baseModule::get_metaData() diff --git a/lam/lib/modules/posixGroup.inc b/lam/lib/modules/posixGroup.inc index 893a3247..dad0ef14 100644 --- a/lam/lib/modules/posixGroup.inc +++ b/lam/lib/modules/posixGroup.inc @@ -1,5 +1,6 @@ add($magicNumber, 12); $configContainer->add(new htmlResponsiveInputField(_('Suffix for GID/group name check'), 'posixGroup_gidCheckSuffix', '', 'gidCheckSuffix'), 12); $configContainer->add(new htmlResponsiveInputCheckbox('posixGroup_hidememberUid', false, _('Disable membership management'), 'hidememberUid'), 12); - if ((!empty($allScopes['groupOfNames']) && in_array('group', $allScopes['groupOfNames'])) - || (!empty($allScopes['groupOfUniqueNames']) && in_array('group', $allScopes['groupOfUniqueNames']))) { + $gonModules = array('groupOfNames', 'groupOfUniqueNames'); + $gonFound = false; + foreach ($gonModules as $gonModule) { + if (!empty($allScopes[$gonModule])) { + foreach ($allScopes[$gonModule] as $gonTypeId) { + if (getScopeFromTypeId($gonTypeId) === 'group') { + $gonFound = true; + } + } + } + } + if ($gonFound) { $configContainer->add(new htmlResponsiveInputCheckbox('posixGroup_autoSyncGon', false, _('Force sync with group of names'), 'autoSyncGon'), 12); } // display password hash option only if posixAccount module is not used diff --git a/lam/templates/config/moduleSettings.php b/lam/templates/config/moduleSettings.php index db554a7e..3a8998d9 100644 --- a/lam/templates/config/moduleSettings.php +++ b/lam/templates/config/moduleSettings.php @@ -134,7 +134,7 @@ $scopes = array(); foreach ($types as $type) { $mods = $conf->get_AccountModules($type->getId()); for ($i = 0; $i < sizeof($mods); $i++) { - $scopes[$mods[$i]][] = $type->getScope(); + $scopes[$mods[$i]][] = $type->getId(); } }