Added option 'Login user'

SVN revision: 461
This commit is contained in:
2003-03-31 08:52:13 +00:00
parent 01789e9387
commit 0e377d146c
2 changed files with 33 additions and 2 deletions
+15 -1
View File
@@ -828,6 +828,7 @@ only. When the browser is restarted, the password must be re-entered.<P>
<LI><b><code>Password file = &lt;file&gt;</code></b>
<LI><b><code>Login expiration = &lt;hours&gt;</code></b>
<LI><b><code>Admin user = &lt;user list&gt;</code></b>
<LI><b><code>Login user = &lt;user list&gt;</code></b>
</ul>
<p>
An alternative to the read/write/admin passwords is the user level access with a
@@ -880,7 +881,20 @@ for example, makes the password expire after one day.<p>
The <b><code>Admin user = &lt;user list&gt;</b></code> is a list of one or more user names,
which have admin rights. The can execute the <b><code>Admin</code></b> command to directly
edit elogd.cfg through the web and modify other users via the <b><code>Config</code></b>
command.
command.<p>
The <b><code>Login user = &lt;user list&gt;</b></code> is a list of users who can
log in to a specific logbook. This option can be used with a global password file. If a
<b><code>Password file</code></b> is present under the <b><code>[global]</b></code>
section, the registered users in that password file can log in to all logbooks. It might
be required that only certain users can log in to certain logbooks. This can be achieved
with the <b><code>Login user</code></b> option, places in each individual logbook
section in the configuration file. Only those users listed in this statement can log in
to the logbook where the statement is defined. This method has the advantage over the
option of definining individual password files for individual logbooks that only one
central password file exists. So if a user changes her/his password, this becomes then
valid for all logbooks. If there would be individual logbook password files, one would
have to change the password in all logbooks individually.<p>
<ul>
<LI><b><code>Self register = 0|1|2|3</code></b>
+18 -1
View File
@@ -6,6 +6,9 @@
Contents: Web server program for Electronic Logbook ELOG
$Log$
Revision 1.60 2003/03/31 08:52:13 midas
Added option 'Login user'
Revision 1.59 2003/03/28 10:21:31 midas
Use 'Icon comment' in filter display
@@ -10512,13 +10515,27 @@ int i;
BOOL check_user_password(LOGBOOK *lbs, char *user, char *password, char *redir)
{
char status, str[256], upwd[256], full_name[256], email[256];
char status, str[1000], upwd[256], full_name[256], email[256];
char list[MAX_N_LIST][NAME_LENGTH];
int i, n;
if (lbs == NULL)
status = get_user_line("global", user, upwd, full_name, email, NULL);
else
status = get_user_line(lbs->name, user, upwd, full_name, email, NULL);
if (getcfg(lbs->name, "Login user", str) && user[0])
{
n = strbreak(str, list, MAX_N_LIST);
for (i=0 ; i<n ; i++)
if (strcmp(user, list[i]) == 0)
break;
/* invalid user if name not in list */
if (i == n)
status = 2;
}
if (status == 1)
{
if (user[0] && strcmp(password, upwd) == 0)