added attribute options for user/group/host lists

This commit is contained in:
Roland Gruber 2003-03-30 19:51:47 +00:00
parent 28444b9c7e
commit cc756735cb
5 changed files with 183 additions and 47 deletions

View File

@ -9,7 +9,7 @@ $Id$
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or the Free Software Foundation; either version 2 of the License, or
(at your option) any later version. (at your option) any later version.
This program is distributed in the hope that it will be useful, This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
@ -63,7 +63,12 @@ class Config {
var $MaxGID; var $MaxGID;
var $MinMachine; var $MinMachine;
var $MaxMachine; var $MaxMachine;
// attributes that are shown in the user/group/host tables
var $userlistAttributes;
var $grouplistAttributes;
var $hostlistAttributes;
// default shell and list of possible shells // default shell and list of possible shells
var $DefaultShell; var $DefaultShell;
var $ShellList; var $ShellList;
@ -148,6 +153,18 @@ class Config {
$this->ShellList = chop(substr($line, 11, strlen($line)-11)); $this->ShellList = chop(substr($line, 11, strlen($line)-11));
continue; continue;
} }
if (substr($line, 0, 20) == "userlistAttributes: ") {
$this->userlistAttributes = chop(substr($line, 20, strlen($line)-20));
continue;
}
if (substr($line, 0, 21) == "grouplistAttributes: ") {
$this->grouplistAttributes = chop(substr($line, 21, strlen($line)-21));
continue;
}
if (substr($line, 0, 20) == "hostlistAttributes: ") {
$this->hostlistAttributes = chop(substr($line, 20, strlen($line)-20));
continue;
}
} }
fclose($file); fclose($file);
} }
@ -162,7 +179,8 @@ class Config {
if (is_file($conffile) == True) { if (is_file($conffile) == True) {
// booleans to check if value was already saved // booleans to check if value was already saved
$save_ssl = $save_host = $save_port = $save_passwd = $save_admins = $save_suffusr = $save_suffgrp = $save_suffhst = $save_ssl = $save_host = $save_port = $save_passwd = $save_admins = $save_suffusr = $save_suffgrp = $save_suffhst =
$save_minUID = $save_maxUID = $save_minGID = $save_maxGID = $save_minMach = $save_maxMach = $save_defShell = $save_shellList = False; $save_minUID = $save_maxUID = $save_minGID = $save_maxGID = $save_minMach = $save_maxMach = $save_defShell =
$save_shellList = $save_usrlstatrr = $save_grplstatrr = $save_hstlstatrr = False;
$file = fopen($conffile, "r"); $file = fopen($conffile, "r");
$file_array = array(); $file_array = array();
while (!feof($file)) { while (!feof($file)) {
@ -252,6 +270,21 @@ class Config {
$save_shellList = True; $save_shellList = True;
continue; continue;
} }
if (substr($file_array[$i], 0, 20) == "userlistAttributes: ") {
$file_array[$i] = "userlistAttributes: " . $this->userlistAttributes . "\n";
$save_usrlstattr = True;
continue;
}
if (substr($file_array[$i], 0, 21) == "grouplistAttributes: ") {
$file_array[$i] = "grouplistAttributes: " . $this->grouplistAttributes . "\n";
$save_grplstattr = True;
continue;
}
if (substr($file_array[$i], 0, 20) == "hostlistAttributes: ") {
$file_array[$i] = "hostlistAttributes: " . $this->hostlistAttributes . "\n";
$save_hstlstattr = True;
continue;
}
} }
// check if we have to add new entries (e.g. if user upgraded LAM and has an old lam.conf) // check if we have to add new entries (e.g. if user upgraded LAM and has an old lam.conf)
if (!$save_ssl == True) array_push($file_array, "\n\n# use SSL to connect, can be True or False\n" . "ssl: " . $this->SSL); if (!$save_ssl == True) array_push($file_array, "\n\n# use SSL to connect, can be True or False\n" . "ssl: " . $this->SSL);
@ -274,7 +307,13 @@ class Config {
if (!$save_minMach == True) array_push($file_array, "\n\n# minimum UID number for Samba hosts\n" . "minMachine: " . $this->MinMachine); if (!$save_minMach == True) array_push($file_array, "\n\n# minimum UID number for Samba hosts\n" . "minMachine: " . $this->MinMachine);
if (!$save_maxMach == True) array_push($file_array, "\n\n# maximum UID number for Samba hosts\n" . "maxMachine: " . $this->MaxMachine); if (!$save_maxMach == True) array_push($file_array, "\n\n# maximum UID number for Samba hosts\n" . "maxMachine: " . $this->MaxMachine);
if (!$save_defShell == True) array_push($file_array, "\n\n# default shell when creating new user\n" . "defaultShell: " . $this->DefaultShell); if (!$save_defShell == True) array_push($file_array, "\n\n# default shell when creating new user\n" . "defaultShell: " . $this->DefaultShell);
if (!$save_shellList == True) array_push($file_array, "\n\n# list of possible shells\n" . "shellList: " . $this->ShellList); if (!$save_shellList == True) array_push($file_array, "\n\n# list of possible shells\n# values have to be seperated by semicolons\n" . "shellList: " . $this->ShellList);
if (!$save_usrlstattr == True) 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')" .
"\n# or individual ones (e.g. 'uid:User ID' or 'host:Host Name')\n# values have to be seperated by semicolons\n" . "userlistAttributes: " . $this->userlistAttributes);
if (!$save_grplstattr == True) array_push($file_array, "\n\n# list of attributes to show in group list\n# entries can either be predefined values (e.g. '#cn' or '#gidNumber')" .
"\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);
$file = fopen($conffile, "w"); $file = fopen($conffile, "w");
if ($file) { if ($file) {
for ($i = 0; $i < sizeof($file_array); $i++) fputs($file, $file_array[$i]); for ($i = 0; $i < sizeof($file_array); $i++) fputs($file, $file_array[$i]);
@ -286,7 +325,7 @@ class Config {
} }
} }
} }
// prints current preferences // prints current preferences
function printconf() { function printconf() {
echo _("<b>SSL: </b>" ) . $this->SSL . "<br>"; echo _("<b>SSL: </b>" ) . $this->SSL . "<br>";
@ -302,6 +341,9 @@ class Config {
echo _("<b>maxGID: </b>") . $this->MaxGID . "<br>"; echo _("<b>maxGID: </b>") . $this->MaxGID . "<br>";
echo _("<b>minMachine: </b>") . $this->MinMachine . "<br>"; echo _("<b>minMachine: </b>") . $this->MinMachine . "<br>";
echo _("<b>maxMachine: </b>") . $this->MaxMachine . "<br>"; 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 . "<br>";
echo _("<b>Default Shell: </b>") . $this->DefaultShell . "<br>"; echo _("<b>Default Shell: </b>") . $this->DefaultShell . "<br>";
echo _("<b>Shell list: </b>") . $this->ShellList; echo _("<b>Shell list: </b>") . $this->ShellList;
} }
@ -500,13 +542,46 @@ class Config {
function get_shellList() { function get_shellList() {
return $this->ShellList; return $this->ShellList;
} }
// sets the list of possible shells when creating new users // sets the list of possible shells when creating new users
function set_shellList($value) { function set_shellList($value) {
if (is_string($value)) $this->ShellList = $value; if (is_string($value)) $this->ShellList = $value;
else echo _("Config->set_shellList failed!"); else echo _("Config->set_shellList failed!");
} }
// returns the list of attributes to show in user list
function get_userlistAttributes() {
return $this->userlistAttributes;
}
// sets the list of attributes to show in user list
function set_userlistAttributes($value) {
if (is_string($value)) $this->userlistAttributes = $value;
else echo _("Config->set_userlistAttributes failed!");
}
// returns the list of attributes to show in group list
function get_grouplistAttributes() {
return $this->grouplistAttributes;
}
// sets the list of attributes to show in group list
function set_grouplistAttributes($value) {
if (is_string($value)) $this->grouplistAttributes = $value;
else echo _("Config->set_grouplistAttributes failed!");
}
// returns the list of attributes to show in host list
function get_hostlistAttributes() {
return $this->hostlistAttributes;
}
// sets the list of attributes to show in host list
function set_hostlistAttributes($value) {
if (is_string($value)) $this->hostlistAttributes = $value;
else echo _("Config->set_hostlistAttributes failed!");
}
} }
?> ?>

