Skip to content

[Web] return sender_acl in get/mailbox API#7348

Open
smpaz7467 wants to merge 1 commit into
mailcow:stagingfrom
smpaz7467:fix/api-get-mailbox-sender-acl
Open

[Web] return sender_acl in get/mailbox API#7348
smpaz7467 wants to merge 1 commit into
mailcow:stagingfrom
smpaz7467:fix/api-get-mailbox-sender-acl

Conversation

@smpaz7467

Copy link
Copy Markdown

What

sender_acl can be set via POST /api/v1/edit/mailbox, but it was never
returned by GET /api/v1/get/mailbox/{mailbox} or .../get/mailbox/all. An API
client therefore can't read back what it wrote, and can't see a mailbox's send-as
permissions at all.

Fix

Add the mailbox's internal send-as ACL to mailbox_details as sender_acl — an
array of send_as values from the sender_acl table (external = 0), mirroring the
field edit/mailbox accepts, so a get→edit round-trip is symmetric.

It's added in the same detailed-fields block as rl/quota info, so the deliberately
lightweight get/mailbox/reduced endpoint is unaffected.

Verification (live stack)

# before setting anything
GET /api/v1/get/mailbox/alicetest@example-test.com
  -> sender_acl: []                      (key now present, empty)

# set it
POST /api/v1/edit/mailbox  {"attr":{"sender_acl":["*"]},"items":[...]}  -> success

# read back
GET /api/v1/get/mailbox/alicetest@example-test.com   -> sender_acl: ["*"]
GET /api/v1/get/mailbox/all                           -> sender_acl: ["*"]
GET /api/v1/get/mailbox/reduced                       -> (no sender_acl — stays light)

Round-trip confirmed; reduced unchanged; php -l clean.

Fixes #7011

sender_acl can be set through edit/mailbox but was never returned by
get/mailbox, so an API client could not read back what it had written,
and get/mailbox/all / get/mailbox/{mailbox} both omitted it.

Add the mailbox's internal send-as ACL (the sender_acl table rows with
external = 0) to mailbox_details as sender_acl, an array of send_as
values, mirroring the field edit/mailbox accepts. It is added in the same
block as the other detailed fields, so the lightweight get/mailbox/reduced
endpoint is unaffected.

Fixes mailcow#7011

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant