fix: no authentication check if no auth users

This commit is contained in:
sigoden
2024-12-11 08:57:30 +08:00
parent bc6c573acb
commit ab4ef06cb8
2 changed files with 13 additions and 0 deletions

View File

@@ -102,6 +102,9 @@ impl AccessControl {
authorization: Option<&HeaderValue>,
guard_options: bool,
) -> (Option<String>, Option<AccessPaths>) {
if self.users.is_empty() {
return (None, Some(AccessPaths::new(AccessPerm::ReadWrite)));
}
if let Some(authorization) = authorization {
if let Some(user) = get_auth_user(authorization) {
if let Some((pass, paths)) = self.users.get(&user) {