diff --git a/src/pages/dashboard/student.tsx b/src/pages/dashboard/student.tsx index e6063753..4dce9abb 100644 --- a/src/pages/dashboard/student.tsx +++ b/src/pages/dashboard/student.tsx @@ -59,7 +59,7 @@ export const getServerSideProps = withIronSessionSsr(async ({req, res}) => { const entityIDS = mapBy(user.entities, "id") || []; const entities = await getEntitiesWithRoles(entityIDS); - const assignments = await getAssignmentsByAssignee(user.id, {archived: false}); + const assignments = await getAssignmentsByAssignee(user.id, {archived: {$ne: true}}); const stats = await getStatsByUser(user.id); const sessions = await getSessionsByUser(user.id, 10); const invites = await getInvitesByInvitee(user.id); @@ -149,16 +149,9 @@ export default function Dashboard({user, entities, assignments, stats, invites, ]} /> - {/* Bio */} -
- Bio - - {user.bio || "Your bio will appear here, you can change it by clicking on your name in the top right corner."} - -
- {/* Assignments */}
+ Assignments {studentAssignments.length === 0 && "Assignments will appear here. It seems that for now there are no assignments for you."} {studentAssignments diff --git a/src/pages/entities/[id]/index.tsx b/src/pages/entities/[id]/index.tsx index 6842c3a1..320ae609 100644 --- a/src/pages/entities/[id]/index.tsx +++ b/src/pages/entities/[id]/index.tsx @@ -16,7 +16,7 @@ import {convertToUsers, getGroup} from "@/utils/groups.be"; import {shouldRedirectHome} from "@/utils/navigation.disabled"; import {checkAccess, doesEntityAllow, getTypesOfUser} from "@/utils/permissions"; import {getUserName, isAdmin} from "@/utils/users"; -import {getEntitiesUsers, getEntityUsers, getLinkedUsers, getSpecificUsers, getUsers} from "@/utils/users.be"; +import {filterAllowedUsers, getEntitiesUsers, getEntityUsers, getLinkedUsers, getSpecificUsers, getUsers} from "@/utils/users.be"; import { Menu, MenuButton, MenuItem, MenuItems } from "@headlessui/react"; import axios from "axios"; import clsx from "clsx"; @@ -55,8 +55,9 @@ export const getServerSideProps = withIronSessionSsr(async ({req, params}) => { if (!doesEntityAllow(user, entity, "view_entities")) return redirect(`/entities`) - const linkedUsers = await (isAdmin(user) ? getUsers() : getEntitiesUsers(mapBy(user.entities, 'id'))) - const entityUsers = await getEntityUsers(id); + const linkedUsers = await (isAdmin(user) ? getUsers() : getEntitiesUsers(mapBy(user.entities, 'id'), + {$and: [{type: {$ne: "developer"}}, {type: {$ne: "admin"}}]})) + const entityUsers = await (isAdmin(user) ? getEntityUsers(id) : filterAllowedUsers(user, [entity])); const usersWithRole = entityUsers.map((u) => { const e = u.entities.find((e) => e.id === id); @@ -363,7 +364,7 @@ export default function Home({user, entity, users, linkedUsers}: Props) { list={isAdding ? linkedUsers : users} renderCard={renderCard} - searchFields={[["name"], ["corporateInformation", "companyInformation", "name"], ["role", "label"], ["type"]]} + searchFields={[["name"], ["email"], ["corporateInformation", "companyInformation", "name"], ["role", "label"], ["type"]]} />