🐛 Fix check when globalRole is undefined

This commit is contained in:
Iván Ovejero 2022-05-09 12:59:32 +02:00
parent 038040351a
commit 3f2c4a6645

View file

@ -757,7 +757,7 @@ export function whereClause({
}): WhereClause {
const where: WhereClause = entityId ? { [entityType]: { id: entityId } } : {};
if (user.globalRole.name !== 'owner') {
if (user?.globalRole?.name !== 'owner') {
where.user = { id: user.id };
}