Add ListValidNamePrefixes command to protocol
Some checks failed
Build and test / check (push) Has been cancelled
Build and test / test (push) Has been cancelled
Build and test / docs (push) Has been cancelled
Build and test / build (push) Has been cancelled
Build and test / check-license (push) Has been cancelled

This commit is contained in:
2025-12-16 10:13:28 +09:00
parent 912f0e8971
commit 891963f4bc
3 changed files with 19 additions and 0 deletions

View File

@@ -181,6 +181,20 @@ async fn session_handler_with_db_connection(
let result = check_authorization(dbs_or_users, unix_user).await;
Response::CheckAuthorization(result)
}
Request::ListValidNamePrefixes => {
let mut result = Vec::with_capacity(unix_user.groups.len() + 1);
result.push(unix_user.username.to_owned());
for group in unix_user
.groups
.iter()
.filter(|x| *x != &unix_user.username)
{
result.push(group.to_owned());
}
Response::ListValidNamePrefixes(result)
}
Request::CompleteDatabaseName(partial_database_name) => {
// TODO: more correct validation here
if !partial_database_name