Conversation
Because: - Admins need visibility into which Firefox browser services (Sync, Smart Window, Relay, VPN) a user has authorized so they can answer support questions about consent and connected services. - The previous attempt landed against a table shape that was later reverted; this rebuilds the admin surface on top of the consent ledger introduced in the auth-server rebuild. This commit: - Adds an accountAuthorizations query on DatabaseService that reads the per-(uid, scope, service, clientId) rows from fxa_oauth and returns scope, service, clientId, firstAuthorizedTosAt, and lastAuthorizedTosAt. Rows are ordered by lastAuthorizedTosAt desc, clientId is hex-encoded for transport, and BIGINT timestamps are coerced to numbers to match the declared API type regardless of driver behaviour. - Resolves the new field on the account REST response, gated by the existing ConnectedServices admin feature. - Adds an Authorized Browser Services section to the account detail page rendering one row per (service, scope, clientId) with both the first and last consent timestamps, plus an explanatory note clarifying that rows are OAuth consent records, not active usage. - Adds unit tests for the resolver, the React component, and the containing account page. The integration test creates the table inline so a stale fxa-shared:build cache cannot drop the test fixture.
Contributor
There was a problem hiding this comment.
Pull request overview
Re-exposes the rebuilt accountAuthorizations ledger (per (scope, service, clientId) consent rows from fxa_oauth) on the FxA admin panel so support can see which Firefox browser services a user has authorized. The data flows from a new DatabaseService.accountAuthorizations(uid) reader, through a new REST controller resolver gated by the ConnectedServices admin feature, into a new React table on the account detail page.
Changes:
- Add
DatabaseService.accountAuthorizations(uid)and a controller resolver wiring it into the account REST response, plus matchingAccountAuthorization/Accounttype updates. - Add an
AccountAuthorizationsReact component (with empty state) and render it in a new "Authorized Browser Services" section on the account search page. - Add unit/integration tests (incl. inline
accountAuthorizationstable creation in the DB spec) and a tinyadminPanel.spec.tsformatting tweak.
Reviewed changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| packages/fxa-admin-server/src/types.ts | Add AccountAuthorization interface and accountAuthorizations field on Account. |
| packages/fxa-admin-server/src/rest/account/account.controller.ts | Import type, fan-out new resolver in Promise.all, and add gated accountAuthorizations(account) method. |
| packages/fxa-admin-server/src/database/database.service.ts | New accountAuthorizations reader: query fxa_oauth.accountAuthorizations, hex-encode clientId, coerce BIGINTs, limit 50. |
| packages/fxa-admin-server/src/database/database.service.spec.ts | Inline-create the table fixture and add ordering/empty-result integration tests. |
| packages/fxa-admin-panel/src/components/PageAccountSearch/AccountAuthorizations/index.tsx | New table component with empty state. |
| packages/fxa-admin-panel/src/components/PageAccountSearch/AccountAuthorizations/index.test.tsx | Tests for empty/null/populated rendering. |
| packages/fxa-admin-panel/src/components/PageAccountSearch/Account/index.tsx | Wire new prop and add "Authorized Browser Services" section with explanatory note. |
| packages/fxa-admin-panel/src/components/PageAccountSearch/Account/index.test.tsx | Extend default fixture and add empty/populated rendering tests. |
| packages/functional-tests/tests/admin/adminPanel.spec.ts | Reflow an overly long line; no behavior change. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Because
accountAuthorizationstable was reverted; that table has since been rebuilt as a consent ledger, so the admin surface needs to be rebuilt against the new shape.This pull request
DatabaseService.accountAuthorizations(uid)that reads per-(scope, service, clientId) rows fromfxa_oauth, hex-encodingclientIdand coercingBIGINTtimestamps to numbers. Sort islastAuthorizedTosAt descwithservice/clientIdtiebreakers; capped at 50 rows.accountAuthorizationsfield on the account REST response inaccount.controller.ts, gated by the existingConnectedServicesadmin feature.AccountAuthorizationsReact component that renders Service / Scope / Client ID / First Authorized / Last Authorized columns, with an empty state.PageAccountSearch/Account/index.tsx) with an explanatory note clarifying rows are OAuth consent records, not active usage.AccountAuthorizationandAccountinterfaces infxa-admin-server/src/types.ts.Issue that this pull request solves
Closes: https://mozilla-hub.atlassian.net/browse/FXA-13668
Checklist
Other information
How to test:
yarn start infrastructurethenyarn start mza.Notes:
fxa_oauth.accountAuthorizations. No new migration or write path.AdminPanelFeature.ConnectedServices(existing admin feature flag).