From 29ff2d3d8c11d1548b6947e309fa10cb21fa19cd Mon Sep 17 00:00:00 2001
From: fspreck <f.spreckelsen@indiscale.com>
Date: Tue, 6 Dec 2022 18:25:51 +0100
Subject: [PATCH] MAINT: Move getting username and role for better testing

---
 src/core/js/ext_prop_display.js | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/src/core/js/ext_prop_display.js b/src/core/js/ext_prop_display.js
index 847608ac..802e49c9 100644
--- a/src/core/js/ext_prop_display.js
+++ b/src/core/js/ext_prop_display.js
@@ -51,10 +51,8 @@ var prop_display = new function ($, edit_mode, getEntityName, getEntityRole, get
         return $(".caosdb-entity-panel,.caosdb-entity-preview");
     }
 
-    this.unhideProperties = function (entities, conf, allTypes) {
+    this.unhideProperties = function (entities, conf, allTypes, userName, userRoles) {
 
-        const userName = getUserName();
-        const userRoles = getUserRoles();
         for (let ent of entities) {
             let parents = getParents(ent).map(par => par.name);
             let properties = getPropertyElements(ent);
@@ -165,7 +163,9 @@ var prop_display = new function ($, edit_mode, getEntityName, getEntityRole, get
                 original_return = original(entitiy);
             }
             var entities = prop_display.getEntitiesInView();
-            prop_display.unhideProperties(entities, conf, allTypes);
+            const userName = getUserName();
+            const userRoles = getUserRoles();
+            prop_display.unhideProperties(entities, conf, allTypes, userName, userRoles);
             return original_return;
         }
 
@@ -177,7 +177,9 @@ var prop_display = new function ($, edit_mode, getEntityName, getEntityRole, get
         if (Object.keys(conf).length > 0) {
             const allTypes = await this._getRecordTypes(conf);
             var entities = this.getEntitiesInView();
-            this.unhideProperties(entities, conf, allTypes);
+            const userName = getUserName();
+            const userRoles = getUserRoles();
+            this.unhideProperties(entities, conf, allTypes, userName, userRoles);
             // If we are in the edit mode, (un)hide properties after ending
             // the editing of an entity
             document.body.addEventListener(edit_mode.start_edit.type, (e) => {
-- 
GitLab