Continued with clearing more of the team's requests
This commit is contained in:
@@ -50,7 +50,10 @@ export const getServerSideProps = withIronSessionSsr(async ({req, res, params})
|
||||
if (!assignment) return redirect("/assignments")
|
||||
|
||||
const entity = await getEntityWithRoles(assignment.entity || "")
|
||||
if (!entity) return redirect("/assignments")
|
||||
if (!entity){
|
||||
const users = await getUsers()
|
||||
return {props: serialize({user, users, assignment})};
|
||||
}
|
||||
|
||||
if (!doesEntityAllow(user, entity, 'view_assignments')) return redirect("/assignments")
|
||||
|
||||
@@ -63,7 +66,7 @@ interface Props {
|
||||
user: User;
|
||||
users: User[];
|
||||
assignment: Assignment;
|
||||
entity: EntityWithRoles
|
||||
entity?: EntityWithRoles
|
||||
}
|
||||
|
||||
export default function AssignmentView({user, users, entity, assignment}: Props) {
|
||||
|
||||
@@ -70,6 +70,7 @@ interface Props {
|
||||
export default function AssignmentsPage({assignments, corporateAssignments, entities, user, users, groups}: Props) {
|
||||
const entitiesAllowCreate = useAllowedEntities(user, entities, 'create_assignment')
|
||||
const entitiesAllowEdit = useAllowedEntities(user, entities, 'edit_assignment')
|
||||
const entitiesAllowArchive = useAllowedEntities(user, entities, 'archive_assignment')
|
||||
|
||||
const activeAssignments = useMemo(() => assignments.filter(activeAssignmentFilter), [assignments]);
|
||||
const plannedAssignments = useMemo(() => assignments.filter(futureAssignmentFilter), [assignments]);
|
||||
@@ -177,7 +178,7 @@ export default function AssignmentsPage({assignments, corporateAssignments, enti
|
||||
onClick={() => router.push(`/assignments/${a.id}`)}
|
||||
key={a.id}
|
||||
allowDownload
|
||||
allowArchive
|
||||
allowArchive={mapBy(entitiesAllowArchive, 'id').includes(a.entity || "")}
|
||||
allowExcelDownload
|
||||
/>
|
||||
))}
|
||||
@@ -197,7 +198,7 @@ export default function AssignmentsPage({assignments, corporateAssignments, enti
|
||||
onClick={() => router.push(`/assignments/${a.id}`)}
|
||||
key={a.id}
|
||||
allowDownload
|
||||
allowArchive
|
||||
allowArchive={mapBy(entitiesAllowArchive, 'id').includes(a.entity || "")}
|
||||
allowExcelDownload
|
||||
/>
|
||||
))}
|
||||
|
||||
Reference in New Issue
Block a user