mirror of
https://github.com/stalwartlabs/mail-server.git
synced 2025-09-08 21:14:13 +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?;
|
let cached_mailboxes = self.get_cached_messages(ctx.account_id).await?;
|
||||||
|
|
||||||
// Verify that the mailbox role is unique.
|
// Verify that the mailbox role is unique.
|
||||||
if !matches!(changes.role, SpecialUse::None)
|
if update
|
||||||
&& update
|
.as_ref()
|
||||||
.as_ref()
|
.is_none_or(|(_, m)| m.inner.role != changes.role)
|
||||||
.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()
|
return Ok(Err(SetError::invalid_properties()
|
||||||
.with_property(Property::Role)
|
.with_property(Property::Role)
|
||||||
.with_description(format!(
|
.with_description(format!(
|
||||||
|
|
Loading…
Add table
Reference in a new issue