Skip to content

#2353: a Microsoft 365 group's calendar opens by its address, read-only - #2387

Draft
ChrisFontanini wants to merge 3 commits into
UCSLabs:mainfrom
ChrisFontanini:feat/2353-group-calendars
Draft

ChrisFontanini wants to merge 3 commits into
UCSLabs:mainfrom
ChrisFontanini:feat/2353-group-calendars

Conversation

@ChrisFontanini

Copy link
Copy Markdown

Builds on #2361 (only the last commit is new here; this stays a draft until #2361 is merged).

Part of #2353: reading a Microsoft 365 group's calendar under Group.Read.All. Writing (Group.ReadWrite.All) is not in this pull request.

What changes for the person using MailCraft

Open Shared Calendar takes a Microsoft 365 group's address. The group's calendar appears under Shared Calendars, read-only, with its events, and without the reminder Exchange puts on every group event. The dialog's label now says "person or Microsoft 365 group".

Until the organisation's administrator has given Group.Read.All, the calendar stays on the list and the dialog says why: "team@example.org is a Microsoft 365 group. Its calendar opens once your organisation's administrator allows MailCraft to read groups (Group.Read.All); it waits on your list until then." Once the permission is given, the next listing reads it.

How it works:

  • Graph refuses a group at /users/{address} (403 ErrorGroupIsUsedInNonGroupURI, A Microsoft 365 group's address in Open Shared Calendar or Add Shared Mailbox says no access, or tries again forever #2360). Only then does the calendar job ask for a token of its own with Group.Read.All and the sign-in scopes. It is never on a sign-in's page, never in the one question, and never asked for when there is no group. It looks the group up with GET /groups?$filter=mail eq '…' (unified groups only, the address must match), and reads /groups/{id}/calendar and /calendar/calendarView.
  • The group's id is kept with the address (OpenedCalendar.group, a validated GUID), so later jobs read the group directly and never ask at its address again.
  • The calendar is always Rights::Read, whatever canEdit says.
  • A refusal of the groups' token stops only the group work: the job's own token and the contacts pass are untouched, and an unresolved group is said Unreachable, not "has no calendar".
  • Group downloads count toward the 20 calendars a job brings down.
  • Also fixed, because the new path made it likelier: the engine now takes in events for a calendar opened by address only once the list has brought that calendar. A late download can no longer create one with edit rights, or bring back one the owner removed mid-refresh. This holds for people's calendars opened by address too.

Questions for the owners

  1. The administrator's approval. Group.Read.All is added to admin_scope(), following the rule in docs/mail-privacy-rules.md that one approval covers everything the program asks for. That means an administrator approving MailCraft also approves reading groups, before anyone opens one. Is that what you want, or should it stay out of the general approval and be approved only when a group is opened?

  2. Listing groups automatically. Outlook shows the groups you belong to without adding them. This PR keeps to what you approved: a group is read only once someone opens it by address. Listing groups could come next, in one of two ways:

    • Every Microsoft work account lists its groups (/me/memberOf, which Group.Read.All covers) unticked, like a shared mailbox's calendars (Shared mailboxes through Microsoft Graph (asks for three new permissions) #70), and a group is read once ticked.
    • The same, but only after the owner switches on a "Show my groups" option for the account. The permission is then still asked for only because the owner did something.

    Either way the address box stays, for groups you can read but don't belong to. Would you take either, and which?

How it was checked

  • New tests:

    • net graph::group_calendar_tests: lookup with OData quoting, non-unified groups and missing permission; reading at /groups/{id} only, read-only even when the stand-in says canEdit: true; events without reminders; hostile ids ask nothing.
    • host graph::run::groups_tests: a first open asks the groups' token once and reads at the group; waits without permission; a known group is never asked at its address; a distribution list stays refused; people alone and unticked groups ask no groups' token; a refused groups' token leaves the job's own.
    • engine calendar_opened_tests: the group's id kept and waiting for permission; late events neither bring back a removed calendar nor create one.
    • oauth::tests: exact scope of the groups' token, consent errors.
    • ui open_shared_tests: the new wording.
  • cargo xtask ci: all 15 steps passed (Linux, rust:latest container, Mesa's software Vulkan for the rendering tests).

  • ui_shot with {"host": {"graph": "openedGroup"}}: the waiting message, light and dark.

  • On a real tenant, as a member of a unified group, after an administrator granted Group.Read.All to the application: a Windows build of this branch opened the group's calendar under Shared Calendars, with its events, in the calendar view and in overlay. Before that, the network code was run against the live service read-only (lookup, calendar, about 200 events over three months, none with a reminder).

  • cargo xtask ci passes

  • A crash or data-loss fix has its regression test (late events creating or reviving a calendar opened by address: tested in calendar_opened_tests)

  • "Allow edits by maintainers" is ticked (the box beside Create pull request)

  • I have signed the CLA, or will by commenting on this pull request

Human-reviewed, AI-assisted, nobody's mailbox harmed.

@coderabbitai

coderabbitai Bot commented Dec 5, 2026

Copy link
Copy Markdown

Important

Draft PR not reviewed

Draft PRs are not automatically reviewed by default.

  • Trigger a manual review

To automatically review draft PRs, update your CodeRabbit configuration:

reviews:
  auto_review:
    drafts: true
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

Graph refuses /users/{group}/calendar and /users/{group}/mailFolders
with 403 ErrorGroupIsUsedInNonGroupURI. Open Shared Calendar took that
403 for a person who hadn't shared, and Add Shared Mailbox for an
ordinary error tried again at every Send/Receive. Both now go by the
code, whatever the status: OpenedWhy::IsGroup and SharedRefusal::IsGroup,
said in the dialog as a group MailCraft can't open yet (UCSLabs#2353).

Human-reviewed, AI-assisted, nobody's mailbox harmed.
@ChrisFontanini
ChrisFontanini force-pushed the feat/2353-group-calendars branch from e9f0e04 to b7ec4fe Compare December 5, 2026 19:42
…the comments

The three new texts get a draft translation in every catalogue, marked
fuzzy. The comments that describe telling a group's address apart cite
UCSLabs#2360, and say that reading a group is UCSLabs#2353.

Human-reviewed, AI-assisted, nobody's mailbox harmed.
…read-only

Open Shared Calendar takes a group's address. Graph refuses it at
/users/{address} (ErrorGroupIsUsedInNonGroupURI); the calendar job then
asks for a token with Group.Read.All by itself, looks the group up by
its address (a unified one only), and reads its calendar at
/groups/{id}/calendar. The group's id is kept with the address, so later
jobs read it there directly. The calendar can only be read, and its
events remind nobody. Without the permission (an administrator gives
it) the calendar waits on the list and the window says why.
Group.Read.All is in the administrator's approval with the rest and on
no sign-in's page.

Human-reviewed, AI-assisted, nobody's mailbox harmed.
@ChrisFontanini
ChrisFontanini force-pushed the feat/2353-group-calendars branch from b7ec4fe to 8163d85 Compare December 5, 2026 23:51
@sonarqubecloud

sonarqubecloud Bot commented Dec 5, 2026

Copy link
Copy Markdown

This branch has not been deployed

No deployments
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