Feat: Helper function to check for project roles

This commit is contained in:
Daniel Hougaard
2024-04-22 21:08:33 +02:00
parent 22a3c46902
commit 105b8d6493

View File

@@ -56,5 +56,7 @@ export const useProjectPermission = () => {
throw new Error("useProjectPermission to be used within <ProjectPermissionContext>");
}
return ctx;
const hasProjectRole = (role: string) => ctx?.membership?.roles?.includes(role) || false;
return { ...ctx, hasProjectRole };
};