fix statistics;

rewrite availability filters;
fix availability filters;
ProtectedRoute.IsInRole helper
This commit is contained in:
Dobromir Popov
2024-04-27 15:31:28 +03:00
parent 029a9af390
commit 58ac046ee5
12 changed files with 267 additions and 138 deletions

View File

@@ -68,3 +68,8 @@ export async function serverSideAuth({ req, allowedRoles }) {
// Return the session if the user is authenticated and has the required role
return { session };
}
// Static method to check if the user has a specific role
ProtectedRoute.IsInRole = async (roleName) => {
const session = await getSession();
return session && session.user && session.user.role === roleName;
};