use type id in $allScopes

This commit is contained in:
Roland Gruber 2017-12-18 21:52:24 +01:00
parent 07b885a2ad
commit 854231d0e2
3 changed files with 15 additions and 4 deletions

View File

@ -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. * 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 $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 * @return mixed htmlElement or array of htmlElement
* *
* @see baseModule::get_metaData() * @see baseModule::get_metaData()

View File

@ -1,5 +1,6 @@
<?php <?php
use \LAM\TYPES\TypeManager; use \LAM\TYPES\TypeManager;
use function LAM\TYPES\getScopeFromTypeId;
/* /*
$Id$ $Id$
@ -586,8 +587,18 @@ class posixGroup extends baseModule implements passwordService {
$configContainer->add($magicNumber, 12); $configContainer->add($magicNumber, 12);
$configContainer->add(new htmlResponsiveInputField(_('Suffix for GID/group name check'), 'posixGroup_gidCheckSuffix', '', 'gidCheckSuffix'), 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); $configContainer->add(new htmlResponsiveInputCheckbox('posixGroup_hidememberUid', false, _('Disable membership management'), 'hidememberUid'), 12);
if ((!empty($allScopes['groupOfNames']) && in_array('group', $allScopes['groupOfNames'])) $gonModules = array('groupOfNames', 'groupOfUniqueNames');
|| (!empty($allScopes['groupOfUniqueNames']) && in_array('group', $allScopes['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); $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 // display password hash option only if posixAccount module is not used

View File

@ -134,7 +134,7 @@ $scopes = array();
foreach ($types as $type) { foreach ($types as $type) {
$mods = $conf->get_AccountModules($type->getId()); $mods = $conf->get_AccountModules($type->getId());
for ($i = 0; $i < sizeof($mods); $i++) { for ($i = 0; $i < sizeof($mods); $i++) {
$scopes[$mods[$i]][] = $type->getScope(); $scopes[$mods[$i]][] = $type->getId();
} }
} }