View File

@ -49,48 +49,61 @@ echo ("<head>\n");
echo ("<title>" . _("LDAP Account Manager Configuration") . "</title>\n"); echo ("<title>" . _("LDAP Account Manager Configuration") . "</title>\n");
echo ("</head>\n"); echo ("</head>\n");
echo ("<body>\n"); echo ("<body>\n");
echo ("<p align=\"center\"><a href=\"http://lam.sf.net\" target=\"new_window\"><img src=\"../graphics/banner.jpg\" border=1></a></p><hr><br><br>\n"); echo ("<p align=\"center\"><a href=\"http://lam.sf.net\" target=\"new_window\"><img src=\"../graphics/banner.jpg\" border=1 alt=\"LDAP Account Manager\"></a></p><hr><br><br>\n");
echo ("<form action=\"confsave.php\" method=\"post\">\n"); echo ("<form action=\"confsave.php\" method=\"post\">\n");
echo ("<p align=\"center\"><table border=\"0\">"); echo ("<table align=\"center\" border=\"0\">");
echo ("<tr><th><p align=\"right\"><b>" . _("Hostname") . ": </b></th> <th><p align=\"left\"><input type=\"text\" name=\"host\" value=\"" . $conf->get_Host() . "\"></th>\n"); echo ("<tr><td width=\"20%\"><p align=\"right\"><b>" . _("Hostname") . ": </b></p></td> <td width=\"30%\"><p align=\"left\"><input type=\"text\" name=\"host\" value=\"" . $conf->get_Host() . "\"></td>\n");
echo ("<th><p align=\"left\">" . _("Hostname of LDAP server") . "</th></tr>\n"); echo ("<td width=\"50%\"><p align=\"left\">" . _("Hostname of LDAP server") . "</p></td></tr>\n");
echo ("<tr><th><p align=\"right\"><b>" . _("Portnumber") . ": </b></th> <th><p align=\"left\"><input type=\"text\" size=5 name=\"port\" value=\"" . $conf->get_Port() . "\"></th>\n"); echo ("<tr><td><p align=\"right\"><b>" . _("Portnumber") . ": </b></p></td> <td><p align=\"left\"><input type=\"text\" size=5 name=\"port\" value=\"" . $conf->get_Port() . "\"></td>\n");
echo _("<th><p align=\"left\">Default is 389, use 636 for SSL connections</th></tr>\n"); echo _("<td><p align=\"left\">Default is 389, use 636 for SSL connections</p></td></tr>\n");
if ($conf->get_SSL() == "True") echo ("<tr><th><p align=\"right\"><b>" . _("Use SSL") . ": </b></th> <th><p align=\"left\"><input type=\"checkbox\" name=\"ssl\" checked></th>\n"); if ($conf->get_SSL() == "True") echo ("<tr><td><p align=\"right\"><b>" . _("Use SSL") . ": </b></p></td> <td><p align=\"left\"><input type=\"checkbox\" name=\"ssl\" checked></td>\n");
else echo ("<tr><th><p align=\"right\"><b>" . _("Use SSL") . ": </b></th> <th><p align=\"left\"><input type=\"checkbox\" name=\"ssl\"></th>\n"); else echo ("<tr><td><p align=\"right\"><b>" . _("Use SSL") . ": </b></p></td> <td><p align=\"left\"><input type=\"checkbox\" name=\"ssl\"></td>\n");
echo ("<th><p align=\"left\">" . _("Check if your server supports secure connections.") . "</th></tr>\n"); echo ("<td><p align=\"left\">" . _("Check if your server supports secure connections.") . "</p></td></tr>\n");
echo ("<tr><th><p align=\"right\"><b>" . _("List of valid users") . ": </b></th> <th><input size=50 type=\"text\" name=\"admins\" value=\"" . $conf->get_Adminstring() . "\"></th>\n"); echo ("<tr><td>&nbsp</td></tr>");
echo ("<th><p align=\"left\">" . _("Usernames must be seperated by semicolons<br>(e.g. cn=admin,dc=yourcompany,dc=com ; uid=root,ou=people,dc=yourcompany,dc=com)") . "</th></tr>\n"); echo ("<tr><td><p align=\"right\"><b>" . _("List of valid users") . ": </b></p></td> <td><input size=50 type=\"text\" name=\"admins\" value=\"" . $conf->get_Adminstring() . "\"></td>\n");
echo ("<tr><th>&nbsp</th></tr>"); echo ("<td><p align=\"left\">" . _("Usernames must be seperated by semicolons<br>(e.g. cn=admin,dc=yourcompany,dc=com;uid=root,ou=people,dc=yourcompany,dc=com)") . "</p></td></tr>\n");
echo ("<tr><th><p align=\"right\"><b>" . _("UserSuffix") . ": </b></th> <th><input size=50 type=\"text\" name=\"suffusers\" value=\"" . $conf->get_UserSuffix() . "\"></th>\n"); echo ("<tr><td>&nbsp</td></tr>");
echo ("<th><p align=\"left\">" . _("This is the suffix from where to search for users.<br>(e.g. ou=People,dc=yourcompany,dc=com)=") . "</th></tr>\n"); echo ("<tr><td><p align=\"right\"><b>" . _("UserSuffix") . ": </b></p></td> <td><input size=50 type=\"text\" name=\"suffusers\" value=\"" . $conf->get_UserSuffix() . "\"></td>\n");
echo ("<tr><th><p align=\"right\"><b>" . _("GroupSuffix") . ": </b></th> <th><input size=50 type=\"text\" name=\"suffgroups\" value=\"" . $conf->get_GroupSuffix() . "\"></th>\n"); echo ("<td><p align=\"left\">" . _("This is the suffix from where to search for users.<br>(e.g. ou=People,dc=yourcompany,dc=com)") . "</p></td></tr>\n");
echo ("<th><p align=\"left\">" . _("This is the suffix from where to search for groups.<br>(e.g. ou=group,dc=yourcompany,dc=com)") . "</th></tr>\n"); echo ("<tr><td><p align=\"right\"><b>" . _("GroupSuffix") . ": </b></p></td> <td><input size=50 type=\"text\" name=\"suffgroups\" value=\"" . $conf->get_GroupSuffix() . "\"></td>\n");
echo ("<tr><th><p align=\"right\"><b>" . _("HostSuffix") . ": </b></th> <th><input size=50 type=\"text\" name=\"suffhosts\" value=\"" . $conf->get_HostSuffix() . "\"></th>\n"); echo ("<td><p align=\"left\">" . _("This is the suffix from where to search for groups.<br>(e.g. ou=group,dc=yourcompany,dc=com)") . "</p></td></tr>\n");
echo ("<th><p align=\"left\">" . _("This is the suffix from where to search for Samba hosts.<br>(e.g. ou=machines,dc=yourcompany,dc=com)") . "</th></tr>\n"); echo ("<tr><td><p align=\"right\"><b>" . _("HostSuffix") . ": </b></p></td> <td><input size=50 type=\"text\" name=\"suffhosts\" value=\"" . $conf->get_HostSuffix() . "\"></td>\n");
echo ("<tr><th>&nbsp</th></tr>"); echo ("<td><p align=\"left\">" . _("This is the suffix from where to search for Samba hosts.<br>(e.g. ou=machines,dc=yourcompany,dc=com)") . "</p></td></tr>\n");
echo ("<tr><th><p align=\"right\"><b>" . _("Minimum UID number") . ": </b></th> <th><p align=\"left\"><input size=6 type=\"text\" name=\"minUID\" value=\"" . $conf->get_minUID() . "\">\n"); echo ("<tr><td>&nbsp</td></tr>");
echo ("&nbsp <b>" . _("Maximum UID number") . ": </b><input size=6 type=\"text\" name=\"maxUID\" value=\"" . $conf->get_maxUID() . "\"></th>\n"); echo ("<tr><td align=\"right\"><b>" . _("Minimum UID number") . ": </b></td> <td align=\"left\"><input size=6 type=\"text\" name=\"minUID\" value=\"" . $conf->get_minUID() . "\">\n");
echo ("<th><p align=\"left\">" . _("These are the minimum and maximum numbers to use for user IDs") . "</th></tr>\n"); echo ("&nbsp <b>" . _("Maximum UID number") . ": </b><input size=6 type=\"text\" name=\"maxUID\" value=\"" . $conf->get_maxUID() . "\"></td>\n");
echo ("<tr><th><p align=\"right\"><b>" . _("Minimum GID number") . ": </b></th> <th><p align=\"left\"><input size=6 type=\"text\" name=\"minGID\" value=\"" . $conf->get_minGID() . "\">\n"); echo ("<td><p align=\"left\">" . _("These are the minimum and maximum numbers to use for user IDs") . "</p></td></tr>\n");
echo ("&nbsp <b>" . _("Maximum GID number") . ": </b><input size=6 type=\"text\" name=\"maxGID\" value=\"" . $conf->get_maxGID() . "\"></th>\n"); echo ("<tr><td align=\"right\"><b>" . _("Minimum GID number") . ": </b></td> <td align=\"left\"><input size=6 type=\"text\" name=\"minGID\" value=\"" . $conf->get_minGID() . "\">\n");
echo ("<th><p align=\"left\">" . _("These are the minimum and maximum numbers to use for group IDs") . "</th></tr>\n"); echo ("&nbsp <b>" . _("Maximum GID number") . ": </b><input size=6 type=\"text\" name=\"maxGID\" value=\"" . $conf->get_maxGID() . "\"></td>\n");
echo ("<tr><th><p align=\"right\"><b>" . _("Minimum Machine number") . ": </b></th> <th><p align=\"left\"><input size=6 type=\"text\" name=\"minMach\" value=\"" . $conf->get_minMachine() . "\">\n"); echo ("<td><p align=\"left\">" . _("These are the minimum and maximum numbers to use for group IDs") . "</p></td></tr>\n");
echo ("&nbsp <b>" . _("Maximum Machine number") . ": </b><input size=6 type=\"text\" name=\"maxMach\" value=\"" . $conf->get_maxMachine() . "\"></th>\n"); echo ("<tr><td align=\"right\"><b>" . _("Minimum Machine number") . ": </b></td> <td align=\"left\"><input size=6 type=\"text\" name=\"minMach\" value=\"" . $conf->get_minMachine() . "\">\n");
echo ("<th><p align=\"left\">" . _("These are the minimum and maximum numbers to use for Samba hosts. <br> Do not use the same range as for user IDs.") . "</th></tr>\n"); echo ("&nbsp <b>" . _("Maximum Machine number") . ": </b><input size=6 type=\"text\" name=\"maxMach\" value=\"" . $conf->get_maxMachine() . "\"></td>\n");
echo ("<tr><th>&nbsp</th></tr>"); echo ("<td><p align=\"left\">" . _("These are the minimum and maximum numbers to use for Samba hosts. <br> Do not use the same range as for user IDs.") . "</p></td></tr>\n");
echo ("<tr><th><p align=\"right\"><b>" . _("Default shell") . ": </b></th> <th><p align=\"left\"><input type=\"text\" name=\"defShell\" value=\"" . $conf->get_defaultShell() . "\"></th>\n"); echo ("<tr><td>&nbsp</td></tr>");
echo ("<th><p align=\"left\">" . _("Default shell when creating new users.") . "</th></tr>\n"); echo ("<tr><td><p align=\"right\"><b>" . _("Attributes in User List:") . "</b></p></td><td><input size=50 type=\"text\" name=\"usrlstattr\" value=\"" . $conf->get_userlistAttributes() . "\"></td>");
echo ("<tr><th><p align=\"right\"><b>" . _("Shell list") . ": </b></th> <th><p align=\"left\"><input type=\"text\" size=50 name=\"shellList\" value=\"" . $conf->get_shellList() . "\"></th>\n"); echo ("<td rowspan=3><p>" . _("This is the list of attributes to show in the lists. The entries can either be predefined values (e.g. '#cn' or '#gidNumber') or individual ones (e.g. 'cn:Group Name'). The entries are seperated by semicolons.")
echo ("<th><p align=\"left\">" . _("List of possible shells when creating new users. <br> The entries have to be separated by semicolons.") . "</th></tr>\n"); . "</p></td></tr>");
echo ("<tr><th>&nbsp</th></tr>"); echo ("<tr><td><p align=\"right\"><b>" . _("Attributes in Group List:") . "</b></p></td><td><input size=50 type=\"text\" name=\"grplstattr\" value=\"" . $conf->get_grouplistAttributes() . "\"></td></tr>");
echo ("<tr><th><p align=\"right\"><b>" . _("New Password") . ": </b></th> <th><p align=\"left\"><input type=\"password\" name=\"pass1\"></th></tr>\n"); echo ("<tr><td><p align=\"right\"><b>" . _("Attributes in Host List:") . "</b></p></td><td><input size=50 type=\"text\" name=\"hstlstattr\" value=\"" . $conf->get_hostlistAttributes() . "\"></td></tr>");
echo ("<tr><th><p align=\"right\"><b>" . _("Reenter Password") . ": </b></th> <th><p align=\"left\"><input type=\"password\" name=\"pass2\"></th></tr>\n"); echo ("<tr><td>&nbsp</td></tr>");
echo ("<input type=\"hidden\" name=\"passwd\" value=\"" . $passwd . "\"><br>\n"); echo ("<tr><td><p align=\"right\"><b>" . _("Default shell") . ": </b></p></td> <td><p align=\"left\"><input type=\"text\" name=\"defShell\" value=\"" . $conf->get_defaultShell() . "\"></td>\n");
echo ("<tr><th>&nbsp</th></tr>\n"); echo ("<td><p align=\"left\">" . _("Default shell when creating new users.") . "</p></td></tr>\n");
echo ("<tr><th>&nbsp</th></tr>\n"); echo ("<tr><td><p align=\"right\"><b>" . _("Shell list") . ": </b></p></td> <td><p align=\"left\"><input type=\"text\" size=50 name=\"shellList\" value=\"" . $conf->get_shellList() . "\"></td>\n");
echo ("<tr><th></th><th><p align=\"left\"><input type=\"submit\" name=\"submitconf\" value=\"" . _("Submit") . "></th></tr>\n"); echo ("<td><p align=\"left\">" . _("List of possible shells when creating new users. <br> The entries have to be separated by semicolons.") . "</p></td></tr>\n");
echo ("</table>\n"); echo ("</table>\n");
echo ("<p>&nbsp</p>\n");
echo ("<table align=\"left\" border=\"0\">");
echo ("<tr><td bgcolor=\"red\" align=\"right\"><b>" . _("New Password") . ": </b></td> <td bgcolor=\"red\" align=\"left\"><input type=\"password\" name=\"pass1\"></td>");
echo ("<td rowspan=2 width=10></td><td rowspan=2>" . _("Optional") . "</td></tr>\n");
echo ("<tr><td bgcolor=\"red\" align=\"right\"><b>" . _("Reenter Password") . ": </b></td> <td bgcolor=\"red\" align=\"left\"><input type=\"password\" name=\"pass2\"></td></tr>\n");
echo ("</table>\n");
echo ("<p>&nbsp</p>\n");
echo ("<p>&nbsp</p>\n");
echo ("<table align=\"left\" border=\"0\">");
echo ("<tr><td align=\"left\"><pre><input type=\"submit\" name=\"submitconf\" value=\"" . _("Submit") . "\"> <input type=\"reset\" name=\"resetconf\" value=\"" . _("Reset") . "\">");
echo ("<input type=\"button\" name=\"back\" value=\"Abort\" onClick=\"self.location.href='../templates/login.php'\"></pre></td></tr>\n");
echo ("</table>\n");
echo ("<input type=\"hidden\" name=\"passwd\" value=\"" . $passwd . "\"><br>\n");
echo ("</form>\n"); echo ("</form>\n");
echo ("</body>\n"); echo ("</body>\n");
echo ("</html>\n"); echo ("</html>\n");

