Add group management and owner/group dropdowns in permission editor

Backend:
- _list_groups(): reads /etc/group, returns groups with gid >= 1000
  plus a small whitelist (root, staff, sambashare, www-data)
- GET/POST /api/groups: list and create groups (groupadd)
- DELETE /api/groups/<name>: delete group (groupdel)
- POST /api/groups/<name>/members: add user to group (gpasswd -a)
- DELETE /api/groups/<name>/members/<user>: remove user (gpasswd -d)

Frontend:
- Users tab now has a Groups section: table with GID, member badges
  with × remove buttons, per-row "add member" select populated with
  users not already in the group, delete group button
- loadUsers() caches result in _cachedUsers for groups table to use
- openEditModal is now async; fetches /api/users + /api/groups before
  rendering so Owner and Group inputs have datalist autocomplete

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
marcandClaude Sonnet 4.6 committed 2026-06-20 00:47:43 +02:00
1 parent 302a5cb023
commit 596365b805
5 files changed
+227 -11

No files matched your search

+16 -1
View File
@@ -202,7 +202,7 @@
<div class="col-md-2"><button type="button" class="btn btn-success w-100" onclick="createUser()">Create</button></div>
</div>
<div class="fw-semibold mb-2">Users</div>
<div class="table-responsive">
<div class="table-responsive mb-5">
<table class="table table-striped mb-0">
<thead><tr><th>Username</th><th>UID</th><th>SMB Account</th><th>Actions</th></tr></thead>
<tbody id="usersTableBody">
@@ -210,6 +210,21 @@
</tbody>
</table>
</div>
<div class="fw-semibold mb-3">Create Group</div>
<div class="row g-2 mb-4">
<div class="col-md-3"><input type="text" id="newGroupName" class="form-control" placeholder="Group name"></div>
<div class="col-md-2"><button type="button" class="btn btn-success w-100" onclick="createGroup()">Create</button></div>
</div>
<div class="fw-semibold mb-2">Groups</div>
<div class="table-responsive">
<table class="table table-striped mb-0">
<thead><tr><th>Group</th><th>GID</th><th>Members</th><th>Actions</th></tr></thead>
<tbody id="groupsTableBody">
<tr><td colspan="4" style="color:var(--muted)">Loading…</td></tr>
</tbody>
</table>
</div>
</div>
</div>