Some preparations for supporting principal memberships

This commit is contained in:
Lennart
2025-02-02 11:34:10 +01:00
parent 93d16f02d9
commit 031d94c9d1
18 changed files with 54 additions and 27 deletions

View File

@@ -19,7 +19,7 @@ pub async fn route_addressbook<AS: AddressbookStore>(
user: User,
) -> Result<impl Responder, rustical_store::Error> {
let (owner, addrbook_id) = path.into_inner();
if owner != user.id {
if !user.is_principal(&owner) {
return Ok(HttpResponse::Unauthorized().body("Unauthorized"));
}
Ok(AddressbookPage {
@@ -35,7 +35,7 @@ pub async fn route_addressbook_restore<AS: AddressbookStore>(
user: User,
) -> Result<impl Responder, rustical_store::Error> {
let (owner, addressbook_id) = path.into_inner();
if owner != user.id {
if !user.is_principal(&owner) {
return Ok(HttpResponse::Unauthorized().body("Unauthorized"));
}
store.restore_addressbook(&owner, &addressbook_id).await?;

View File

@@ -19,7 +19,7 @@ pub async fn route_calendar<C: CalendarStore>(
user: User,
) -> Result<impl Responder, rustical_store::Error> {
let (owner, cal_id) = path.into_inner();
if owner != user.id {
if !user.is_principal(&owner) {
return Ok(HttpResponse::Unauthorized().body("Unauthorized"));
}
Ok(CalendarPage {
@@ -35,7 +35,7 @@ pub async fn route_calendar_restore<CS: CalendarStore>(
user: User,
) -> Result<impl Responder, rustical_store::Error> {
let (owner, cal_id) = path.into_inner();
if owner != user.id {
if !user.is_principal(&owner) {
return Ok(HttpResponse::Unauthorized().body("Unauthorized"));
}
store.restore_calendar(&owner, &cal_id).await?;