Browse Source

melib/imap: don't manually check for mailbox permissions

jmap-eventsource
Manos Pitsidianakis 1 year ago
parent
commit
a1e3f269de
Signed by untrusted user: epilys GPG Key ID: 73627C2F690DF710
  1. 16
      melib/src/backends/imap.rs

16
melib/src/backends/imap.rs

@ -622,25 +622,9 @@ impl MailBackend for ImapType {
}
let dest_path = {
let mailboxes = uid_store.mailboxes.lock().await;
let mailbox = mailboxes
.get(&source_mailbox_hash)
.ok_or_else(|| MeliError::new("Source mailbox not found"))?;
if move_ && !mailbox.permissions.lock().unwrap().delete_messages {
return Err(MeliError::new(format!(
"You are not allowed to delete messages from mailbox {}",
mailbox.path()
)));
}
let mailbox = mailboxes
.get(&destination_mailbox_hash)
.ok_or_else(|| MeliError::new("Destination mailbox not found"))?;
if !mailbox.permissions.lock().unwrap().create_messages {
return Err(MeliError::new(format!(
"You are not allowed to create messages in mailbox {}",
mailbox.path()
)));
}
mailbox.imap_path().to_string()
};
let mut response = Vec::with_capacity(8 * 1024);

Loading…
Cancel
Save