Repository navigation
feat(web): let each brand choose its Google account in Brand settings > Integrations (brand access PR 15) - #2112
Merged
gkhngyk merged 12 commits intoNov 4, 2026
Conversation
…ign-ins (brand access PR 14, 00470) - 00470: integration_accounts (the Account's Google logins and CMS sites, Composio's entity and connected account ids, never a token) and brand_integrations (the sign-in each brand uses per provider, settings jsonb for later). The Account's Google rows are copied as sign-ins used by every brand; each CMS connection as a sign-in used by its brand. Triggers keep the pool in step while Settings > Integrations and the CMS cards still write the old tables, and give a new brand the Account's Google sign-ins. RLS: a brand's rows for people who can access it (user_brand_ids), a sign-in for people who can access a brand that uses it; the server writes. integration_connections loses its unused admin/manager write policy. - Server: lib/brand-integrations.js resolves a brand's connection; the GSC and GA syncs, the Action Center's Analytics tool and sources use it, and every Google call names the connected account (several may share a Composio entity). The property lists take ?brandId= for the brand's own sign-in; without it, the Account's list for All brands as before. - Web: lib/brand-integrations.ts; suggestion sources, AI Referral Traffic and Chat's Google reads ask it. Both resolvers read the Account's row until 00470 is applied. - Tests: resolver, schema, policy coverage (integration_connections off the deferred list), demo coverage, syncs, routes. Behaviour-neutral while everyone is 'all': every brand uses the Account's Google connection, as before. Co-Authored-By: Claude Opus 5.5 <[email protected]>
… database stub resolveBrandSources reads the brand's Analytics connection through lib/brand-integrations.js (00470), which asks for one row with maybeSingle; the generate test's PostgREST stub had no maybeSingle, so every generateActionsForBrand test threw. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…nd access PR 12, 00471) - Invite: role, then All brands or Selected brands with a brand picker (at least one); the invitation keeps the choice. Admins are always All brands. Only on plans with more than one brand. - Team: each person's row shows All brands or "N brands" to admins, with Edit brands; pending invitations show theirs. Admins only change it. - Roles & access: the Brands column shows the real scope (names for admins and for the person); Your access lists the person's brands. - 00471: accept_invitation joins the person with the invitation's role and brand scope and shares the invited brands that still exist, in one transaction; set_member_brand_access replaces a person's brands in one, the profile locked. Both service-role only. acceptInvitation falls back to the old path for All-brands invitations until 00471 is applied. - Help: settings/team-brands (approved: false). Co-Authored-By: Claude Opus 5.5 <[email protected]>
… access PR 13) The reverse of Settings > Team (BRAND-ACCESS §3.2): a People tab lists the members who can see the brand, with their role, by the same rule as the assignee pickers. Admins also see why (All brands, or shared with them), the e-mails, and a link to Team; anyone else names and roles only. The demo brand says it is everyone's. Help: team-brands gets the section. Co-Authored-By: Claude Opus 5.5 <[email protected]>
… > Integrations (brand access PR 15) - Brand settings > Integrations: Search Console and Analytics cards say which Google account the brand reads from (the workspace's, another brand's, its own) and which brands share it. Admins and managers who can access the brand use the same account as another brand (D6), connect another Google account (one more connected account under the Account's Composio entity, linked with allowMultiple, pending until active) or disconnect; the property is picked from that account's list. - Settings > Integrations: "Google per brand" lists which account each brand uses, with a link to change it. - API: GET /api/integrations/brands/:brandId and the use/connect/activate/ disconnect endpoints, brand access plus admin or manager; no Composio id leaves. A brand's own login no brand uses any more is removed. - Help: settings/google-per-brand (approved: false). Co-Authored-By: Claude Opus 5.5 <[email protected]>
…app's date format next-intl has no named 'short' date format here, so the card fell back to the raw date; formatDate is what Settings uses. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…rand in the demo guard The demo guard names every write route; the four Brand settings > Integrations routes name their brand in the path. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Brand access PRs 12 and 14 landed on main as ansvisor#2050 and ansvisor#2042 with review changes. Main's versions are kept, and PRs 13 and 15 and their fixes are re-applied on top: the integrations routes keep main's sign-in reach check (assertSignInReach) and per-brand property PUT routes next to the brand's own sign-in routes, and the demo guard names both. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01SvzkMf5TZg7yqwaSeMFba9
Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01SvzkMf5TZg7yqwaSeMFba9
gkhngyk
requested changes
Nov 4, 2026
gkhngyk
left a comment
Contributor
There was a problem hiding this comment.
- Switching or disconnecting a brand's Google account keeps
gsc_property/ga_property_id(brand-integrations.jsuse/activate/disconnect): clear them on any account change, and runassertSignInReachon the target account in/use. 2) The workspace-level lookups (integrations.jsstatus ~139, DELETE ~247, properties ~324) find the active account by entity alone, so they can pick up a brand's own login: pass the workspace row'scomposio_account_id. Small: an unfinished connect leaves a pendingintegration_accountsrow.
Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01SvzkMf5TZg7yqwaSeMFba9
…, and keep workspace lookups to the workspace's account Review on ansvisor#2112: - Using another account, finishing a login of the brand's own or disconnecting clears the brand's property for that product (gsc_property or ga_property_id): it was picked from the old account. - /use checks the target sign-in's reach (assertSignInReach): reading through it lists the properties of every brand that uses it. - Settings > Integrations' status, disconnect and property list find the workspace's account by the id its integration_connections row names, not by the entity alone, which brands' own logins share; with no id, the entity's first active account that is no brand's login. - Starting a login drops the person's unfinished ones, and anyone's older than a day, with their Composio accounts. - Help: google-per-brand says the property is cleared. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01SvzkMf5TZg7yqwaSeMFba9
Collaborator
Author
|
Thanks @gkhngyk, addressed in bd37581:
Help Locally: server lint, Generated by Claude Code |
Brand access PR 13 landed on main as ansvisor#2055. Main's People tab, team actions and Help are kept as they are; the branch now adds only PR 15's Integrations tab (its tab, import and messages next to People's) and the review fixes. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01SvzkMf5TZg7yqwaSeMFba9
This was referenced Nov 5, 2026
Closed
Closed
This was referenced Nov 5, 2026
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.
Summary
Brings brand access PR 15 onto main. PR 13 (Brand settings > People) landed separately as #2055, and
main(2881144) is merged into this branch, so the diff now holds only PR 15 plus the review fixes (19 files). No PR 13 file differs frommain.GET /api/integrations/brands/:brandIdplususe/connect/activate/DELETEper provider and brand, gated on brand access plus admin or manager. No Composio id leaves the server. A brand's own login that no brand uses any more is removed. The demo guard refuses these writes on the demo brand.gsc_property/ga_property_id) is cleared when its account changes or is removed (kept on a no-op use);/usechecks the target sign-in's reach (assertSignInReach) before switching;integration_connectionsrow names, never a brand's own login;web/messages/en.json, the brand settings page and its test). No migrations.settings/google-per-brand(new,approved: false); it says that changing or disconnecting the account clears the property.Related issue
Brand access series, PR 15. Follows #2042, #2050 and #2055 (PR 13).
Type of change
feat— New featurefix— Bug fixchore— Maintenance / dependenciesdocs— Documentation onlyrefactor— Code change that neither fixes a bug nor adds a featuretest— Adding or updating testsHow to test
cd server && npm test(5,659 passed, 4 skipped);cd web && yarn test(10,188 passed, 1 skipped).Checklist
feature/,fix/,chore/,docs/) — see CONTRIBUTING.mdyarn lintpasses (run fromweb/)yarn typecheckpasses (run fromweb/)yarn format:checkpasses (run fromweb/)help/(or no user-visible change) — see help/README.mdAlso run on 15c12bf: server
npm run lint,npm run format:check,npm test; webyarn build(with CI's placeholder env);bash supabase/build-schema.shleavesschema.sqlunchanged.🤖 Generated with Claude Code
https://claude.ai/code/session_01SvzkMf5TZg7yqwaSeMFba9