submit user perms
This commit is contained in:
parent
c0df27cf96
commit
7ed42e017e
|
@ -37,3 +37,22 @@ function perm_change(row) {
|
||||||
}
|
}
|
||||||
console.log("perms_changed = " + perms_changed);
|
console.log("perms_changed = " + perms_changed);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function submit_user_perms(row) {
|
||||||
|
let row_perms = {};
|
||||||
|
for (let child of row.children) {
|
||||||
|
if (child.firstChild.type == "checkbox") {
|
||||||
|
if (child.firstChild.checked) {
|
||||||
|
row_perms[child.firstChild.dataset.appName] = true;
|
||||||
|
} else {
|
||||||
|
row_perms[child.firstChild.dataset.appName] = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
console.log(row_perms);
|
||||||
|
fetch(window.location.pathname, {
|
||||||
|
method: 'POST',
|
||||||
|
headers: {'Content-Type': 'application/json'},
|
||||||
|
body: row_perms
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
|
@ -32,6 +32,7 @@
|
||||||
<section>
|
<section>
|
||||||
<h2>Admin Panel</h2>
|
<h2>Admin Panel</h2>
|
||||||
<article style="display: none;">
|
<article style="display: none;">
|
||||||
|
<hr>
|
||||||
<section class="sub_section">
|
<section class="sub_section">
|
||||||
<h3>User Permissions</h3>
|
<h3>User Permissions</h3>
|
||||||
<article style="display: none;">
|
<article style="display: none;">
|
||||||
|
@ -53,13 +54,14 @@
|
||||||
{% for name, value in values.items() %}
|
{% for name, value in values.items() %}
|
||||||
<td><input aria-label="{{ username }}-{{ name }}" data-app-name={{ name }} type="checkbox" onchange="perm_change(this.parentElement.parentElement)"{% if value %} checked{% endif %}></td>
|
<td><input aria-label="{{ username }}-{{ name }}" data-app-name={{ name }} type="checkbox" onchange="perm_change(this.parentElement.parentElement)"{% if value %} checked{% endif %}></td>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
<td><input type="submit"></td>
|
<td><input type="submit" value="Save" onclick="submit_user_perms(this.parentElement.parentElement)"></td>
|
||||||
</tr>
|
</tr>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
</article>
|
</article>
|
||||||
</section>
|
</section>
|
||||||
|
<br>
|
||||||
<section class="sub_section">
|
<section class="sub_section">
|
||||||
<h3>Invite New User</h3>
|
<h3>Invite New User</h3>
|
||||||
<article style="display: none;">
|
<article style="display: none;">
|
||||||
|
|
Loading…
Reference in New Issue
Block a user