Skip to content

Add user ban system for blocking submissions#471

Merged
msaroufim merged 2 commits intomainfrom
ban-user-submissions
Mar 18, 2026
Merged

Add user ban system for blocking submissions#471
msaroufim merged 2 commits intomainfrom
ban-user-submissions

Conversation

@msaroufim
Copy link
Member

@msaroufim msaroufim commented Mar 18, 2026

Summary

  • Adds is_banned boolean column to user_info table (new yoyo migration)
  • Ban check in prepare_submission() — the single chokepoint that blocks all 3 entry points (Discord, CLI API, Web API)
  • Discord admin commands: /admin ban and /admin unban
  • API admin endpoints: POST /admin/ban/{user_id} and DELETE /admin/ban/{user_id}
  • DB methods: ban_user(), unban_user(), is_user_banned() on LeaderboardDB

Test plan

  • All 51 existing test_admin_api.py tests pass
  • Local API testing: ban user → submission returns "You are banned from making submissions."
  • Local API testing: unban user → submission is accepted again
  • 401 without auth, 404 for nonexistent user
  • Ruff lint passes

Adds is_banned column to user_info, ban check in prepare_submission
(blocks all entry points: Discord, CLI, Web), admin Discord commands
(/admin ban, /admin unban), and admin API endpoints (POST/DELETE
/admin/ban/{user_id}).
@github-actions
Copy link

Coverage report

Click to see where and how coverage changed

FileStatementsMissingCoverageCoverage
(new stmts)
Lines missing
  src/libkernelbot
  leaderboard_db.py 1450-1460, 1468-1478, 1486-1495
  submission.py 54
  utils.py
Project Total  

This report was generated by python-coverage-comment-action

@msaroufim msaroufim merged commit 2971ccd into main Mar 18, 2026
4 checks passed
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.

1 participant