diff --git a/src/core/js/webcaosdb.js b/src/core/js/webcaosdb.js
index 1d6d5c8326d3f7dc0f311404f825206c9303462f..f2e5e8ec4a201d1d46961b80c031c74d4ac24101 100644
--- a/src/core/js/webcaosdb.js
+++ b/src/core/js/webcaosdb.js
@@ -41,10 +41,10 @@ var globalError = function (error) {
     // ignore this particular error. It is caused by bootstrap-select which is
     // probably misusing the bootstrap 5 API.
     if (error.toString().startsWith("TypeError: this._element is undefined")) {
-      if (error && error.stack)
-        stack = "" + error.stack;
+        if (error && error.stack)
+            stack = "" + error.stack;
         if (stack.indexOf("dataApiKeydownHandler") > 0) {
-          return;
+            return;
         }
     }
 
@@ -306,6 +306,19 @@ this.navbar = new function () {
         }
     }
 
+    this.hideElementForRoles = function (name, roles) {
+        var elt = name;
+        if (typeof (name) === "string") {
+            elt = $(elt);
+        }
+        const userRoles = getUserRoles();
+        if (userRoles.some(role => roles.includes(role))) {
+            elt.addClass("d-none");
+        } else {
+            elt.removeClass("d-none");
+        }
+    }
+
 }