fixed maxlistentries setting
This commit is contained in:
parent
5b11f1d847
commit
a6dabef929
|
@ -8,7 +8,6 @@ serverURL: ldap://localhost:389
|
|||
# e.g. admins: cn=admin,dc=yourdomain,dc=org;cn=root,dc=yourdomain,dc=org
|
||||
admins: cn=Manager,dc=my-domain,dc=com
|
||||
|
||||
|
||||
# password to change these preferences via webfrontend
|
||||
passwd: lam
|
||||
|
||||
|
@ -59,3 +58,6 @@ grouplistAttributes: #cn;#gidNumber;#memberUID;#description
|
|||
# or individual ones (e.g. 'cn:Host Name')
|
||||
# values have to be seperated by semicolons
|
||||
hostlistAttributes: #cn;#rid;#description;gidNumber:GID
|
||||
|
||||
# maximum number of rows to show in user/group/host lists
|
||||
maxlistentries: 30
|
||||
|
|
|
@ -73,6 +73,8 @@ class Config {
|
|||
var $userlistAttributes;
|
||||
var $grouplistAttributes;
|
||||
var $hostlistAttributes;
|
||||
|
||||
// maximum number of rows shown in user/group/host list
|
||||
var $maxlistentries;
|
||||
|
||||
// constructor, loads preferences from ../config/lam.conf
|
||||
|
@ -151,6 +153,10 @@ class Config {
|
|||
$this->hostlistAttributes = chop(substr($line, 20, strlen($line)-20));
|
||||
continue;
|
||||
}
|
||||
if (substr($line, 0, 16) == "maxlistentries: ") {
|
||||
$this->maxlistentries = chop(substr($line, 16, strlen($line)-16));
|
||||
continue;
|
||||
}
|
||||
}
|
||||
fclose($file);
|
||||
}
|
||||
|
@ -173,7 +179,7 @@ class Config {
|
|||
// booleans to check if value was already saved
|
||||
$save_serverURL = $save_passwd = $save_admins = $save_suffusr = $save_suffgrp = $save_suffhst =
|
||||
$save_minUID = $save_maxUID = $save_minGID = $save_maxGID = $save_minMach = $save_maxMach =
|
||||
$save_usrlstatrr = $save_grplstatrr = $save_hstlstatrr = False;
|
||||
$save_usrlstatrr = $save_grplstatrr = $save_hstlstatrr = $maxlstent = False;
|
||||
$file = fopen($conffile, "r");
|
||||
$file_array = array();
|
||||
while (!feof($file)) {
|
||||
|
@ -258,6 +264,11 @@ class Config {
|
|||
$save_hstlstattr = True;
|
||||
continue;
|
||||
}
|
||||
if (substr($file_array[$i], 0, 16) == "maxlistentries: ") {
|
||||
$file_array[$i] = "maxlistentries: " . $this->maxlistentries . "\n";
|
||||
$save_maxlstent = True;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
// check if we have to add new entries (e.g. if user upgraded LAM and has an old lam.conf)
|
||||
if (!$save_serverURL == True) array_push($file_array, "\n\n# server address (e.g. ldap://localhost:389 or ldaps://localhost:636)\n" . "serverURL: " . $this->ServerURL);
|
||||
|
@ -283,6 +294,7 @@ class Config {
|
|||
"\n# or individual ones (e.g. 'cn:Group Name')\n# values have to be seperated by semicolons\n" . "grouplistAttributes: " . $this->grouplistAttributes);
|
||||
if (!$save_hstlstattr == True) array_push($file_array, "\n\n# list of attributes to show in host list\n# entries can either be predefined values (e.g. '#cn' or '#uid')" .
|
||||
"\n# or individual ones (e.g. 'cn:Host Name')\n# values have to be seperated by semicolons\n" . "hostlistAttributes: " . $this->hostlistAttributes);
|
||||
if (!$save_maxlstent == True) array_push($file_array, "\n\n# maximum number of rows to show in user/group/host lists\n" . "maxlistentries: " . $this->maxlistentries);
|
||||
$file = fopen($conffile, "w");
|
||||
if ($file) {
|
||||
for ($i = 0; $i < sizeof($file_array); $i++) fputs($file, $file_array[$i]);
|
||||
|
@ -310,7 +322,8 @@ class Config {
|
|||
echo _("<b>maxMachine: </b>") . $this->MaxMachine . "<br>";
|
||||
echo _("<b>userlistAttributes: </b>") . $this->userlistAttributes . "<br>";
|
||||
echo _("<b>grouplistAttributes: </b>") . $this->grouplistAttributes . "<br>";
|
||||
echo _("<b>hostlistAttributes: </b>") . $this->hostlistAttributes;
|
||||
echo _("<b>hostlistAttributes: </b>") . $this->hostlistAttributes . "<br>";
|
||||
echo _("<b>maxlistentries: </b>") . $this->maxlistentries;
|
||||
}
|
||||
|
||||
// functions to read/write preferences
|
||||
|
|
|
@ -46,6 +46,7 @@ $MaxMachine = $conf->get_maxMachine();
|
|||
$userlistAttributes = $conf->get_userlistAttributes();
|
||||
$grouplistAttributes = $conf->get_grouplistAttributes();
|
||||
$hostlistAttributes = $conf->get_hostlistAttributes();
|
||||
$maxlistentries = $conf->get_maxlistentries();
|
||||
echo ("done<br>");
|
||||
// next we modify them and save lam.conf
|
||||
echo ("Changing preferences...");
|
||||
|
@ -65,6 +66,7 @@ $conf->set_maxMachine("47");
|
|||
$conf->set_userlistAttributes("#uid;#cn");
|
||||
$conf->set_grouplistAttributes("#gidNumber;#cn;#memberUID");
|
||||
$conf->set_hostlistAttributes("#cn;#uid;#description");
|
||||
$conf->set_maxlistentries("54");
|
||||
$conf->save();
|
||||
echo ("done<br>");
|
||||
// at last all preferences are read from lam.conf and compared
|
||||
|
@ -88,6 +90,7 @@ if ($conf->get_maxMachine() != "47") echo ("<br><font color=\"#FF0000\">Saving m
|
|||
if ($conf->get_userlistAttributes() != "#uid;#cn") echo ("<br><font color=\"#FF0000\">Saving userlistAttributes failed!</font><br>");
|
||||
if ($conf->get_grouplistAttributes() != "#gidNumber;#cn;#memberUID") echo ("<br><font color=\"#FF0000\">Saving grouplistAttributes failed!</font><br>");
|
||||
if ($conf->get_hostlistAttributes() != "#cn;#uid;#description") echo ("<br><font color=\"#FF0000\">Saving hostlistAttributes failed!</font><br>");
|
||||
if ($conf->get_maxlistentries() != "54") echo ("<br><font color=\"#FF0000\">Saving maxlistentries failed!</font><br>");
|
||||
echo ("done<br>");
|
||||
// restore old values
|
||||
echo ("Restoring old preferences...");
|
||||
|
@ -107,6 +110,7 @@ $conf->set_maxMachine($MaxMachine);
|
|||
$conf->set_userlistAttributes($userlistAttributes);
|
||||
$conf->set_grouplistAttributes($grouplistAttributes);
|
||||
$conf->set_hostlistAttributes($hostlistAttributes);
|
||||
$conf->set_maxlistentries($maxlistentries);
|
||||
$conf->save();
|
||||
echo ("done<br>");
|
||||
// finished
|
||||
|
|
Loading…
Reference in New Issue