From 718a1e20291cca098c2537189042abd9060133b9 Mon Sep 17 00:00:00 2001 From: Andreas Nanko Date: Thu, 19 Nov 2026 09:49:35 +0100 Subject: [PATCH] Admins can star any project, and admin rights reach the client live The session fetch hook now sets isAdmin from the database next to canManageAgents. The client read it only from the sealed cookie, so an admin granted after sign-in saw no admin menu and no "Add people" in projects they were not in until they signed in again, while the server already allowed it; a demoted admin kept the controls. Starring was refused (403) for an admin who is not a member. It is now open to everyone who can see the project. A star still counts only while the caller is a member or an admin, so a removal or a demotion drops it without touching project_stars. --- CHANGELOG.md | 7 +++ app/pages/projects/[slug]/index.vue | 8 ++-- app/pages/projects/index.vue | 1 - server/api/projects/[id].get.ts | 11 +++-- server/api/projects/[id]/star.put.ts | 14 +++--- server/api/projects/index.get.ts | 9 ++-- server/assets/openapi.json | 9 ++-- server/database/schema.ts | 11 +++-- server/plugins/session-capabilities.ts | 12 ++++- tests/integration/auth/session-admin.test.ts | 29 ++++++++++++ tests/integration/projects/star.test.ts | 50 ++++++++++++++------ 11 files changed, 112 insertions(+), 49 deletions(-) create mode 100644 tests/integration/auth/session-admin.test.ts diff --git a/CHANGELOG.md b/CHANGELOG.md index ebe615d..e7076cd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,12 @@ # Changelog +## Unreleased + +### App + +- **Admins can star any project.** Starring was for members only, so an admin who looks after a project without being in it could not keep it in the sidebar. The star button now shows on every project an admin can open, on All Projects and on the project page. +- **Becoming an admin takes effect without signing in again.** The app went on treating a newly made admin as a regular user until they signed out and back in: no admin menu, and no "Add people" in projects they were not a member of, although the server already allowed it. It now picks up the change on the next page load, and an admin who is demoted loses the admin controls the same way. + ## v0.20.0 ### App diff --git a/app/pages/projects/[slug]/index.vue b/app/pages/projects/[slug]/index.vue index bf09380..4476260 100644 --- a/app/pages/projects/[slug]/index.vue +++ b/app/pages/projects/[slug]/index.vue @@ -232,11 +232,11 @@ async function confirmDeleteTag(tagId: string) { - +