feat: add team ownership verification to /injury commands (closes #18) #53

Merged
cal merged 1 commits from fix/injury-team-ownership-check into next-release 2026-03-02 19:14:41 +00:00
Owner

Summary

  • Adds _verify_team_ownership() helper to InjuryGroup that checks if the invoking user owns the player's team (or an organizational affiliate)
  • Applies ownership check to both /injury set-new and /injury clear commands
  • Admins bypass the check; players without a team_id are allowed through

Test plan

  • 6 new tests in tests/test_injury_ownership.py covering:
    • Admin bypasses ownership check
    • Team owner passes check
    • Org affiliate (MiL/IL) owner passes check
    • Different team owner is denied with "Not Your Player" embed
    • User with no team is denied with "No Team Found" embed
    • Player without team_id passes (can't verify, allow through)
  • Full test suite passes (941 passed, 3 skipped)

🤖 Generated with Claude Code

## Summary - Adds `_verify_team_ownership()` helper to `InjuryGroup` that checks if the invoking user owns the player's team (or an organizational affiliate) - Applies ownership check to both `/injury set-new` and `/injury clear` commands - Admins bypass the check; players without a team_id are allowed through ## Test plan - [x] 6 new tests in `tests/test_injury_ownership.py` covering: - Admin bypasses ownership check - Team owner passes check - Org affiliate (MiL/IL) owner passes check - Different team owner is denied with "Not Your Player" embed - User with no team is denied with "No Team Found" embed - Player without team_id passes (can't verify, allow through) - [x] Full test suite passes (941 passed, 3 skipped) 🤖 Generated with [Claude Code](https://claude.com/claude-code)
cal added 1 commit 2026-03-01 22:18:52 +00:00
Prevents users from managing injuries for players not on their team.
Admins bypass the check; org affiliates (MiL/IL) are recognized.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
cal force-pushed fix/injury-team-ownership-check from f387eddaf9 to bb57868322 2026-03-01 22:41:06 +00:00 Compare
cal force-pushed fix/injury-team-ownership-check from bb57868322 to 99489a3c42 2026-03-01 23:00:01 +00:00 Compare
cal merged commit ced67a5eef into next-release 2026-03-02 19:14:41 +00:00
cal deleted branch fix/injury-team-ownership-check 2026-03-02 19:14:41 +00:00
Sign in to join this conversation.
No reviewers
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: cal/major-domo-v2#53
No description provided.