Validate permission role input exists

This commit is contained in:
Jake Barnby 2022-08-12 23:44:27 +12:00
parent 76f86c74ad
commit f278517276
2 changed files with 4 additions and 1 deletions

View file

@ -511,6 +511,8 @@ $logs = $this->getParam('logs', null);
<div class="row responsive margin-top-negative">
<div class="col span-8 margin-bottom">
<form id="permissions"></form>
<form
data-analytics
data-analytics-activity
@ -595,7 +597,7 @@ $logs = $this->getParam('logs', null);
<option value="any">
</datalist>
<input type="text" name="role" x-model="role" list="types" />
<input required id="role" form="permissions" type="text" name="role" x-model="role" list="types" />
</td>
<td>
<input type="checkbox" name="read" x-model="read" />

View file

@ -34,6 +34,7 @@
return { type, role };
},
addPermission(role, read, create, update, xdelete) {
if (!document.getElementById('role').reportValidity()) return;
if (read) this.rawPermissions.push(`read(${role})`);
if (create) this.rawPermissions.push(`create(${role})`);
if (update) this.rawPermissions.push(`update(${role})`);