From 64c51ce805bcbd028f38c73752bbbe04a3e7ac0c Mon Sep 17 00:00:00 2001 From: Cam Proudlock Date: Mon, 31 Aug 2026 09:56:49 -0400 Subject: [PATCH] Let a guest actually use search: declare the shipped guest grants, and draw the box for whoever can search --- docs/openapi.json | 28 ++++++++++ frontend/src/api/index.js | 3 ++ frontend/src/views/AppLayout.vue | 22 ++++++-- plugins/guides/plugin.py | 19 +++++++ plugins/tools/plugin.py | 8 ++- shopdb/core/api/dashboard.py | 32 ++++++++++++ tests/test_core/test_guest_role.py | 58 +++++++++++++++++++++ tests/test_core/test_public_read_surface.py | 4 ++ 8 files changed, 170 insertions(+), 4 deletions(-) diff --git a/docs/openapi.json b/docs/openapi.json index 14eec236..3d20663c 100644 --- a/docs/openapi.json +++ b/docs/openapi.json @@ -2447,6 +2447,34 @@ } } }, + "/api/dashboard/capabilities": { + "get": { + "tags": [ + "core-platform" + ], + "summary": "Booleans describing what THIS caller may reach, so the app chrome can avoid drawing controls that would only answer...", + "description": "Booleans describing what THIS caller may reach, so the app chrome can avoid drawing controls that would only answer 401; cansearch reports whether the caller holds assets.view, which a signed-out visitor does when the guest role has been granted it\n\n**Auth:** none\n\n**Params:** none\n\n**Example:**\n```\ncurl http://localhost:5001/api/dashboard/capabilities\n```", + "security": [], + "responses": { + "200": { + "description": "Success. Body is the success_response envelope: {status, data, meta}.", + "content": { + "application/json": { + "$ref": "#/components/schemas/SuccessEnvelope" + } + } + }, + "default": { + "description": "Error. Body is the error envelope; the code and message are nested under data.error.", + "content": { + "application/json": { + "$ref": "#/components/schemas/ErrorEnvelope" + } + } + } + } + } + }, "/api/dashboard/widgets": { "get": { "tags": [ diff --git a/frontend/src/api/index.js b/frontend/src/api/index.js index e3eaa19d..6bc0f1b3 100644 --- a/frontend/src/api/index.js +++ b/frontend/src/api/index.js @@ -536,6 +536,9 @@ export const dashboardApi = { }, navigation() { return api.get('/dashboard/navigation') + }, + capabilities() { + return api.get('/dashboard/capabilities') } } diff --git a/frontend/src/views/AppLayout.vue b/frontend/src/views/AppLayout.vue index cdf8ce56..dfe40089 100644 --- a/frontend/src/views/AppLayout.vue +++ b/frontend/src/views/AppLayout.vue @@ -11,9 +11,12 @@ - -