1
0
Fork 0
mirror of synced 2024-09-30 17:26:48 +13:00

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
No known key found for this signature in database
GPG key ID: C437A8CC85B96E9C
2 changed files with 5 additions and 1 deletions

View file

@ -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"

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;
}