fix(#259): Add authorization checks to delete_user()#272
Conversation
|
Warning Review limit reached
More reviews will be available in 24 minutes and 31 seconds. Learn how PR review limits work. Your organization has used up its prepaid credits, and credit purchases are no longer available. Enable the review add-on in the billing tab to keep reviews running — you're only billed for reviews past your plan's rate limits ($0.25/file). ⌛ How to resolve this issue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based credits. 🚦 How do rate limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please see our Fair Usage Limits Policy for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (16)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
- Add Gate 1: Authorization check (non-admin can only delete own account) - Add Gate 2: Last-admin guard (prevent admin count from dropping to zero) - Update callers to pass session["username"] as perpetrator - Add translation keys: not_authorized, last_admin (all 12 languages) - Add E2E tests covering authorization matrix
- Add Gate 1: Authorization check (non-admin can only delete own account) - Add Gate 2: Last-admin guard (prevent admin count from dropping to zero) - Update callers to pass session["username"] as perpetrator - Add translation keys: not_authorized, last_admin (all 12 languages) - Add E2E tests covering authorization matrix
- de: Sie sind nicht berechtigt, diesen Benutzer zu löschen - es: No tiene autorización para eliminar este usuario - fr: Vous n'êtes pas autorisé à supprimer cet utilisateur - hi: आप इस उपयोगकर्ता को हटाने के लिए अनुमतित नहीं हैं - ja: このユーザーを削除する権限がありません - pl: Nie masz uprawnień do usunięcia tego użytkownika - pt: Você não está autorizado a excluir este usuário - ru: У вас нет прав для удаления этого пользователя - tr: Bu kullanıcıyı silme yetkiniz yok - uk: У вас немає прав для видалення цього користувача - zh: 您沒有權限刪除此用戶
- de: Sie sind nicht berechtigt, diesen Benutzer zu löschen - es: No tiene autorización para eliminar este usuario - fr: Vous n'êtes pas autorisé à supprimer cet utilisateur - hi: आप इस उपयोगकर्ता को हटाने के लिए अनुमतित नहीं हैं - ja: このユーザーを削除する権限がありません - pl: Nie masz uprawnień do usunięcia tego użytkownika - pt: Você não está autorizado a excluir este usuário - ru: У вас нет прав для удаления этого пользователя - tr: Bu kullanıcıyı silme yetkiniz yok - uk: У вас немає прав для видалення цього користувача - zh: 您沒有權限刪除此用戶
409c8c4 to
6d1a77a
Compare
Summary
Implements the authorization matrix defined in issue #259 and the unified plan in the comments.
fixes #259
Changes
Core:
app/utils/delete.pyFalse.redirect()tobool(matchingdelete_post/delete_commentpattern).Callers updated
app/routes/admin_panel_users.py— passessession["username"]as perpetrator, logs rejectionsapp/routes/account_settings.py— passessession["username"], handlesboolreturnTranslations (all 12 files)
flash.delete.not_authorizedkeyflash.delete.last_adminkeyTests (
tests/e2e/auth/test_delete_user_auth.py)Covers the full authorization matrix:
Authorization Matrix