From b6179865b50cd80780d720b18485fca15374402d Mon Sep 17 00:00:00 2001 From: marc Date: Sat, 20 Jun 2026 17:01:56 +0200 Subject: [PATCH] Remove user rename feature; add www-data hint in WebDAV edit modal - Removed PATCH /api/users/ route (rename_user) - Removed renameModal from index.html - Removed openRenameModal/submitRename from users.js - Removed Rename button from users table - Removed rename docs from README - Added green info box in WebDAV edit modal: set group=www-data, mode=775 Co-Authored-By: Claude Sonnet 4.6 --- README.md | 2 -- app.py | 21 --------------------- static/js/shares.js | 5 +++++ static/js/users.js | 26 -------------------------- templates/index.html | 21 --------------------- 5 files changed, 5 insertions(+), 70 deletions(-) diff --git a/README.md b/README.md index 575eb84..6aa3c7e 100644 --- a/README.md +++ b/README.md @@ -111,8 +111,6 @@ All routes require a login session. On first run you are redirected to `/setup` Users created in MicroNAS are standard Linux system accounts (`useradd -M -s /usr/sbin/nologin`). Their password is set in both the Linux shadow file (via `smbpasswd`) and the WebDAV htpasswd file automatically. -**Rename** — the Rename button in the Users tab renames the Linux account (`usermod -l`). Because SMB and WebDAV store passwords by username, those entries are removed and must be reset after a rename. The UI shows a warning prompt. - **Delete** — removes the Linux account, SMB entry, and WebDAV htpasswd entry. **Password change** — updates SMB and WebDAV passwords in sync. Changing a user's password also re-registers them in WebDAV if they were created before WebDAV was installed. diff --git a/app.py b/app.py index f059f9d..fe5c560 100644 --- a/app.py +++ b/app.py @@ -936,27 +936,6 @@ def change_admin_credentials(): return jsonify({'status': 'updated'}) -@app.route('/api/users/', methods=['PATCH']) -@require_auth -def rename_user(name): - if not VALID_NAME.match(name): - return jsonify({'error': 'invalid username'}), 400 - new_name = (request.json or {}).get('name', '').strip() - if not new_name or not VALID_NAME.match(new_name): - return jsonify({'error': 'invalid new username'}), 400 - if new_name == name: - return jsonify({'status': 'no change'}), 200 - - r = subprocess.run(['usermod', '-l', new_name, name], capture_output=True, text=True) - if r.returncode != 0: - return jsonify({'error': r.stderr.strip() or 'usermod failed'}), 500 - - # Remove SMB and WebDAV entries — password must be reset after rename - subprocess.run(['smbpasswd', '-x', name], capture_output=True) - _remove_webdav_user(name) - return jsonify({'status': 'renamed', - 'warning': 'SMB and WebDAV password must be reset for the renamed user.'}) - @app.route('/api/users//password', methods=['POST']) @require_auth diff --git a/static/js/shares.js b/static/js/shares.js index d27dee9..d0f4057 100644 --- a/static/js/shares.js +++ b/static/js/shares.js @@ -259,6 +259,11 @@ async function openEditModal(type, share) { +
+ WebDAV writes files as www-data. + Set the folder group to www-data and mode to 775 below, + or add www-data to your share group. +
${permSection}`; } else { const isRo = /\(ro[,)]/.test(share.clients); diff --git a/static/js/users.js b/static/js/users.js index b16e191..3498b6f 100644 --- a/static/js/users.js +++ b/static/js/users.js @@ -22,8 +22,6 @@ async function loadUsers() { - - - - - - -