From 291d1e24989b7a670a8581223be8c9c9c1a5e4a2 Mon Sep 17 00:00:00 2001 From: reoring Date: Tue, 10 Nov 2026 13:09:39 +0900 Subject: [PATCH] appserver-go v0.5.1: read Project roles from the roles array Platform #6519 replaced the Project access response's role with roles[]. With the old SDK the caller's role and admin flags were always empty. --- cmd/server/internal/api/api_test.go | 2 +- cmd/server/server_test.go | 2 +- go.mod | 2 +- go.sum | 4 ++-- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/cmd/server/internal/api/api_test.go b/cmd/server/internal/api/api_test.go index 15f2052..bb25250 100644 --- a/cmd/server/internal/api/api_test.go +++ b/cmd/server/internal/api/api_test.go @@ -64,7 +64,7 @@ func newTestAPI(t *testing.T, db *store.Store, eng Engine, issuer *testutil.OIDC if admin { role = "Admin" } - _ = json.NewEncoder(w).Encode(map[string]any{"member": true, "role": role}) + _ = json.NewEncoder(w).Encode(map[string]any{"member": true, "roles": []string{role}, "actions": []string{}}) case "/api/v1/projects/pj-test/app-installations/tool-builder": _, _ = w.Write([]byte(`{"id":"tool-builder","stackId":"adopted-tool-stack","links":[{"definitionId":"knowledge","state":"Absent"},{"definitionId":"builder-console","state":"Installing"}]}`)) case "/api/v1/projects/pj-test/components/orders-db": diff --git a/cmd/server/server_test.go b/cmd/server/server_test.go index 37e34ea..b9f1521 100644 --- a/cmd/server/server_test.go +++ b/cmd/server/server_test.go @@ -215,7 +215,7 @@ func TestServedOpenAPIEqualsCommittedContract(t *testing.T) { require.Equal(t, bearer, r.Header.Get("Authorization")) switch r.URL.Path { case "/api/v1/projects/pj-test/access": - _, _ = w.Write([]byte(`{"member":true,"role":"Viewer"}`)) + _, _ = w.Write([]byte(`{"member":true,"roles":["Viewer"],"actions":[]}`)) default: t.Errorf("unexpected platform route %s", r.URL.Path) w.WriteHeader(http.StatusNotFound) diff --git a/go.mod b/go.mod index 5600078..c61be9e 100644 --- a/go.mod +++ b/go.mod @@ -3,7 +3,7 @@ module github.com/appthrust/tool-builder go 1.26.0 require ( - github.com/appthrust/appserver-go v0.3.0 + github.com/appthrust/appserver-go v0.5.1 github.com/lib/pq v1.12.3 github.com/oklog/ulid/v2 v2.1.1 github.com/stretchr/testify v1.11.1 diff --git a/go.sum b/go.sum index 3faaba0..1cbbb1a 100644 --- a/go.sum +++ b/go.sum @@ -1,5 +1,5 @@ -github.com/appthrust/appserver-go v0.3.0 h1:zxOz0hkspZSXjLq3KWGDLkZIz42Jag6wqRujZ8lTru0= -github.com/appthrust/appserver-go v0.3.0/go.mod h1:0KSf9RQZ6OxBcE0lxYzzjKF37nfwbKps3wXUGlE0oFo= +github.com/appthrust/appserver-go v0.5.1 h1:L9IfLUZjR2GxQmEK+d7rjo8P1bItbbb+kqKotRRoey4= +github.com/appthrust/appserver-go v0.5.1/go.mod h1:0KSf9RQZ6OxBcE0lxYzzjKF37nfwbKps3wXUGlE0oFo= github.com/coreos/go-oidc/v3 v3.20.0 h1:EtE0WIBHk03N+DqGkY4+UONzzZHk7amKt6IyNd7OsZE= github.com/coreos/go-oidc/v3 v3.20.0/go.mod h1:DYCf24+ncYi+XkIH97GY1+dqoRlbaSI26KVTCI9SrY4= github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM=