From 4fb624162e5efb4ebc616e1dbd83fa23f0243668 Mon Sep 17 00:00:00 2001 From: philc Date: Wed, 14 Aug 2024 12:15:12 +0200 Subject: [PATCH] add test accessright.R exist before testing readibility from search --- models/Odmdb.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/models/Odmdb.js b/models/Odmdb.js index e658566..519b690 100644 --- a/models/Odmdb.js +++ b/models/Odmdb.js @@ -437,7 +437,7 @@ Odmdb.search = (objectPathname, objsearch, role) => { role.xprofils = role.xprofils.filter((e) => e !== "owner"); } objsearch.fields.forEach((f) => { - if (accessright.R.length == 0 || accessright.R.includes(f)) { + if (accessright.R && accessright.R.length == 0 || accessright.R.includes(f)) { ifields[f] = itm[f]; } else { //ifields[f] = "unauthorized";