Skip to content

Add admin panel with storage overview and user management#1

Merged
fybedev merged 4 commits into
mainfrom
copilot/create-admin-panel-storage-user-table
Feb 24, 2026
Merged

Add admin panel with storage overview and user management#1
fybedev merged 4 commits into
mainfrom
copilot/create-admin-panel-storage-user-table

Conversation

Copilot AI commented Feb 24, 2026

Copy link
Copy Markdown
Contributor
  • Explore codebase structure
  • Add is_admin field support to user records in db_auth.py
  • Add admin routes to app.py
  • Create templates/admin.html with storage stats and user management table
  • Add admin link to dashboard for admin users
  • Fix register_user bug: initialize 'users'/'files' keys when missing (fresh DB) so update_database.py works on first run
  • Fix register_user bug: update existing user record (quota, is_admin, password) instead of appending a duplicate entry — prevents is_admin_user returning False for the pre-existing entry
  • Harden check_if_user_exists, is_admin_user, check_if_auth against missing 'users' key
Original prompt

Make an admin panel that lets the administrator user able to see how much storage is being used, and a table of user management.


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Co-authored-by: fybedev <85213715+fybedev@users.noreply.github.com>
Copilot AI changed the title [WIP] Add admin panel for storage usage and user management Add admin panel with storage overview and user management Feb 24, 2026
Copilot AI requested a review from fybedev February 24, 2026 05:23
Copilot stopped work on behalf of fybedev due to an error February 24, 2026 05:24
@fybedev

fybedev commented Feb 24, 2026

Copy link
Copy Markdown
Owner

@copilot
I did register_user('admin', 'admin', quota_gb=10, is_admin=True) and logged in with (admin, admin) but it said this:
Access denied. Admin privileges required.

@fybedev fybedev left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Admin permission checking doesn't work properly

…ad of duplicating

Co-authored-by: fybedev <85213715+fybedev@users.noreply.github.com>

Copilot AI commented Feb 24, 2026

Copy link
Copy Markdown
Contributor Author

@copilot
I did register_user('admin', 'admin', quota_gb=10, is_admin=True) and logged in with (admin, admin) but it said this:
Access denied. Admin privileges required.

Two bugs were causing this (fixed in 1238c31):

  1. Fresh database: register_user called l_db['users'].append(...) but the 'users' key didn't exist yet, raising a KeyError — so the admin user was silently never created. register_user now initializes 'users' and 'files' if they're missing.

  2. Pre-existing user: If an admin account was created first via the web /register page (without is_admin), calling register_user('admin', ..., is_admin=True) appended a second entry. is_admin_user found the first one (no is_admin) and returned False. register_user now updates the existing user record (quota, is_admin, and password) instead of creating a duplicate.

After the fix, python update_database.py correctly sets up the admin user and /admin is accessible:

Admin Panel

@fybedev
fybedev marked this pull request as ready for review February 24, 2026 05:39
@fybedev
fybedev merged commit 10aa66a into main Feb 24, 2026
1 check failed
@fybedev
fybedev deleted the copilot/create-admin-panel-storage-user-table branch February 24, 2026 13:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants