Added more filters to the classroom
This commit is contained in:
@@ -6,7 +6,7 @@ import {ToastContainer} from "react-toastify";
|
||||
import Layout from "@/components/High/Layout";
|
||||
import {GroupWithUsers, User} from "@/interfaces/user";
|
||||
import {shouldRedirectHome} from "@/utils/navigation.disabled";
|
||||
import {getUserName} from "@/utils/users";
|
||||
import {getUserName, isAdmin} from "@/utils/users";
|
||||
import {convertToUsers, getGroupsForEntities} from "@/utils/groups.be";
|
||||
import {getSpecificUsers} from "@/utils/users.be";
|
||||
import Link from "next/link";
|
||||
@@ -28,7 +28,7 @@ export const getServerSideProps = withIronSessionSsr(async ({req, res}) => {
|
||||
if (shouldRedirectHome(user)) return redirect("/")
|
||||
|
||||
const entityIDS = mapBy(user.entities, "id");
|
||||
const entities = await getEntitiesWithRoles(entityIDS)
|
||||
const entities = await getEntitiesWithRoles(isAdmin(user) ? undefined : entityIDS)
|
||||
const allowedEntities = findAllowedEntities(user, entities, "view_classrooms")
|
||||
|
||||
const groups = await getGroupsForEntities(mapBy(allowedEntities, 'id'));
|
||||
|
||||
Reference in New Issue
Block a user