Finished conversion to lqusers from webusers

Note that you will need to regenerate the webusers.toml file
after this.

Part of my motivation for this is that this file is not strictly
for governing web permissions in the future.
This commit is contained in:
Dave Taht 2023-02-09 15:26:27 +00:00
parent 8ba5aed14e
commit a58ce5cd0b
4 changed files with 13 additions and 13 deletions

View File

@ -1,5 +1,5 @@
//! The `authentication` module provides authorization for use of the
//! local web UI on LibreQoS boxes. It maps to `/<install dir>/webusers.toml`
//! local web UI on LibreQoS boxes. It maps to `/<install dir>/lqusers.toml`
use log::{error, warn};
use serde::{Deserialize, Serialize};
@ -62,7 +62,7 @@ impl WebUsers {
let base_path = crate::EtcLqos::load()
.map_err(|_| AuthenticationError::UnableToLoadEtcLqos)?
.lqos_directory;
let filename = Path::new(&base_path).join("webusers.toml");
let filename = Path::new(&base_path).join("lqusers.toml");
Ok(filename)
}
@ -96,7 +96,7 @@ impl WebUsers {
Ok(Self::path()?.exists())
}
/// Try to load `webusers.toml`. If it is unavailable, create a new--empty--
/// Try to load `lqusers.toml`. If it is unavailable, create a new--empty--
/// file.
pub fn load_or_create() -> Result<Self, AuthenticationError> {
let path = Self::path()?;
@ -114,13 +114,13 @@ impl WebUsers {
Ok(users)
} else {
error!(
"Unable to deserialize webusers.toml. Error in next message."
"Unable to deserialize lqusers.toml. Error in next message."
);
error!("{:?}", parse_result);
Err(AuthenticationError::UnableToParse)
}
} else {
error!("Unable to read webusers.toml");
error!("Unable to read lqusers.toml");
Err(AuthenticationError::UnableToRead)
}
}
@ -164,7 +164,7 @@ impl WebUsers {
Ok(token)
}
/// Delete a user from `webusers.toml`
/// Delete a user from `lqusers.toml`
pub fn remove_user(
&mut self,
username: &str,
@ -260,11 +260,11 @@ pub enum AuthenticationError {
SerializationError(toml::ser::Error),
#[error("Unable to remove existing web users file")]
UnableToDelete,
#[error("Unable to open webusers.toml for writing. Check permissions?")]
#[error("Unable to open lqusers.toml for writing. Check permissions?")]
UnableToWrite,
#[error("Unable to read webusers.toml")]
#[error("Unable to read lqusers.toml")]
UnableToRead,
#[error("Unable to parse webusers.toml")]
#[error("Unable to parse lqusers.toml")]
UnableToParse,
#[error("User not found")]
UserNotFound,

View File

@ -550,7 +550,7 @@
}
function userManager() {
let html = "<p>For now, please use <em>bin/webusers</em> to manage users.</p>";
let html = "<p>For now, please use <em>bin/lqusers</em> to manage users.</p>";
$("#userManager").html(html);
}

View File

@ -22,9 +22,9 @@
<div class="card-body">
<h5 class="card-title">First Login</h5>
<p>
No <em>webusers.toml</em> file was found. This is probably the first time you've run
No <em>lqusers.toml</em> file was found. This is probably the first time you've run
the LibreQoS web system. If it isn't, then please check permissions on that file and
use the "bin/webusers" command to verify that your system is working.
use the "bin/lqusers" command to verify that your system is working.
</p>
<p class="alert alert-warning" role="alert">
This site will use a cookie to store your identification. If that's not ok,

View File

@ -22,7 +22,7 @@
<div class="card-body">
<h5 class="card-title">Login</h5>
<p>Please enter a username and password to access LibreQoS.</p>
<p>You can control access locally with <em>bin/webusers</em> from the console.</p>
<p>You can control access locally with <em>bin/lqusers</em> from the console.</p>
<table class="table">
<tr>
<td>Username</td>