From 8529d0ef891453cc5c78a3091c93e2dcb9f6765d Mon Sep 17 00:00:00 2001 From: Sean O'Connor Date: Sun, 22 Mar 2026 17:26:52 -0400 Subject: [PATCH] fix: add role-based permissions to forms page - Hide Generate Default Template and Save Changes buttons for wizard/observer - Backend already enforces owner/researcher for mutations - UI now provides cleaner experience for read-only roles --- .../(dashboard)/studies/[id]/forms/page.tsx | 67 ++++++++++--------- 1 file changed, 36 insertions(+), 31 deletions(-) diff --git a/src/app/(dashboard)/studies/[id]/forms/page.tsx b/src/app/(dashboard)/studies/[id]/forms/page.tsx index bf52111..2db79a6 100644 --- a/src/app/(dashboard)/studies/[id]/forms/page.tsx +++ b/src/app/(dashboard)/studies/[id]/forms/page.tsx @@ -254,6 +254,9 @@ export default function StudyFormsPage({ params }: StudyFormsPageProps) { if (!study) return
Loading...
; + const userRole = (study as any)?.userRole; + const canManage = userRole === "owner" || userRole === "researcher"; + return ( - - {activeConsentForm && ( + canManage ? ( +
- )} -
+ {activeConsentForm && ( + + )} + + ) : null } > {activeConsentForm ? (