user permissions

This commit is contained in:
2025-07-19 13:38:58 +02:00
parent ec8e73507c
commit 496d5bdb2b
30 changed files with 1384 additions and 195 deletions

View File

@@ -5,7 +5,11 @@ use crate::domain::warren::{
auth_session::requests::FetchAuthSessionResponse,
file::{File, FilePath},
user::{LoginUserResponse, User},
warren::Warren,
user_warren::UserWarren,
warren::{
CreateWarrenDirectoryResponse, DeleteWarrenDirectoryResponse, DeleteWarrenFileResponse,
ListWarrenFilesResponse, RenameWarrenEntryResponse, UploadWarrenFilesResponse, Warren,
},
},
ports::{AuthNotifier, FileSystemNotifier, WarrenNotifier},
};
@@ -28,27 +32,27 @@ impl WarrenNotifier for NotifierDebugLogger {
tracing::debug!("[Notifier] Fetched warren {}", warren.name());
}
async fn warren_files_listed(&self, warren: &Warren, files: &Vec<File>) {
async fn warren_files_listed(&self, response: &ListWarrenFilesResponse) {
tracing::debug!(
"[Notifier] Listed {} file(s) in warren {}",
files.len(),
warren.name()
response.files().len(),
response.warren().name()
);
}
async fn warren_directory_created(&self, warren: &Warren, path: &FilePath) {
async fn warren_directory_created(&self, response: &CreateWarrenDirectoryResponse) {
tracing::debug!(
"[Notifier] Created directory {} in warren {}",
path,
warren.name()
response.path(),
response.warren().name()
);
}
async fn warren_directory_deleted(&self, warren: &Warren, path: &FilePath) {
async fn warren_directory_deleted(&self, response: &DeleteWarrenDirectoryResponse) {
tracing::debug!(
"[Notifier] Deleted directory {} in warren {}",
path,
warren.name()
response.path(),
response.warren().name()
);
}
@@ -60,33 +64,28 @@ impl WarrenNotifier for NotifierDebugLogger {
);
}
async fn warren_files_uploaded(&self, warren: &Warren, paths: &[FilePath]) {
async fn warren_files_uploaded(&self, response: &UploadWarrenFilesResponse) {
tracing::debug!(
"[Notifier] Uploaded {} file(s) to warren {}",
paths.len(),
warren.name()
response.paths().len(),
response.warren().name()
);
}
async fn warren_file_deleted(&self, warren: &Warren, path: &FilePath) {
async fn warren_file_deleted(&self, response: &DeleteWarrenFileResponse) {
tracing::debug!(
"[Notifier] Deleted file {} from warren {}",
path,
warren.name(),
response.path(),
response.warren().name(),
);
}
async fn warren_entry_renamed(
&self,
warren: &Warren,
old_path: &crate::domain::warren::models::file::AbsoluteFilePath,
new_path: &FilePath,
) {
async fn warren_entry_renamed(&self, response: &RenameWarrenEntryResponse) {
tracing::debug!(
"[Notifier] Renamed file {} to {} in warren {}",
old_path,
new_path,
warren.name(),
response.old_path(),
response.path(),
response.warren().name(),
);
}
}
@@ -136,4 +135,91 @@ impl AuthNotifier for NotifierDebugLogger {
response.user().id()
);
}
async fn auth_user_warrens_fetched(&self, user_id: &Uuid, warren_ids: &Vec<UserWarren>) {
tracing::debug!(
"[Notifier] Fetched {} user warrens for authenticated user {}",
warren_ids.len(),
user_id
);
}
async fn auth_user_warrens_listed(&self, user: &User, warrens: &Vec<Warren>) {
tracing::debug!(
"[Notifier] Fetched {} warren(s) for authenticated user {}",
warrens.len(),
user.id()
);
}
async fn auth_warren_fetched(&self, user: &User, warren: &Warren) {
tracing::debug!(
"[Notifier] Fetched warren {} for authenticated user {}",
warren.name(),
user.id(),
);
}
async fn auth_warren_files_listed(&self, user: &User, response: &ListWarrenFilesResponse) {
tracing::debug!(
"[Notifier] Listed {} file(s) in warren {} for authenticated user {}",
response.files().len(),
response.warren().name(),
user.id()
);
}
async fn auth_warren_directory_created(
&self,
user: &User,
response: &CreateWarrenDirectoryResponse,
) {
tracing::debug!(
"[Notifier] Created directory {} in warren {} for authenticated user {}",
response.path(),
response.warren().name(),
user.id(),
);
}
async fn auth_warren_directory_deleted(
&self,
user: &User,
response: &DeleteWarrenDirectoryResponse,
) {
tracing::debug!(
"[Notifier] Deleted directory {} in warren {} for authenticated user {}",
response.path(),
response.warren().name(),
user.id(),
);
}
async fn auth_warren_files_uploaded(&self, user: &User, response: &UploadWarrenFilesResponse) {
tracing::debug!(
"[Notifier] Uploaded {} file(s) to warren {} for authenticated user {}",
response.paths().len(),
response.warren().name(),
user.id(),
);
}
async fn auth_warren_file_deleted(&self, user: &User, response: &DeleteWarrenFileResponse) {
tracing::debug!(
"[Notifier] Deleted file {} from warren {} for authenticated user {}",
response.path(),
response.warren().name(),
user.id(),
);
}
async fn auth_warren_entry_renamed(&self, user: &User, response: &RenameWarrenEntryResponse) {
tracing::debug!(
"[Notifier] Renamed file {} to {} in warren {} for authenticated user {}",
response.old_path(),
response.path(),
response.warren().name(),
user.id(),
);
}
}