diff --git a/lam/help/help.inc b/lam/help/help.inc
index e0472877..cca557da 100644
--- a/lam/help/help.inc
+++ b/lam/help/help.inc
@@ -153,8 +153,7 @@ $helpArray = array (
"407" => array ("ext" => "FALSE", "Headline" => _("Groupname"),
"Text" => _("Group name of the group which should be created. Valid characters are: a-z,0-9, .-_. Lam does not allow a number as first character because groupadd also does not allow it. Lam does not allow capital letters A-Z because it can cause several problems. If groupname is already used groupname will be expanded with a number. The next free number will be used.")),
"408" => array ("ext" => "FALSE", "Headline" => _("GID number"),
- "Text" => _("If empty GID number will be generated automaticly. Valid values are between %s and %s."),
- "variables" => array($_SESSION['config']->get_minGID(), $_SESSION['config']->get_maxGID())),
+ "Text" => _("If empty GID number will be generated automaticly depending on your configuration settings.")),
"409" => array ("ext" => "FALSE", "Headline" => _("Gecos"),
"Text" => _("Group description. If left empty group name will be used.")),
"410" => array ("ext" => "FALSE", "Headline" => _("Host name"),
diff --git a/lam/lib/baseModule.inc b/lam/lib/baseModule.inc
index 69185713..18839a26 100644
--- a/lam/lib/baseModule.inc
+++ b/lam/lib/baseModule.inc
@@ -45,6 +45,9 @@ class baseModule {
/** the account type of this module (user, group, host) */
var $scope;
+ /** configuration settings of all modules */
+ var $moduleSettings;
+
/**
* Creates a new base module class
*
@@ -53,6 +56,7 @@ class baseModule {
function baseModule($scope) {
$this->scope = $scope;
$this->meta = $this->get_metaData();
+ if (isset($_SESSION['config'])) $this->moduleSettings = $_SESSION['config']->get_moduleSettings();
}
/**
diff --git a/lam/lib/config.inc b/lam/lib/config.inc
index c65bd87e..2dbf2b91 100644
--- a/lam/lib/config.inc
+++ b/lam/lib/config.inc
@@ -123,10 +123,6 @@ class Config {
var $MinUID;
/** Maximum UID number for users */
var $MaxUID;
- /** Minimum GID number for groups */
- var $MinGID;
- /** Maximum GID number for groups */
- var $MaxGID;
/** Minimum UID number for Samba hosts */
var $MinMachine;
/** Maximum UID number for Samba hosts */
@@ -183,7 +179,7 @@ class Config {
/** List of all settings in config file */
var $settings = array("ServerURL", "Passwd", "Admins", "usersuffix", "groupsuffix", "hostsuffix",
- "domainsuffix", "MinUID", "MaxUID", "MinGID", "MaxGID", "MinMachine", "MaxMachine",
+ "domainsuffix", "MinUID", "MaxUID", "MinMachine", "MaxMachine",
"userlistAttributes", "grouplistAttributes", "hostlistAttributes", "maxlistentries",
"defaultLanguage", "scriptPath", "scriptServer", "cachetimeout", "pwdhash",
"usermodules", "groupmodules", "hostmodules", "modules");
@@ -269,6 +265,7 @@ class Config {
$option = substr($line, $keylen + 2, strlen($line) - $keylen - 2);
$pos = strpos($option, ":");
$name = substr($option, 0, $pos);
+ if (!isset($this->moduleSettings[$name])) continue;
$file_array[$i] = "modules: " . $name . ": " . implode("+::+", $this->moduleSettings[$name]) . "\n";
$mod_saved[] = $name; // mark keyword as saved
}
@@ -297,8 +294,6 @@ class Config {
"# e.g. ou=domains,dc=yourdomain,dc=org\n" . "domainsuffix: " . $this->domainsuffix . "\n");
if (!in_array("MinUID", $saved)) array_push($file_array, "\n\n# minimum UID number\n" . "minUID: " . $this->MinUID . "\n");
if (!in_array("MaxUID", $saved)) array_push($file_array, "\n\n# maximum UID number\n" . "maxUID: " . $this->MaxUID . "\n");
- if (!in_array("MinGID", $saved)) array_push($file_array, "\n\n# minimum GID number\n" . "minGID: " . $this->MinGID . "\n");
- if (!in_array("MaxGID", $saved)) array_push($file_array, "\n\n# maximum GID number\n" . "maxGID: " . $this->MaxGID . "\n");
if (!in_array("MinMachine", $saved)) array_push($file_array, "\n\n# minimum UID number for Samba hosts\n" . "minMachine: " . $this->MinMachine . "\n");
if (!in_array("MaxMachine", $saved)) array_push($file_array, "\n\n# maximum UID number for Samba hosts\n" . "maxMachine: " . $this->MaxMachine . "\n");
if (!in_array("userlistAttributes", $saved)) array_push($file_array, "\n\n# list of attributes to show in user list\n# entries can either be predefined values (e.g. '#cn' or '#uid')" .
@@ -347,8 +342,6 @@ class Config {
echo "" . _("DomainSuffix") . ": " . $this->domainsuffix . "
\n";
echo "" . _("Minimum UID number") . ": " . $this->MinUID . "
\n";
echo "" . _("Maximum UID number") . ": " . $this->MaxUID . "
\n";
- echo "" . _("Minimum GID number") . ": " . $this->MinGID . "
\n";
- echo "" . _("Maximum GID number") . ": " . $this->MaxGID . "
\n";
echo "" . _("Minimum Machine number") . ": " . $this->MinMachine . "
\n";
echo "" . _("Maximum Machine number") . ": " . $this->MaxMachine . "
\n";
echo "" . _("Attributes in User List") . ": " . $this->userlistAttributes . "
\n";
@@ -590,48 +583,6 @@ class Config {
return true;
}
- /**
- * Returns the minimum GID to use when creating new groups
- *
- * @return the minimum GID number
- */
- function get_minGID() {
- return $this->MinGID;
- }
-
- /**
- * Sets the minimum GID to use when creating new groups
- *
- * @param $value new minimum GID number
- * @return true if $value has correct format
- */
- function set_minGID($value) {
- if (is_numeric($value)) $this->MinGID = $value;
- else return false;
- return true;
- }
-
- /**
- * Returns the maximum GID to use when creating new groups
- *
- * @return the maximum GID number
- */
- function get_maxGID() {
- return $this->MaxGID;
- }
-
- /**
- * Sets the maximum GID to use when creating new groups
- *
- * @param $value new maximum GID number
- * @return true if $value has correct format
- */
- function set_maxGID($value) {
- if (is_numeric($value)) $this->MaxGID = $value;
- else return false;
- return true;
- }
-
/**
* Returns the minimum UID to use when creating new Samba hosts
*
diff --git a/lam/lib/modules/posixGroup.inc b/lam/lib/modules/posixGroup.inc
index c3f9edb9..2b36cf25 100644
--- a/lam/lib/modules/posixGroup.inc
+++ b/lam/lib/modules/posixGroup.inc
@@ -54,6 +54,18 @@ $Id$
*/
class posixGroup extends baseModule {
+ /**
+ * Creates a new posixGroup object.
+ */
+ function posixGroup($scope) {
+ // error messages for input checks
+ $this->messages['minGID'] = array('ERROR', _('Minimum GID number'), _('Minimum GID number is invalid or empty!'));
+ $this->messages['maxGID'] = array('ERROR', _('Maximum GID number'), _('Maximum GID number is invalid or empty!'));
+ $this->messages['cmpGID'] = array('ERROR', _('Maximum GID number'), _('Maximum GID number must be greater than minimum GID number!'));
+ // call parent constructor
+ parent::baseModule($scope);
+ }
+
/**
* Returns meta data that is interpreted by parent class
*
@@ -73,6 +85,31 @@ class posixGroup extends baseModule {
$return["alias"] = _('Unix');
// module dependencies
$return['dependencies'] = array('depends' => array(), 'conflicts' => array('inetOrgPerson', 'account', 'sambaDomain'));
+ // configuration options
+ $return['config_options']['group'] = array(
+ array(
+ 0 => array('kind' => 'text', 'text' => '' . _('Minimum GID number') . " *: "),
+ 1 => array('kind' => 'input', 'name' => 'posixGroup_minGID', 'type' => 'text', 'size' => '10', 'maxlength' => '255'),
+ 2 => array('kind' => 'text', 'value' => ' '),
+ 3 => array('kind' => 'text', 'text' => '' . _('Maximum GID number') . " *: "),
+ 4 => array('kind' => 'input', 'name' => 'posixGroup_maxGID', 'type' => 'text', 'size' => '10', 'maxlength' => '255'),
+ 5 => array('kind' => 'help', 'value' => 'TODO'))
+ );
+ // configuration descriptions
+ $return['config_descriptions'] = array(
+ 'legend' => _("GID ranges for Unix groups"),
+ 'descriptions' => array(
+ 'posixGroup_minGID' => "Minimum GID number for Unix groups",
+ 'posixGroup_maxGID' => "Maximum GID number for Unix groups",
+ )
+ );
+ // configuration checks
+ $return['config_checks']['group']['posixGroup_minGID'] = array('type' => 'regex', 'regex' => '^[0-9]+$',
+ 'required' => true, 'required_message' => $this->messages['minGID'], 'error_message' => $this->messages['minGID']);
+ $return['config_checks']['group']['posixGroup_maxGID'] = array('type' => 'regex', 'regex' => '^[0-9]+$',
+ 'required' => true, 'required_message' => $this->messages['maxGID'], 'error_message' => $this->messages['maxGID']);
+ $return['config_checks']['group']['cmpGID'] = array('type' => 'int_greater', 'cmp_name1' => 'posixGroup_maxGID',
+ 'cmp_name2' => 'posixGroup_minGID', 'error_message' => $this->messages['cmpGID']);
return $return;
}
@@ -357,8 +394,8 @@ class posixGroup extends baseModule {
// Check if UID is valid. If none value was entered, the next useable value will be inserted
// load min and may uidNumber
- $minID = intval($_SESSION[$_SESSION[$this->base]->config]->get_minGID());
- $maxID = intval($_SESSION[$_SESSION[$this->base]->config]->get_maxGID());
+ $minID = intval($this->moduleSettings['posixGroup_minGID'][0]);
+ $maxID = intval($this->moduleSettings['posixGroup_maxGID'][0]);
$dn_gids = $_SESSION[$_SESSION[$this->base]->cache]->get_cache('gidNumber', 'posixGroup', '*');
// get_cache will return an array ( dn1 => array(uidnumber1), dn2 => array(uidnumber2), ... )
foreach ($dn_gids as $gid) $gids[] = $gid[0];
diff --git a/lam/session-vars.txt b/lam/session-vars.txt
index bbaad0e1..83afa43e 100644
--- a/lam/session-vars.txt
+++ b/lam/session-vars.txt
@@ -68,8 +68,6 @@ convsave, confmain, conflogin:
- conf_suffdomains: Eingabe von confmain
- conf_minUID: Eingabe von confmain
- conf_maxUID: Eingabe von confmain
-- conf_minGID: Eingabe von confmain
-- conf_maxGID: Eingabe von confmain
- conf_minMach: Eingabe von confmain
- conf_maxMach: Eingabe von confmain
- conf_usrlstattr: Eingabe von confmain
diff --git a/lam/templates/config/conflogin.php b/lam/templates/config/conflogin.php
index 469a80d1..0fb58a22 100644
--- a/lam/templates/config/conflogin.php
+++ b/lam/templates/config/conflogin.php
@@ -52,8 +52,6 @@ unset($_SESSION['conf_suffgroups']);
unset($_SESSION['conf_suffhosts']);
unset($_SESSION['conf_minUID']);
unset($_SESSION['conf_maxUID']);
-unset($_SESSION['conf_minGID']);
-unset($_SESSION['conf_maxGID']);
unset($_SESSION['conf_minMach']);
unset($_SESSION['conf_maxMach']);
unset($_SESSION['conf_usrlstattr']);
diff --git a/lam/templates/config/confmain.php b/lam/templates/config/confmain.php
index 24416f57..001f47c9 100644
--- a/lam/templates/config/confmain.php
+++ b/lam/templates/config/confmain.php
@@ -59,8 +59,6 @@ if ($_POST['back'] || $_POST['submitconf'] || $_POST['editmodules']){
$_SESSION['conf_suffdomains'] = $_POST['suffdomains'];
$_SESSION['conf_minUID'] = $_POST['minUID'];
$_SESSION['conf_maxUID'] = $_POST['maxUID'];
- $_SESSION['conf_minGID'] = $_POST['minGID'];
- $_SESSION['conf_maxGID'] = $_POST['maxGID'];
$_SESSION['conf_minMach'] = $_POST['minMach'];
$_SESSION['conf_maxMach'] = $_POST['maxMach'];
$_SESSION['conf_usrlstattr'] = $_POST['usrlstattr'];
@@ -131,8 +129,6 @@ if ($_GET["modulesback"] == "true") {
$conf->set_DomainSuffix($_SESSION['conf_suffdomains']);
$conf->set_minUID($_SESSION['conf_minUID']);
$conf->set_maxUID($_SESSION['conf_maxUID']);
- $conf->set_minGID($_SESSION['conf_minGID']);
- $conf->set_maxGID($_SESSION['conf_maxGID']);
$conf->set_minMachine($_SESSION['conf_minMach']);
$conf->set_maxMachine($_SESSION['conf_maxMach']);
$conf->set_userlistAttributes($_SESSION['conf_usrlstattr']);
@@ -314,16 +310,6 @@ echo ("