Created a system to go directly to an assignment from a URL

This commit is contained in:
Tiago Ribeiro
2024-10-17 18:24:39 +01:00
parent a0a9402945
commit 4917583c67
10 changed files with 232 additions and 57 deletions

View File

@@ -52,7 +52,8 @@ export const getServerSideProps = withIronSessionSsr(async ({req, res, params})
const entity = await getEntityWithRoles(assignment.entity || "")
if (!entity) return redirect("/assignments")
if (!doesEntityAllow(user, entity, 'view_assignments')) return redirect("/assignments")
if (!doesEntityAllow(user, entity, 'view_assignments') && !["admin", "developer"].includes(user.type))
return redirect("/assignments")
const users = await (checkAccess(user, ["developer", "admin"]) ? getUsers() : getEntityUsers(entity.id));