JMAP for Calendars implementation (part 4)

This commit is contained in:
mdecimus
2025-10-09 19:02:33 +02:00
parent ec4963f46b
commit b84e3e85dd
56 changed files with 2008 additions and 355 deletions

View File

@@ -4,17 +4,15 @@
* SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-SEL
*/
use std::time::Instant;
use crate::core::{Command, ResponseCode, Session, StatusResponse};
use common::listener::SessionStream;
use directory::Permission;
use email::sieve::delete::SieveScriptDelete;
use imap_proto::receiver::Request;
use std::time::Instant;
use store::write::BatchBuilder;
use trc::AddContext;
use crate::core::{Command, ResponseCode, Session, StatusResponse};
impl<T: SessionStream> Session<T> {
pub async fn handle_deletescript(&mut self, request: Request<Command>) -> trc::Result<Vec<u8>> {
// Validate access
@@ -40,12 +38,7 @@ impl<T: SessionStream> Session<T> {
match self
.server
.sieve_script_delete(
&access_token.as_resource_token(),
document_id,
true,
&mut batch,
)
.sieve_script_delete(access_token, document_id, true, &mut batch)
.await
.caused_by(trc::location!())?
{

View File

@@ -47,10 +47,10 @@ impl<T: SessionStream> Session<T> {
let script_size = script_bytes.len() as i64;
// Check quota
let resource_token = self.state.access_token().as_resource_token();
let account_id = resource_token.account_id;
let access_token = self.state.access_token();
let account_id = access_token.primary_id();
self.server
.has_available_quota(&resource_token, script_bytes.len() as u64)
.has_available_quota(&access_token.as_resource_token(), script_bytes.len() as u64)
.await
.caused_by(trc::location!())?;
@@ -141,7 +141,7 @@ impl<T: SessionStream> Session<T> {
.with_blob_hash(blob_hash.clone()),
)
.with_current(script)
.with_tenant_id(&resource_token),
.with_access_token(access_token),
)
.caused_by(trc::location!())?;
@@ -185,7 +185,7 @@ impl<T: SessionStream> Session<T> {
.with_is_active(false)
.with_size(script_size as u32),
)
.with_tenant_id(&resource_token),
.with_access_token(access_token),
)
.caused_by(trc::location!())?;