Some quick hotfixes
This commit is contained in:
@@ -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) {
|
||||
<CardList<User | UserWithRole>
|
||||
list={isAdding ? linkedUsers : users}
|
||||
renderCard={renderCard}
|
||||
searchFields={[["name"], ["corporateInformation", "companyInformation", "name"], ["role", "label"], ["type"]]}
|
||||
searchFields={[["name"], ["email"], ["corporateInformation", "companyInformation", "name"], ["role", "label"], ["type"]]}
|
||||
/>
|
||||
</section>
|
||||
</Layout>
|
||||
|
||||
Reference in New Issue
Block a user