Disallow multiple entries for the same role

This commit is contained in:
Jake Barnby
2022-08-29 15:20:33 +12:00
parent 33152c7bb1
commit 90dae04fb7
2 changed files with 5 additions and 1 deletions
@@ -91,7 +91,7 @@ $escapedPermissions = \array_map(function ($perm) {
<input
required
id="<?php echo $form; ?>"
id="<?php echo $form; ?>Input"
name="<?php echo $form; ?>"
form="<?php echo $form ?>"
list="types"
+4
View File
@@ -34,6 +34,10 @@
});
},
addPermission(formId, role, permissions) {
if (this.permissions.some(p => p.role === role)) {
document.getElementById(`${formId}Input`)
.setCustomValidity('Role entry already exists');
}
if (!document.getElementById(formId).reportValidity()) {
return;
}