Explicitly set all permissions to false on first add

This commit is contained in:
Jake Barnby
2022-09-13 16:14:37 +12:00
parent 9cea1270c3
commit c4e5ff4c94
+15 -4
View File
@@ -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,