mirror of
https://github.com/soconnor0919/hristudio.git
synced 2026-03-24 03:37:51 -04:00
feat: add role-based permissions and profile page improvements
- Add getMyMemberships API endpoint for user role lookup - Add getMemberRole helper for profile page display - Add role-based UI controls to study page (owner/researcher only) - Add canManage checks to experiments, participants, trials pages - Hide management actions for wizard/observer roles Backend already enforces permissions; UI now provides cleaner UX
This commit is contained in:
@@ -31,6 +31,8 @@ export default function StudyParticipantsPage() {
|
||||
}
|
||||
}, [studyId, selectedStudyId, setSelectedStudyId]);
|
||||
|
||||
const canManage = study?.userRole === "owner" || study?.userRole === "researcher";
|
||||
|
||||
return (
|
||||
<div className="space-y-6">
|
||||
<PageHeader
|
||||
@@ -38,12 +40,14 @@ export default function StudyParticipantsPage() {
|
||||
description="Manage participant registration, consent, and trial assignments for this study"
|
||||
icon={Users}
|
||||
actions={
|
||||
<Button asChild>
|
||||
<a href={`/studies/${studyId}/participants/new`}>
|
||||
<Plus className="mr-2 h-4 w-4" />
|
||||
Add Participant
|
||||
</a>
|
||||
</Button>
|
||||
canManage ? (
|
||||
<Button asChild>
|
||||
<a href={`/studies/${studyId}/participants/new`}>
|
||||
<Plus className="mr-2 h-4 w-4" />
|
||||
Add Participant
|
||||
</a>
|
||||
</Button>
|
||||
) : null
|
||||
}
|
||||
/>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user