Updated the Groups List to allow teachers to view their corporate's students
This commit is contained in:
@@ -111,7 +111,6 @@ export default function BatchCreateUser({user}: {user: User}) {
|
||||
return clear();
|
||||
}
|
||||
|
||||
console.log(information);
|
||||
setInfos(information);
|
||||
} catch {
|
||||
toast.error(
|
||||
|
||||
@@ -201,7 +201,11 @@ export default function GroupList({user}: {user: User}) {
|
||||
const {permissions} = usePermissions(user?.id || "");
|
||||
|
||||
const {users} = useUsers();
|
||||
const {groups, reload} = useGroups(user && filterTypes.includes(user?.type) ? user.id : undefined, user?.type);
|
||||
const {groups, reload} = useGroups(
|
||||
user && filterTypes.includes(user?.type) ? user.id : undefined,
|
||||
user?.type,
|
||||
user?.type === "teacher" ? user?.id : undefined,
|
||||
);
|
||||
|
||||
useEffect(() => {
|
||||
if (user && ["corporate", "teacher", "mastercorporate"].includes(user.type)) {
|
||||
|
||||
@@ -28,7 +28,7 @@ export const getServerSideProps = withIronSessionSsr(({req, res}) => {
|
||||
};
|
||||
}
|
||||
|
||||
if (shouldRedirectHome(user) || !["developer", "admin", "corporate", "agent", "mastercorporate"].includes(user.type)) {
|
||||
if (shouldRedirectHome(user) || !checkAccess(user, ["admin", "developer", "corporate", "teacher", "mastercorporate"])) {
|
||||
return {
|
||||
redirect: {
|
||||
destination: "/",
|
||||
|
||||
Reference in New Issue
Block a user