Skip to content

Org members inherit access to all projects - #1412

Open
ad4mou wants to merge 4 commits into
mainfrom
fix/org-members-get-all-projects-access-1173
Open

Org members inherit access to all projects#1412
ad4mou wants to merge 4 commits into
mainfrom
fix/org-members-get-all-projects-access-1173

Conversation

@ad4mou

@ad4mou ad4mou commented Aug 18, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Members of an organization can now access all the org's project without an admin adding them to
    it one by one. This fixes new users getting stuck on "No project configured" bug.
  • Being in the org is what grants access; people still don't show up in the project's team
    list unless they were added there explicitly.
  • Their permission level comes from their org role, unless they've been given a specific
    role on the project, which wins.

Closes #1173

Review in cubic

@ad4mou
ad4mou marked this pull request as draft August 18, 2026 09:02

const membership = await getProjectMember(project.id, userId);
return membership ? project : null;
const role = await getUserRoleInProject(project.id, userId);

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

key change is here, this was the only place where the wrong function was called: getProjectMember

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 2 files

Re-trigger cubic

@github-actions

github-actions Bot commented Aug 18, 2026

Copy link
Copy Markdown
Contributor

馃殌 Preview Deployment

URL https://pr-1412-04cdcd4.preview.getnao.io
Commit 04cdcd4

鈿狅笍 No LLM API keys configured - you'll see the API key setup flow when trying to chat.


Preview will be automatically removed when this PR is closed.

@ad4mou
ad4mou marked this pull request as ready for review August 18, 2026 09:14
@ad4mou

ad4mou commented Aug 18, 2026

Copy link
Copy Markdown
Contributor Author

Since org members have access to all projects. They should not get added to all project teams.
So I cleaned up a few functions who did that and hence were now useless

@ad4mou
ad4mou requested a review from Bl3f August 18, 2026 09:22

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All reported issues were addressed across 7 files (changes from recent commits).

Reply with feedback, questions, or to request a fix.

Re-trigger cubic

Comment thread apps/backend/src/queries/organization.queries.ts

@Bl3f Bl3f left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A few comments.

}),

listUsersWithAccess: projectProtectedProcedure.query(async ({ ctx }) => {
return projectQueries.listUsersWithProjectAccess(ctx.project.id);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

listUsersWithProjectAccess returns the messagingProviderCode it means every user in a project can get the providerCode of someone else and try to login in their place I think.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks like it was also the case before but i think it can be fixed

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

and why do we need this route?

@ad4mou ad4mou Aug 27, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed on messagingProviderCode. I鈥檒l remove it from all user-list responses.

We do need this route for per-user budgets. Org members can generate spend without being explicit project members, so listAllUsersWithRoles omits users who need to appear there.

});
const projectMembers = useQuery({
...trpc.project.listAllUsersWithRoles.queryOptions(),
...trpc.project.listUsersWithAccess.queryOptions(),

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why? we also added the coalesced to listAllUsersWithRoles it seems

@ad4mou ad4mou Aug 27, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok It's a bit a confusing but I think:

listAllUsersWithRoles calls listProjectMembersWithRoles, which only returns explicit project members.

listUsersWithAccess calls listUsersWithProjectAccess, whose coalesce also handles org members. Since org members can generate spend, the budget page must use listUsersWithAccess.

@ad4mou
ad4mou requested a review from Bl3f August 27, 2026 19:59
@ad4mou

ad4mou commented Aug 27, 2026

Copy link
Copy Markdown
Contributor Author

LGTM

@ad4mou ad4mou self-assigned this Aug 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[feature] Org members should automatically get access to the org default project (SSO or manual invite)

2 participants