Skip to content

fix(contexts): let team members reach an application shared with their team - #3199

Merged
blizzz merged 1 commit into
mainfrom
fix/context-team-shares
Nov 30, 2026
Merged

blizzz merged 1 commit into
mainfrom
fix/context-team-shares

Conversation

@AndyScherzinger

Copy link
Copy Markdown
Member

Fixes #2691.

ContextMapper::applyOwnedOrSharedQuery() composed the "shared to me" predicate from exactly three clauses — s.sender = :userId, receiver_type = 'user' and receiver_type = 'group'. There was no circle branch, so a context shared with a team matched nobody. The share row is written correctly either way, which is why the UI happily accepts attaching a team while every member is then refused access.

Tables and views already resolve teams, via CircleHelper::getUserCircles() in ShareService. Contexts now use the same source, so the two behave alike.

That one gate is shared by findAll(), findForNavBar() and findById() through getFindContextBaseQuery(), so a single clause covers listing, navigation and opening.

Verified on a running instance

Team "Test-Team" with members mmtest (owner), alice, dash_alice; bob outside it. One application shared with the team, exercised as each user through a real session.

Before:

mmtest      findAll=[68]  findForNavigation=[]  findById(68)=YES
alice       findAll=[]    findForNavigation=[]  findById(68)=no (NotFoundError)
dash_alice  findAll=[]    findForNavigation=[]  findById(68)=no (NotFoundError)
bob         findAll=[]    findForNavigation=[]  findById(68)=no (NotFoundError)

After:

mmtest      findAll=[68]  findForNavigation=[]  findById(68)=YES
alice       findAll=[68]  findForNavigation=[68]  findById(68)=YES
dash_alice  findAll=[68]  findForNavigation=[68]  findById(68)=YES
bob         findAll=[]    findForNavigation=[]  findById(68)=no (NotFoundError)

bob is the negative control: being outside the team still grants nothing. The owner's empty findForNavigation is pre-existing and unrelated — findForNavBar() excludes the owner by c.owner_id != :userId.

The added test covers all three cases against a real schema and fails without the fix (Failed asserting that an array contains 1).

The two string literals 'user' and 'group' next to the new clause were swapped for the existing ShareReceiverType constants while touching the lines.

🖼️ Screenshots

Not applicable — no UI change; the application simply appears for team members where it previously did not.

🏁 Checklist

  • ⛑️ Tests (unit and/or integration) are included or not needed
  • 🔙 Backport requests are created or not needed: /backport to stableX.X
  • 📅 Milestone is set
  • 🌸 PR title is meaningful (if it should be in the changelog: is it meaningful to users?)

🤖 AI (if applicable)

  • The content of this PR was partly or fully generated using AI

…r team

ContextMapper::applyOwnedOrSharedQuery() built the "shared to me" predicate from
three clauses only: s.sender, receiver_type 'user' and receiver_type 'group'.
A context shared with a team therefore matched nobody, so the share row was
written and the UI accepted attaching the team while every member was refused
access to the application itself.

Tables and views already resolve teams through CircleHelper; contexts now use
the same source. The gate is shared by findAll(), findForNavBar() and findById(),
so one clause covers listing, navigation and opening.

Fixes #2691

Assisted-by: ClaudeCode:claude-opus-5
Signed-off-by: Andy Scherzinger <info@andy-scherzinger.de>
@enjeck
enjeck force-pushed the fix/context-team-shares branch from 6206b44 to c59dd87 Compare November 30, 2026 07:15
@blizzz
blizzz merged commit 1443ae0 into main Nov 30, 2026
77 of 79 checks passed
@blizzz
blizzz deleted the fix/context-team-shares branch November 30, 2026 10:56
@blizzz blizzz added this to the v3 milestone Nov 30, 2026
@blizzz

blizzz commented Nov 30, 2026

Copy link
Copy Markdown
Member

do we need a backport to stable2?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

2. developing Work in progress AI assisted bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Sharing applications with a team is not possible

4 participants