mirror of
https://github.com/stalwartlabs/mail-server.git
synced 2025-09-06 20:14:43 +08:00
JMAP: Do not allow roles to be removed from system mailboxes (fixes 1977)
This commit is contained in:
parent
9403ef0748
commit
d3b7c80a62
1 changed files with 6 additions and 5 deletions
|
@ -439,12 +439,13 @@ impl MailboxSet for Server {
|
|||
let cached_mailboxes = self.get_cached_messages(ctx.account_id).await?;
|
||||
|
||||
// Verify that the mailbox role is unique.
|
||||
if !matches!(changes.role, SpecialUse::None)
|
||||
&& update
|
||||
.as_ref()
|
||||
.is_none_or(|(_, m)| m.inner.role != changes.role)
|
||||
if update
|
||||
.as_ref()
|
||||
.is_none_or(|(_, m)| m.inner.role != changes.role)
|
||||
{
|
||||
if cached_mailboxes.mailbox_by_role(&changes.role).is_some() {
|
||||
if !matches!(changes.role, SpecialUse::None)
|
||||
&& cached_mailboxes.mailbox_by_role(&changes.role).is_some()
|
||||
{
|
||||
return Ok(Err(SetError::invalid_properties()
|
||||
.with_property(Property::Role)
|
||||
.with_description(format!(
|
||||
|
|
Loading…
Add table
Reference in a new issue