mirror of
https://github.com/GothenburgBitFactory/taskchampion-sync-server.git
synced 2025-08-02 23:48:38 +02:00
Allow disabling automatic creation of clients
This may be useful in multi-user deployment scenarios where some external administrative tools are used to create new clients.
This commit is contained in:
parent
4de5c9a345
commit
3a794341ce
8 changed files with 117 additions and 26 deletions
|
@ -32,6 +32,7 @@ pub(crate) const SNAPSHOT_REQUEST_HEADER: &str = "X-Snapshot-Request";
|
|||
pub(crate) struct ServerState {
|
||||
pub(crate) server: Server,
|
||||
pub(crate) client_id_allowlist: Option<HashSet<Uuid>>,
|
||||
pub(crate) create_clients: bool,
|
||||
}
|
||||
|
||||
impl ServerState {
|
||||
|
@ -87,6 +88,7 @@ mod test {
|
|||
let state = ServerState {
|
||||
server: Server::new(Default::default(), InMemoryStorage::new()),
|
||||
client_id_allowlist: None,
|
||||
create_clients: true,
|
||||
};
|
||||
let req = actix_web::test::TestRequest::default()
|
||||
.insert_header((CLIENT_ID_HEADER, client_id.to_string()))
|
||||
|
@ -101,6 +103,7 @@ mod test {
|
|||
let state = ServerState {
|
||||
server: Server::new(Default::default(), InMemoryStorage::new()),
|
||||
client_id_allowlist: Some([client_id_ok].into()),
|
||||
create_clients: true,
|
||||
};
|
||||
let req = actix_web::test::TestRequest::default()
|
||||
.insert_header((CLIENT_ID_HEADER, client_id_ok.to_string()))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue