fix(webui): resolve a selected org's workspaces as the caller, wire selection into gateway and harness, and let a member start tasks in the org they selected

This commit is contained in:
sam committed 2026-10-27 11:06:18 +11:00
1 parent c3d49cbc6c
commit 4bb473c0b0
12 files changed
+101 -21

No files matched your search

+4 -1
View File
@@ -21,7 +21,10 @@ func (s *Server) selectedOrg(w http.ResponseWriter, r *http.Request, principal a
if chosen == "" {
return principal, nil
}
selected, err := principal.Select(r.Context(), org.OrgID(chosen), s.workspaces())
// The lookup runs as the caller, so the State Store knows whose
// memberships entitle it to the chosen org's workspaces.
ctx := org.WithOrg(access.WithPrincipal(r.Context(), principal), principal.Org)
selected, err := principal.Select(ctx, org.OrgID(chosen), s.workspaces())
if errors.Is(err, access.ErrNotMember) {
s.setOrgCookie(w, r, "")
return principal, nil