View File

@ -106,6 +106,21 @@ if (chop($shellList) == "") {
echo ("\n<br><br><br><a href=\"javascript:history.back()\">" . _("Back to preferences...") . "</a>"); echo ("\n<br><br><br><a href=\"javascript:history.back()\">" . _("Back to preferences...") . "</a>");
exit; exit;
} }
if (chop($usrlstattr) == "") {
echo _("<font color=\"red\"><b>" . _("No attributes in user list!") . "</b></font>");
echo ("\n<br><br><br><a href=\"javascript:history.back()\">" . _("Back to preferences...") . "</a>");
exit;
}
if (chop($grplstattr) == "") {
echo _("<font color=\"red\"><b>" . _("No attributes in group list!") . "</b></font>");
echo ("\n<br><br><br><a href=\"javascript:history.back()\">" . _("Back to preferences...") . "</a>");
exit;
}
if (chop($hstlstattr) == "") {
echo _("<font color=\"red\"><b>" . _("No attributes in host list!") . "</b></font>");
echo ("\n<br><br><br><a href=\"javascript:history.back()\">" . _("Back to preferences...") . "</a>");
exit;
}
// set new preferences // set new preferences
$conf->set_Host($host); $conf->set_Host($host);
@ -124,6 +139,9 @@ $conf->set_minMachine($minMach);
$conf->set_maxMachine($maxMach); $conf->set_maxMachine($maxMach);
$conf->set_defaultShell($defShell); $conf->set_defaultShell($defShell);
$conf->set_shellList($shellList); $conf->set_shellList($shellList);
$conf->set_userlistAttributes($usrlstattr);
$conf->set_grouplistAttributes($grplstattr);
$conf->set_hostlistAttributes($hstlstattr);
// check if password was changed // check if password was changed
if ($pass1 != $pass2) { if ($pass1 != $pass2) {
@ -137,7 +155,7 @@ if ($pass1 != "") {
} }
// save settings and display new settings // save settings and display new settings
$conf->save(); $conf->save();
echo ("<b>" . _("Saving the following settings:") . "</b><br><br>"); echo ("<b>" . _("The following settings were saved:") . "</b><br><br>");
$conf->printconf(); $conf->printconf();
echo ("<br><br><br><br><br><a href=\"../templates/login.php\" target=\"_top\">" . _("Back to Login") . "</a>"); echo ("<br><br><br><br><br><a href=\"../templates/login.php\" target=\"_top\">" . _("Back to Login") . "</a>");

View File

@ -46,3 +46,21 @@ shellList: /bin/bash;/bin/sh;/bin/false
# default shell when creating new user # default shell when creating new user
defaultShell: /bin/bash defaultShell: /bin/bash
# list of attributes to show in user list
# entries can either be predefined values (e.g. '#cn' or '#uid')
# or individual ones (e.g. 'uid:User ID' or 'host:Host Name')
# values have to be seperated by semicolons
userlistAttributes: #uid;#cn;#uidNumber;#gidNumber
# list of attributes to show in group list
# entries can either be predefined values (e.g. '#cn' or '#gidNumber')
# or individual ones (e.g. 'cn:Group Name')
# values have to be seperated by semicolons
grouplistAttributes: #cn;#gidNumber
# list of attributes to show in host list
# entries can either be predefined values (e.g. '#cn' or '#uid')
# or individual ones (e.g. 'cn:Host Name')
# values have to be seperated by semicolons
hostlistAttributes: #uid;#uidNumber;#description

View File

@ -47,6 +47,9 @@ $MinMachine = $conf->get_minMachine();
$MaxMachine = $conf->get_maxMachine(); $MaxMachine = $conf->get_maxMachine();
$DefaultShell = $conf->get_defaultShell(); $DefaultShell = $conf->get_defaultShell();
$ShellList = $conf->get_shellList(); $ShellList = $conf->get_shellList();
$userlistAttributes = $conf->get_userlistAttributes();
$grouplistAttributes = $conf->get_grouplistAttributes();
$hostlistAttributes = $conf->get_hostlistAttributes();
echo ("done<br>"); echo ("done<br>");
// next we modify them and save lam.conf // next we modify them and save lam.conf
echo ("Changing preferences..."); echo ("Changing preferences...");
@ -68,6 +71,9 @@ $conf->set_minMachine("3");
$conf->set_maxMachine("47"); $conf->set_maxMachine("47");
$conf->set_defaultShell("/usr/bin/test"); $conf->set_defaultShell("/usr/bin/test");
$conf->set_shellList("/usr/bin/test;/usr/bin/false"); $conf->set_shellList("/usr/bin/test;/usr/bin/false");
$conf->set_userlistAttributes("#uid;#cn");
$conf->set_grouplistAttributes("#gidNumber;#cn;#memberUID");
$conf->set_hostlistAttributes("#cn;#uid;#description");
$conf->save(); $conf->save();
echo ("done<br>"); echo ("done<br>");
// at last all preferences are read from lam.conf and compared // at last all preferences are read from lam.conf and compared
@ -92,6 +98,9 @@ if ($conf->get_minMachine() != "3") echo ("<br><font color=\"#FF0000\">Saving ma
if ($conf->get_maxMachine() != "47") echo ("<br><font color=\"#FF0000\">Saving minMachine failed!</font><br>"); if ($conf->get_maxMachine() != "47") echo ("<br><font color=\"#FF0000\">Saving minMachine failed!</font><br>");
if ($conf->get_defaultShell() != "/usr/bin/test") echo ("<br><font color=\"#FF0000\">Saving default shell failed!</font><br>"); if ($conf->get_defaultShell() != "/usr/bin/test") echo ("<br><font color=\"#FF0000\">Saving default shell failed!</font><br>");
if ($conf->get_shellList() != "/usr/bin/test;/usr/bin/false") echo ("<br><font color=\"#FF0000\">Saving shellList failed!</font><br>"); if ($conf->get_shellList() != "/usr/bin/test;/usr/bin/false") echo ("<br><font color=\"#FF0000\">Saving shellList failed!</font><br>");
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>");
echo ("done<br>"); echo ("done<br>");
// restore old values // restore old values
echo ("Restoring old preferences..."); echo ("Restoring old preferences...");
@ -112,6 +121,9 @@ $conf->set_minMachine($MinMachine);
$conf->set_maxMachine($MaxMachine); $conf->set_maxMachine($MaxMachine);
$conf->set_defaultShell($DefaultShell); $conf->set_defaultShell($DefaultShell);
$conf->set_shellList($ShellList); $conf->set_shellList($ShellList);
$conf->set_userlistAttributes($userlistAttributes);
$conf->set_grouplistAttributes($grouplistAttributes);
$conf->set_hostlistAttributes($hostlistAttributes);
$conf->save(); $conf->save();
echo ("done<br>"); echo ("done<br>");
// finished // finished