Add a global tenant switch (tenant.auto_accept_invitation /
WEKNORA_TENANT_AUTO_ACCEPT_INVITATION, default false). When enabled,
inviting an already-registered user adds them to the tenant as an
active member immediately, instead of creating a pending invitation
the invitee must accept from their inbox.
Backend:
- CreateInvitation reads the switch and, when on, calls the new shared
addMemberAndRespond helper (extracted from TenantMemberHandler.AddMember)
to persist the member and write the HTTP response. Both call sites
share it so the sentinel->status mapping can't drift apart.
- Register the setting in the system_setting registry (bool, default
false).
- Expose the switch as capabilities.auto_accept_invitation on
GET /auth/me, so the SPA can adapt the invite popup without calling
the super-admin settings API.
- Cover enabled/disabled, already-a-member, unknown email, owner role
rejection, and nil member service with unit tests.
Frontend:
- The invite popup adapts to the mode. With auto-accept, the form
submits directly (button reads "Send", no "confirm invitation" step)
and refreshes the member roster silently (no toast; the new row is
the feedback). The classic two-step flow is unchanged when off.
- Fix capabilities hydration: refreshFromAuthMe (the only reader of
/auth/me capabilities) was invoked solely from the invitation-token
flow, so on page reload can_create_tenant and auto_accept_invitation
stayed at their initial false. Trigger it from initFromStorage once a
token is restored so deployment switches are reconciled with the live
server.