feat(drive): tell UI the caller role per Drive

This commit is contained in:
Edouard Vanbelle
2026-06-23 00:09:12 +02:00
parent a82bae4136
commit 2fe9c9ffeb
3 changed files with 63 additions and 2 deletions
@@ -51,6 +51,17 @@ pub struct DriveWithRootName {
/// The drive's display name. Sourced from `storage.folders.name`
/// of the root folder via JOIN at read time.
pub root_folder_name: String,
/// Highest role the calling user holds on this drive (direct OR
/// group-mediated). Populated by `list_for_subjects` (which already
/// JOINs `role_grants` for accessibility, so the role is in scope at
/// query time). `None` for repo methods called without a caller
/// context (`get_by_id`, `get_by_ids`, `find_default_for_user`,
/// `create_personal_drive_atomic`) — the DTO layer omits the field
/// via `#[serde(skip_serializing_if = "Option::is_none")]`.
///
/// See [[project-caller-role-on-file-folder-dto]] for the pattern
/// extension to FileDto/FolderDto with a perf warning.
pub caller_role: Option<crate::domain::services::authorization::Role>,
}
#[async_trait::async_trait]