Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Adds visibility into a user’s authorized Firefox browser services in the FxA Admin UI by plumbing fxa_oauth.accountAuthorizations through the admin server and rendering it on the account detail page.
Changes:
- Add
DatabaseService.accountAuthorizations(uid)and wire it intoAccountController.resolveAccountData. - Extend admin server
Accounttype withaccountAuthorizations, and add UI rendering/tests for a new “Authorized Browser Services” section. - Add DB test setup + integration/functional coverage for the new field/section.
Reviewed changes
Copilot reviewed 11 out of 11 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| packages/fxa-shared/test/db/models/oauth/helpers.ts | Includes the new oauth test schema SQL for accountAuthorizations. |
| packages/fxa-shared/test/db/models/oauth/accountAuthorizations.sql | Creates accountAuthorizations table for oauth test DB setup. |
| packages/fxa-admin-server/src/types.ts | Adds AccountAuthorization and accountAuthorizations to the Account shape. |
| packages/fxa-admin-server/src/rest/account/account.controller.ts | Resolves accountAuthorizations alongside other account detail fields. |
| packages/fxa-admin-server/src/database/database.service.ts | Implements the accountAuthorizations(uid) query (order/limit). |
| packages/fxa-admin-server/src/database/database.service.spec.ts | Adds integration tests for ordering and empty-state behavior. |
| packages/fxa-admin-panel/src/components/PageAccountSearch/AccountAuthorizations/index.tsx | New component to render authorizations table + empty state. |
| packages/fxa-admin-panel/src/components/PageAccountSearch/AccountAuthorizations/index.test.tsx | Unit tests for the new component. |
| packages/fxa-admin-panel/src/components/PageAccountSearch/Account/index.tsx | Adds the new “Authorized Browser Services” section under Connected Services. |
| packages/fxa-admin-panel/src/components/PageAccountSearch/Account/index.test.tsx | Updates account props + tests for new section/empty state. |
| packages/functional-tests/tests/admin/adminPanel.spec.ts | Adds API/UI functional checks for accountAuthorizations. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
176
to
+206
| private async resolveAccountData(account: Account) { | ||
| const [ | ||
| emails, | ||
| emailBounces, | ||
| securityEvents, | ||
| accountEvents, | ||
| totp, | ||
| recoveryKeys, | ||
| subscriptions, | ||
| carts, | ||
| backupCodes, | ||
| recoveryPhone, | ||
| linkedAccounts, | ||
| attachedClients, | ||
| passkeys, | ||
| accountAuthorizations, | ||
| ] = await Promise.all([ | ||
| this.emails(account), | ||
| this.emailBounces(account), | ||
| this.securityEvents(account), | ||
| this.accountEvents(account), | ||
| this.totp(account), | ||
| this.recoveryKeys(account), | ||
| this.subscriptions(account), | ||
| this.carts(account), | ||
| this.backupCodes(account), | ||
| this.recoveryPhone(account), | ||
| this.linkedAccounts(account), | ||
| this.attachedClients(account), | ||
| this.passkeys(account), | ||
| this.accountAuthorizations(account), |
Comment on lines
+146
to
+150
| return this.knexOauth('accountAuthorizations') | ||
| .select('scope', 'service', 'authorizedAt') | ||
| .where('uid', uidBuffer) | ||
| .orderBy('authorizedAt', 'desc') | ||
| .limit(10); |
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. This commit: - Adds an `accountAuthorizations` query on `DatabaseService` that reads the per-(uid, scope, service) rows from `fxa_oauth` ordered by `authorizedAt` desc. - 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, authorizedAt)`. - Adds an `accountAuthorizations.sql` fixture to the shared oauth test setup so integration tests can exercise the table. - Adds unit tests for the resolver, the React component, and the containing account page, plus a functional test that asserts the section appears in the admin panel UI.
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
This pull request
accountAuthorizations(uid)toDatabaseServicequeryingfxa_oauth.accountAuthorizations, ordered byauthorizedAtDESC, capped at 10accountAuthorizationsresolver helper toAccountController, gated by the existingConnectedServicesadmin feature, wired intoresolveAccountDataAccountAuthorizationsReact component rendering(service, scope, authorizedAt)rows under a new "Authorized Browser Services" section in the account detail pageIssue that this pull request solves
Closes: https://mozilla-hub.atlassian.net/browse/FXA-13405
Checklist
Other information
How to test:
http://localhost:8091/account-search, search for any account(service, scope, authorizedAt)newest first