chore: migrate batch4 client DDP callers + add 6 REST endpoints

Merged
GG
3mo ago
+828-229

Summary

Continues the DDP→REST sweep started in #40659, #40711, #40675, #40724. This batch tackles the next set of client DDP callers whose endpoints didn't exist yet. The DDP methods stay registered for external SDK/mobile clients and each gets a methodDeprecationLogger.method(NAME, '9.0.0', '/v1/...') line pointing at the new REST route.

New endpoints

DDP methodREST endpointNotes
verifyEmail + afterVerifyEmailPOST /v1/users.verifyEmailSingle call: marks email verified + anonymous→user role swap
cloud:connectWorkspacePOST /v1/cloud.connectWorkspacemanage-cloud perm
authorization:addPermissionToRolePOST /v1/permissions.addRoleper-permission perm check reused
authorization:removeRoleFromPermissionPOST /v1/permissions.removeRoleper-permission perm check reused
clearIntegrationHistoryPOST /v1/integrations.history.clearmanage-(own-)outgoing-integrations
replayOutgoingIntegrationPOST /v1/integrations.outgoing.replaymanage-(own-)outgoing-integrations

Endpoint extensions

  • POST /v1/users.setAvatar now accepts an optional service multipart field (stored as avatarOrigin), replacing setAvatarFromService DDP method.

Server-side hook

  • afterLogoutCleanUpCallback + Apps.IPostUserLoggedOut move into a Accounts.onLogout handler + /v1/users.logout post-token-unset block. Client sdk.call('logoutCleanUp') dropped — both DDP and REST logout paths now fire the callbacks server-side.

Reverted from this batch

  • getRoomByTypeAndName — per review feedback, kept as DDP. It may be replaced by a breaking change (e.g. URL routing moving directly to rid) so the migration is deferred.

Known follow-ups

  • Per-user 2FA TOTP (#40734, draft), OAuth admin services, audit EE, search providers, webdav, presence — still need new endpoints; will be split into smaller domain PRs.
  • resetPassword (web-ui-registration) + checkRegistrationSecretURL + anonymous registerUser flow remain.

Test plan

  • CI green (lint + typecheck pass with rebuilt rest-typings dist)
  • Admin → Users → upload avatar with OAuth provider service → avatarOrigin matches the service name
  • Workspace registration → connect with offline token → success
  • Verify email link → role swaps anonymous→user
  • Admin → Permissions table → grant/revoke a role to a permission
  • Admin → Integrations → clear history + replay an outgoing webhook entry
  • Log out (DDP) → afterLogoutCleanUpCallback server logs fire
  • Log out via POST /v1/users.logout → same callbacks fire

🤖 Generated with Claude Code

Summary by CodeRabbit

  • New Features
    • Added authenticated REST endpoints for cloud workspace connection, integration history clearing/replay, permission role add/remove, and email verification.
    • Avatar uploads now optionally preserve the original service source.
  • Bug Fixes
    • Logout cleanup and post-email verification now execute server-side reliably for both REST and DDP flows.
    • Replay/clear and permission role actions now follow the newer REST request/response paths.
  • Chores
    • Legacy DDP actions remain available, with deprecation notices pointing to the new REST endpoints.

Task: ARCH-2267