support magic numbers for UID/GID
This commit is contained in:
parent
25f546e100
commit
75a239f10b
|
@ -209,102 +209,6 @@ class posixAccount extends baseModule implements passwordService {
|
|||
'posixAccount_homeDirectory' => $this->getHomedirAttrName(),
|
||||
'posixAccount_loginShell' => 'loginShell'
|
||||
);
|
||||
// configuration options
|
||||
$configUserContainer = new htmlTable();
|
||||
$configUserContainer->addElement(new htmlSubTitle(_("Users")), true);
|
||||
$generatorOptions = array(
|
||||
_('Fixed range') => 'range',
|
||||
_('Samba ID pool') => 'sambaPool',
|
||||
_('Windows domain info') => 'windowsDomain'
|
||||
);
|
||||
$uidGeneratorSelect = new htmlTableExtendedSelect('posixAccount_uidGeneratorUsers', $generatorOptions, array('range'), _('UID generator'), 'uidGenerator');
|
||||
$uidGeneratorSelect->setHasDescriptiveElements(true);
|
||||
$uidGeneratorSelect->setTableRowsToHide(array(
|
||||
'range' => array('posixAccount_sambaIDPoolDNUsers', 'posixAccount_windowsIDPoolDNUsers'),
|
||||
'sambaPool' => array('posixAccount_minUID', 'posixAccount_maxUID', 'posixAccount_windowsIDPoolDNUsers'),
|
||||
'windowsDomain' => array('posixAccount_minUID', 'posixAccount_maxUID', 'posixAccount_sambaIDPoolDNUsers')
|
||||
));
|
||||
$uidGeneratorSelect->setTableRowsToShow(array(
|
||||
'range' => array('posixAccount_minUID', 'posixAccount_maxUID'),
|
||||
'sambaPool' => array('posixAccount_sambaIDPoolDNUsers'),
|
||||
'windowsDomain' => array('posixAccount_windowsIDPoolDNUsers')
|
||||
));
|
||||
$configUserContainer->addElement($uidGeneratorSelect, true);
|
||||
$uidUsersGeneratorDN = new htmlTableExtendedInputField(_('Samba ID pool DN'), 'posixAccount_sambaIDPoolDNUsers', null, 'sambaIDPoolDN');
|
||||
$uidUsersGeneratorDN->setRequired(true);
|
||||
$configUserContainer->addElement($uidUsersGeneratorDN, true);
|
||||
$uidUsersGeneratorWinDN = new htmlTableExtendedInputField(_('Windows domain info DN'), 'posixAccount_windowsIDPoolDNUsers', null, 'windowsIDPoolDN');
|
||||
$uidUsersGeneratorWinDN->setRequired(true);
|
||||
$configUserContainer->addElement($uidUsersGeneratorWinDN, true);
|
||||
$minUid = new htmlTableExtendedInputField(_('Minimum UID number'), 'posixAccount_minUID', null, 'minMaxUser');
|
||||
$minUid->setRequired(true);
|
||||
$configUserContainer->addElement($minUid, true);
|
||||
$maxUid = new htmlTableExtendedInputField(_('Maximum UID number'), 'posixAccount_maxUID', null, 'minMaxUser');
|
||||
$maxUid->setRequired(true);
|
||||
$configUserContainer->addElement($maxUid, true);
|
||||
$configUserContainer->addElement(new htmlTableExtendedInputField(_('Suffix for UID/user name check'), 'posixAccount_uidCheckSuffixUser', '', 'uidCheckSuffix'), true);
|
||||
$return['config_options']['user'] = $configUserContainer;
|
||||
$configHostContainer = new htmlTable();
|
||||
$configHostContainer->addElement(new htmlSubTitle(_("Hosts")), true);
|
||||
$uidHostGeneratorSelect = new htmlTableExtendedSelect('posixAccount_uidGeneratorHosts', $generatorOptions, array('range'), _('UID generator'), 'uidGenerator');
|
||||
$uidHostGeneratorSelect->setHasDescriptiveElements(true);
|
||||
$uidHostGeneratorSelect->setTableRowsToHide(array(
|
||||
'range' => array('posixAccount_sambaIDPoolDNHosts', 'posixAccount_windowsIDPoolDNHosts'),
|
||||
'sambaPool' => array('posixAccount_minMachine', 'posixAccount_maxMachine', 'posixAccount_windowsIDPoolDNHosts'),
|
||||
'windowsDomain' => array('posixAccount_minMachine', 'posixAccount_maxMachine', 'posixAccount_sambaIDPoolDNHosts')
|
||||
));
|
||||
$uidHostGeneratorSelect->setTableRowsToShow(array(
|
||||
'range' => array('posixAccount_minMachine', 'posixAccount_maxMachine'),
|
||||
'sambaPool' => array('posixAccount_sambaIDPoolDNHosts'),
|
||||
'windowsDomain' => array('posixAccount_windowsIDPoolDNHosts')
|
||||
));
|
||||
$configHostContainer->addElement($uidHostGeneratorSelect, true);
|
||||
$uidHostsGeneratorDN = new htmlTableExtendedInputField(_('Samba ID pool DN'), 'posixAccount_sambaIDPoolDNHosts', null, 'sambaIDPoolDN');
|
||||
$uidHostsGeneratorDN->setRequired(true);
|
||||
$configHostContainer->addElement($uidHostsGeneratorDN, true);
|
||||
$uidHostsGeneratorWinDN = new htmlTableExtendedInputField(_('Windows domain info DN'), 'posixAccount_windowsIDPoolDNHosts', null, 'windowsIDPoolDN');
|
||||
$uidHostsGeneratorWinDN->setRequired(true);
|
||||
$configHostContainer->addElement($uidHostsGeneratorWinDN, true);
|
||||
$minUid = new htmlTableExtendedInputField(_('Minimum UID number'), 'posixAccount_minMachine', null, 'minMaxHost');
|
||||
$minUid->setRequired(true);
|
||||
$configHostContainer->addElement($minUid, true);
|
||||
$maxUid = new htmlTableExtendedInputField(_('Maximum UID number'), 'posixAccount_maxMachine', null, 'minMaxHost');
|
||||
$maxUid->setRequired(true);
|
||||
$configHostContainer->addElement($maxUid, true);
|
||||
$configHostContainer->addElement(new htmlTableExtendedInputField(_('Suffix for UID/user name check'), 'posixAccount_uidCheckSuffixHost', '', 'uidCheckSuffix'), true);
|
||||
$return['config_options']['host'] = $configHostContainer;
|
||||
$configOptionsContainer = new htmlTable();
|
||||
$configOptionsContainer->addElement(new htmlSubTitle(_('Options')), true);
|
||||
$configOptionsContainer->addElement(new htmlTableExtendedSelect('posixAccount_pwdHash', getSupportedHashTypes(),
|
||||
array('SSHA'), _("Password hash type"), 'pwdHash'), true);
|
||||
$configOptionsContainer->addElement(new htmlTableExtendedInputTextarea('posixAccount_shells', implode("\r\n", $this->getShells()), 30, 4, _('Login shells'), 'loginShells'), true);
|
||||
$hiddenOptionsContainer = new htmlGroup();
|
||||
$hiddenOptionsContainer->colspan = 5;
|
||||
$hiddenOptionsContainerHead = new htmlTable();
|
||||
$hiddenOptionsContainerHead->addElement(new htmlOutputText(_('Hidden options')));
|
||||
$hiddenOptionsContainerHead->addElement(new htmlHelpLink('hiddenOptions'));
|
||||
$hiddenOptionsContainer->addElement($hiddenOptionsContainerHead);
|
||||
$configContainerOptions = new htmlTable();
|
||||
$configContainerOptions->addElement(new htmlTableExtendedInputCheckbox('posixAccount_hidegecos', false, _('Gecos'), null, false));
|
||||
if (isset($_SESSION['conf_config'])) {
|
||||
$confActiveGONModules = array_merge($_SESSION['conf_config']->get_AccountModules('group'), $_SESSION['conf_config']->get_AccountModules('gon'));
|
||||
if (in_array('groupOfNames', $confActiveGONModules) || in_array('groupOfMembers', $confActiveGONModules) || in_array('groupOfUniqueNames', $confActiveGONModules)) {
|
||||
$configContainerOptions->addElement(new htmlOutputText(' '));
|
||||
$configContainerOptions->addElement(new htmlTableExtendedInputCheckbox('posixAccount_hidegon', false, _('Groups of names'), null, false));
|
||||
$configContainerOptions->addElement(new htmlOutputText(' '));
|
||||
$configContainerOptions->addElement(new htmlTableExtendedInputCheckbox('posixAccount_hideposixGroups', false, _('Unix groups'), null, false));
|
||||
}
|
||||
}
|
||||
$hiddenOptionsContainer->addElement($configContainerOptions);
|
||||
$configOptionsContainer->addElement($hiddenOptionsContainer, true);
|
||||
$advancedOptions = new htmlTable();
|
||||
$advancedOptions->addElement(new htmlTableExtendedInputCheckbox('posixAccount_primaryGroupAsSecondary', false, _('Set primary group as memberUid'), 'primaryGroupAsSecondary'), true);
|
||||
$advancedOptions->addElement(new htmlTableExtendedInputField(_('User name suggestion'), 'posixAccount_userNameSuggestion', '@givenname@%sn%', 'userNameSuggestion'));
|
||||
$advancedOptionsAccordion = new htmlAccordion('posixAccountAdvancedOptions', array(_('Advanced options') => $advancedOptions), false);
|
||||
$advancedOptionsAccordion->colspan = 5;
|
||||
$configOptionsContainer->addElement($advancedOptionsAccordion);
|
||||
|
||||
$return['config_options']['all'] = $configOptionsContainer;
|
||||
// upload
|
||||
$return['upload_preDepends'] = array('inetOrgPerson');
|
||||
// user specific upload options
|
||||
|
@ -529,6 +433,7 @@ class posixAccount extends baseModule implements passwordService {
|
|||
'uidGenerator' => array (
|
||||
"Headline" => _("UID generator"),
|
||||
"Text" => _("LAM will automatically suggest UID/GID numbers. You can either use a fixed range of numbers or an LDAP entry with object class \"sambaUnixIdPool\" or \"msSFU30DomainInfo\".")
|
||||
. ' ' . _('Magic number will set a fixed value that must match your server configuration.')
|
||||
),
|
||||
'sambaIDPoolDN' => array (
|
||||
"Headline" => _("Samba ID pool DN"),
|
||||
|
@ -538,6 +443,10 @@ class posixAccount extends baseModule implements passwordService {
|
|||
"Headline" => _("Windows domain info DN"),
|
||||
"Text" => _("Please enter the DN of the LDAP entry with object class \"msSFU30DomainInfo\".")
|
||||
),
|
||||
'magicNumber' => array(
|
||||
"Headline" => _("Magic number"),
|
||||
"Text" => _("Please enter the magic number you configured on server side.")
|
||||
),
|
||||
'user' => array(
|
||||
'uid' => array(
|
||||
"Headline" => _("User name"), 'attr' => 'uid',
|
||||
|
@ -1956,6 +1865,131 @@ class posixAccount extends baseModule implements passwordService {
|
|||
return $return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a list of elements for the configuration.
|
||||
*
|
||||
* @param array $scopes account types (user, group, host)
|
||||
* @param array $allScopes list of all modules and active scopes
|
||||
* @return array configuration elements
|
||||
*/
|
||||
function get_configOptions($scopes, $allScopes) {
|
||||
$return = array();
|
||||
if (in_array('user', $scopes)) {
|
||||
// user options
|
||||
$configUserContainer = new htmlTable();
|
||||
$configUserContainer->addElement(new htmlSubTitle(_("Users")), true);
|
||||
$generatorOptions = array(
|
||||
_('Fixed range') => 'range',
|
||||
_('Samba ID pool') => 'sambaPool',
|
||||
_('Windows domain info') => 'windowsDomain',
|
||||
_('Magic number') => 'magicNumber'
|
||||
);
|
||||
$uidGeneratorSelect = new htmlTableExtendedSelect('posixAccount_uidGeneratorUsers', $generatorOptions, array('range'), _('UID generator'), 'uidGenerator');
|
||||
$uidGeneratorSelect->setHasDescriptiveElements(true);
|
||||
$uidGeneratorSelect->setTableRowsToHide(array(
|
||||
'range' => array('posixAccount_sambaIDPoolDNUsers', 'posixAccount_windowsIDPoolDNUsers', 'posixAccount_magicNumberUser'),
|
||||
'sambaPool' => array('posixAccount_minUID', 'posixAccount_maxUID', 'posixAccount_windowsIDPoolDNUsers', 'posixAccount_magicNumberUser'),
|
||||
'windowsDomain' => array('posixAccount_minUID', 'posixAccount_maxUID', 'posixAccount_sambaIDPoolDNUsers', 'posixAccount_magicNumberUser'),
|
||||
'magicNumber' => array('posixAccount_minUID', 'posixAccount_maxUID', 'posixAccount_windowsIDPoolDNUsers', 'posixAccount_sambaIDPoolDNUsers')
|
||||
));
|
||||
$uidGeneratorSelect->setTableRowsToShow(array(
|
||||
'range' => array('posixAccount_minUID', 'posixAccount_maxUID'),
|
||||
'sambaPool' => array('posixAccount_sambaIDPoolDNUsers'),
|
||||
'windowsDomain' => array('posixAccount_windowsIDPoolDNUsers'),
|
||||
'magicNumber' => array('posixAccount_magicNumberUser')
|
||||
));
|
||||
$configUserContainer->addElement($uidGeneratorSelect, true);
|
||||
$uidUsersGeneratorDN = new htmlTableExtendedInputField(_('Samba ID pool DN'), 'posixAccount_sambaIDPoolDNUsers', null, 'sambaIDPoolDN');
|
||||
$uidUsersGeneratorDN->setRequired(true);
|
||||
$configUserContainer->addElement($uidUsersGeneratorDN, true);
|
||||
$uidUsersGeneratorWinDN = new htmlTableExtendedInputField(_('Windows domain info DN'), 'posixAccount_windowsIDPoolDNUsers', null, 'windowsIDPoolDN');
|
||||
$uidUsersGeneratorWinDN->setRequired(true);
|
||||
$configUserContainer->addElement($uidUsersGeneratorWinDN, true);
|
||||
$minUid = new htmlTableExtendedInputField(_('Minimum UID number'), 'posixAccount_minUID', null, 'minMaxUser');
|
||||
$minUid->setRequired(true);
|
||||
$configUserContainer->addElement($minUid, true);
|
||||
$maxUid = new htmlTableExtendedInputField(_('Maximum UID number'), 'posixAccount_maxUID', null, 'minMaxUser');
|
||||
$maxUid->setRequired(true);
|
||||
$configUserContainer->addElement($maxUid, true);
|
||||
$magicNumberUser = new htmlTableExtendedInputField(_('Magic number'), 'posixAccount_magicNumberUser', null, 'magicNumber');
|
||||
$magicNumberUser->setRequired(true);
|
||||
$configUserContainer->addElement($magicNumberUser, true);
|
||||
$configUserContainer->addElement(new htmlTableExtendedInputField(_('Suffix for UID/user name check'), 'posixAccount_uidCheckSuffixUser', '', 'uidCheckSuffix'), true);
|
||||
$return[] = $configUserContainer;
|
||||
}
|
||||
// host options
|
||||
if (in_array('host', $scopes)) {
|
||||
$configHostContainer = new htmlTable();
|
||||
$configHostContainer->addElement(new htmlSubTitle(_("Hosts")), true);
|
||||
$uidHostGeneratorSelect = new htmlTableExtendedSelect('posixAccount_uidGeneratorHosts', $generatorOptions, array('range'), _('UID generator'), 'uidGenerator');
|
||||
$uidHostGeneratorSelect->setHasDescriptiveElements(true);
|
||||
$uidHostGeneratorSelect->setTableRowsToHide(array(
|
||||
'range' => array('posixAccount_sambaIDPoolDNHosts', 'posixAccount_windowsIDPoolDNHosts', 'posixAccount_magicNumberHost'),
|
||||
'sambaPool' => array('posixAccount_minMachine', 'posixAccount_maxMachine', 'posixAccount_windowsIDPoolDNHosts', 'posixAccount_magicNumberHost'),
|
||||
'windowsDomain' => array('posixAccount_minMachine', 'posixAccount_maxMachine', 'posixAccount_sambaIDPoolDNHosts', 'posixAccount_magicNumberHost'),
|
||||
'magicNumber' => array('posixAccount_minMachine', 'posixAccount_maxMachine', 'posixAccount_windowsIDPoolDNHosts', 'posixAccount_sambaIDPoolDNHosts')
|
||||
));
|
||||
$uidHostGeneratorSelect->setTableRowsToShow(array(
|
||||
'range' => array('posixAccount_minMachine', 'posixAccount_maxMachine'),
|
||||
'sambaPool' => array('posixAccount_sambaIDPoolDNHosts'),
|
||||
'windowsDomain' => array('posixAccount_windowsIDPoolDNHosts'),
|
||||
'magicNumber' => array('posixAccount_magicNumberHost')
|
||||
));
|
||||
$configHostContainer->addElement($uidHostGeneratorSelect, true);
|
||||
$uidHostsGeneratorDN = new htmlTableExtendedInputField(_('Samba ID pool DN'), 'posixAccount_sambaIDPoolDNHosts', null, 'sambaIDPoolDN');
|
||||
$uidHostsGeneratorDN->setRequired(true);
|
||||
$configHostContainer->addElement($uidHostsGeneratorDN, true);
|
||||
$uidHostsGeneratorWinDN = new htmlTableExtendedInputField(_('Windows domain info DN'), 'posixAccount_windowsIDPoolDNHosts', null, 'windowsIDPoolDN');
|
||||
$uidHostsGeneratorWinDN->setRequired(true);
|
||||
$configHostContainer->addElement($uidHostsGeneratorWinDN, true);
|
||||
$minUid = new htmlTableExtendedInputField(_('Minimum UID number'), 'posixAccount_minMachine', null, 'minMaxHost');
|
||||
$minUid->setRequired(true);
|
||||
$configHostContainer->addElement($minUid, true);
|
||||
$maxUid = new htmlTableExtendedInputField(_('Maximum UID number'), 'posixAccount_maxMachine', null, 'minMaxHost');
|
||||
$maxUid->setRequired(true);
|
||||
$configHostContainer->addElement($maxUid, true);
|
||||
$magicNumberHost = new htmlTableExtendedInputField(_('Magic number'), 'posixAccount_magicNumberHost', null, 'magicNumber');
|
||||
$magicNumberHost->setRequired(true);
|
||||
$configHostContainer->addElement($magicNumberHost, true);
|
||||
$configHostContainer->addElement(new htmlTableExtendedInputField(_('Suffix for UID/user name check'), 'posixAccount_uidCheckSuffixHost', '', 'uidCheckSuffix'), true);
|
||||
$return[] = $configHostContainer;
|
||||
}
|
||||
// common options
|
||||
$configOptionsContainer = new htmlTable();
|
||||
$configOptionsContainer->addElement(new htmlSubTitle(_('Options')), true);
|
||||
$configOptionsContainer->addElement(new htmlTableExtendedSelect('posixAccount_pwdHash', getSupportedHashTypes(),
|
||||
array('SSHA'), _("Password hash type"), 'pwdHash'), true);
|
||||
$configOptionsContainer->addElement(new htmlTableExtendedInputTextarea('posixAccount_shells', implode("\r\n", $this->getShells()), 30, 4, _('Login shells'), 'loginShells'), true);
|
||||
$hiddenOptionsContainer = new htmlGroup();
|
||||
$hiddenOptionsContainer->colspan = 5;
|
||||
$hiddenOptionsContainerHead = new htmlTable();
|
||||
$hiddenOptionsContainerHead->addElement(new htmlOutputText(_('Hidden options')));
|
||||
$hiddenOptionsContainerHead->addElement(new htmlHelpLink('hiddenOptions'));
|
||||
$hiddenOptionsContainer->addElement($hiddenOptionsContainerHead);
|
||||
$configContainerOptions = new htmlTable();
|
||||
$configContainerOptions->addElement(new htmlTableExtendedInputCheckbox('posixAccount_hidegecos', false, _('Gecos'), null, false));
|
||||
if (isset($_SESSION['conf_config'])) {
|
||||
$confActiveGONModules = array_merge($_SESSION['conf_config']->get_AccountModules('group'), $_SESSION['conf_config']->get_AccountModules('gon'));
|
||||
if (in_array('groupOfNames', $confActiveGONModules) || in_array('groupOfMembers', $confActiveGONModules) || in_array('groupOfUniqueNames', $confActiveGONModules)) {
|
||||
$configContainerOptions->addElement(new htmlOutputText(' '));
|
||||
$configContainerOptions->addElement(new htmlTableExtendedInputCheckbox('posixAccount_hidegon', false, _('Groups of names'), null, false));
|
||||
$configContainerOptions->addElement(new htmlOutputText(' '));
|
||||
$configContainerOptions->addElement(new htmlTableExtendedInputCheckbox('posixAccount_hideposixGroups', false, _('Unix groups'), null, false));
|
||||
}
|
||||
}
|
||||
$hiddenOptionsContainer->addElement($configContainerOptions);
|
||||
$configOptionsContainer->addElement($hiddenOptionsContainer, true);
|
||||
$advancedOptions = new htmlTable();
|
||||
$advancedOptions->addElement(new htmlTableExtendedInputCheckbox('posixAccount_primaryGroupAsSecondary', false, _('Set primary group as memberUid'), 'primaryGroupAsSecondary'), true);
|
||||
$advancedOptions->addElement(new htmlTableExtendedInputField(_('User name suggestion'), 'posixAccount_userNameSuggestion', '@givenname@%sn%', 'userNameSuggestion'));
|
||||
$advancedOptionsAccordion = new htmlAccordion('posixAccountAdvancedOptions', array(_('Advanced options') => $advancedOptions), false);
|
||||
$advancedOptionsAccordion->colspan = 5;
|
||||
$configOptionsContainer->addElement($advancedOptionsAccordion);
|
||||
$return[] = $configOptionsContainer;
|
||||
|
||||
return $return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks input values of module settings.
|
||||
*
|
||||
|
@ -2544,6 +2578,21 @@ class posixAccount extends baseModule implements passwordService {
|
|||
if (($this->get_scope() == 'host') && isset($this->moduleSettings['posixAccount_uidGeneratorHosts']) && ($this->moduleSettings['posixAccount_uidGeneratorHosts'][0] == 'windowsDomain')) {
|
||||
return $this->getNextDomainInfoUIDs($count, $errors);
|
||||
}
|
||||
// check if a magic number should be used
|
||||
if (($this->get_scope() == 'user') && isset($this->moduleSettings['posixAccount_uidGeneratorUsers']) && ($this->moduleSettings['posixAccount_uidGeneratorUsers'][0] == 'magicNumber')) {
|
||||
$return = array();
|
||||
for ($i = 0; $i < $count; $i++) {
|
||||
$return[] = $this->moduleSettings['posixAccount_magicNumberUser'][0];
|
||||
}
|
||||
return $return;
|
||||
}
|
||||
if (($this->get_scope() == 'host') && isset($this->moduleSettings['posixAccount_uidGeneratorHosts']) && ($this->moduleSettings['posixAccount_uidGeneratorHosts'][0] == 'magicNumber')) {
|
||||
$return = array();
|
||||
for ($i = 0; $i < $count; $i++) {
|
||||
$return[] = $this->moduleSettings['posixAccount_magicNumberHost'][0];
|
||||
}
|
||||
return $return;
|
||||
}
|
||||
$ret = array();
|
||||
if ($this->get_scope() == "user") {
|
||||
$minID = intval($this->moduleSettings['posixAccount_minUID'][0]);
|
||||
|
|
|
@ -4,7 +4,7 @@ $Id$
|
|||
|
||||
This code is part of LDAP Account Manager (http://www.ldap-account-manager.org/)
|
||||
Copyright (C) 2003 - 2006 Tilo Lutz
|
||||
2007 - 2015 Roland Gruber
|
||||
2007 - 2016 Roland Gruber
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
@ -515,6 +515,7 @@ class posixGroup extends baseModule implements passwordService {
|
|||
'gidGenerator' => array (
|
||||
"Headline" => _("GID generator"),
|
||||
"Text" => _("LAM will automatically suggest UID/GID numbers. You can either use a fixed range of numbers or an LDAP entry with object class \"sambaUnixIdPool\" or \"msSFU30DomainInfo\".")
|
||||
. ' ' . _('Magic number will set a fixed value that must match your server configuration.')
|
||||
),
|
||||
'sambaIDPoolDN' => array (
|
||||
"Headline" => _("Samba ID pool DN"),
|
||||
|
@ -541,6 +542,10 @@ class posixGroup extends baseModule implements passwordService {
|
|||
"Headline" => _("Force sync with group of names"),
|
||||
"Text" => _("This will force syncing with group of names members of the same group.")
|
||||
),
|
||||
'magicNumber' => array(
|
||||
"Headline" => _("Magic number"),
|
||||
"Text" => _("Please enter the magic number you configured on server side.")
|
||||
),
|
||||
);
|
||||
|
||||
return $return;
|
||||
|
@ -561,19 +566,22 @@ class posixGroup extends baseModule implements passwordService {
|
|||
$genOptions = array(
|
||||
_('Fixed range') => 'range',
|
||||
_('Samba ID pool') => 'sambaPool',
|
||||
_('Windows domain info') => 'windowsDomain'
|
||||
_('Windows domain info') => 'windowsDomain',
|
||||
_('Magic number') => 'magicNumber'
|
||||
);
|
||||
$gidGeneratorSelect = new htmlTableExtendedSelect('posixGroup_gidGenerator', $genOptions, array('range'), _('GID generator'), 'gidGenerator');
|
||||
$gidGeneratorSelect->setHasDescriptiveElements(true);
|
||||
$gidGeneratorSelect->setTableRowsToHide(array(
|
||||
'range' => array('posixGroup_sambaIDPoolDN', 'posixGroup_windowsIDPoolDN'),
|
||||
'sambaPool' => array('posixGroup_minGID', 'posixGroup_maxGID', 'posixGroup_windowsIDPoolDN'),
|
||||
'windowsDomain' => array('posixGroup_minGID', 'posixGroup_maxGID', 'posixGroup_sambaIDPoolDN'),
|
||||
'range' => array('posixGroup_sambaIDPoolDN', 'posixGroup_windowsIDPoolDN', 'posixGroup_magicNumber'),
|
||||
'sambaPool' => array('posixGroup_minGID', 'posixGroup_maxGID', 'posixGroup_windowsIDPoolDN', 'posixGroup_magicNumber'),
|
||||
'windowsDomain' => array('posixGroup_minGID', 'posixGroup_maxGID', 'posixGroup_sambaIDPoolDN', 'posixGroup_magicNumber'),
|
||||
'magicNumber' => array('posixGroup_minGID', 'posixGroup_maxGID', 'posixGroup_windowsIDPoolDN', 'posixGroup_sambaIDPoolDN')
|
||||
));
|
||||
$gidGeneratorSelect->setTableRowsToShow(array(
|
||||
'range' => array('posixGroup_minGID', 'posixGroup_maxGID'),
|
||||
'sambaPool' => array('posixGroup_sambaIDPoolDN'),
|
||||
'windowsDomain' => array('posixGroup_windowsIDPoolDN'),
|
||||
'magicNumber' => array('posixGroup_magicNumber')
|
||||
));
|
||||
$configContainer->addElement($gidGeneratorSelect, true);
|
||||
$minGidInput = new htmlTableExtendedInputField(_('Minimum GID number'), 'posixGroup_minGID', null, 'minMaxGID');
|
||||
|
@ -588,6 +596,9 @@ class posixGroup extends baseModule implements passwordService {
|
|||
$winGeneratorDN = new htmlTableExtendedInputField(_('Windows domain info DN'), 'posixGroup_windowsIDPoolDN', null, 'windowsIDPoolDN');
|
||||
$winGeneratorDN->setRequired(true);
|
||||
$configContainer->addElement($winGeneratorDN, true);
|
||||
$magicNumber = new htmlTableExtendedInputField(_('Magic number'), 'posixGroup_magicNumber', null, 'magicNumber');
|
||||
$magicNumber->setRequired(true);
|
||||
$configContainer->addElement($magicNumber, true);
|
||||
$configContainer->addElement(new htmlTableExtendedInputField(_('Suffix for GID/group name check'), 'posixGroup_gidCheckSuffix', '', 'gidCheckSuffix'), true);
|
||||
$configContainer->addElement(new htmlTableExtendedInputCheckbox('posixGroup_hidememberUid', false, _('Disable membership management'), 'hidememberUid'), true);
|
||||
$x = $this->get_scope();
|
||||
|
@ -1044,6 +1055,14 @@ class posixGroup extends baseModule implements passwordService {
|
|||
if (isset($this->moduleSettings['posixGroup_gidGenerator']) && ($this->moduleSettings['posixGroup_gidGenerator'][0] == 'windowsDomain')) {
|
||||
return $this->getNextDomainInfoGIDs($count, $errors);
|
||||
}
|
||||
// use magic number
|
||||
if (isset($this->moduleSettings['posixGroup_gidGenerator']) && ($this->moduleSettings['posixGroup_gidGenerator'][0] == 'magicNumber')) {
|
||||
$return = array();
|
||||
for ($i = 0; $i < $count; $i++) {
|
||||
$return[] = $this->moduleSettings['posixGroup_magicNumber'][0];
|
||||
}
|
||||
return $return;
|
||||
}
|
||||
$ret = array();
|
||||
$minID = intval($this->moduleSettings['posixGroup_minGID'][0]);
|
||||
$maxID = intval($this->moduleSettings['posixGroup_maxGID'][0]);
|
||||
|
|
Loading…
Reference in New Issue