mirror of
https://github.com/lennart-k/rustical.git
synced 2025-12-14 19:32:29 +00:00
Some preparations for supporting principal memberships
This commit is contained in:
@@ -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?;
|
||||
|
||||
@@ -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?;
|
||||
|
||||
Reference in New Issue
Block a user