From c4e5ff4c9489f0678f73082d88ce037a622dfc4c Mon Sep 17 00:00:00 2001 From: Jake Barnby Date: Tue, 13 Sep 2022 16:14:37 +1200 Subject: [PATCH] Explicitly set all permissions to false on first add --- public/scripts/permissions-matrix.js | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/public/scripts/permissions-matrix.js b/public/scripts/permissions-matrix.js index 19d78cad42..81a869a8f4 100644 --- a/public/scripts/permissions-matrix.js +++ b/public/scripts/permissions-matrix.js @@ -22,10 +22,15 @@ } }) if (existing === undefined) { - this.permissions.push({ + let newPermission = { role, - [type]: true, - }); + create: false, + read: false, + update: false, + xdelete: false, + }; + newPermission[type] = true; + this.permissions.push(newPermission); } if (index !== -1) { existing[type] = true; @@ -38,7 +43,13 @@ && !this.validate(formId, this.permissions.length - 1)) { return; } - this.permissions.push({role: ''}); + this.permissions.push({ + role: '', + create: false, + read: false, + update: false, + xdelete: false, + }); }, updatePermission(index) { // Because the x-model does not update before the click event,