Skip to content

AAI-182 refactor and clean up user/role checking to enable admin endpoints#19

Merged
marius-mather merged 21 commits into
mainfrom
admin-endpoints
May 25, 2025
Merged

AAI-182 refactor and clean up user/role checking to enable admin endpoints#19
marius-mather merged 21 commits into
mainfrom
admin-endpoints

Conversation

@marius-mather

@marius-mather marius-mather commented May 23, 2025

Copy link
Copy Markdown
Collaborator

Description

AAI-182: I started on implementing admin endpoints, but realised we needed a bit of a refactor of how we check users/roles. This PR contains an initial admin endpoint to show the approach, but also refactors our existing user checks.

Changes

  • Implement a user_is_admin check that we can apply to all admin routes
  • Set the list of Admin roles via config
  • Initial /admin/users endpoint to demonstrate a route that requires admin
  • Unit tests of admin checking/user endpoint
  • Refactor of existing validation/user checks

Checklist

  • I have commented my code, particularly in hard-to-understand areas
  • I have added unit / integration tests that prove my fix is effective or that my feature works
  • I have run all tests locally and they pass
  • I have updated the documentation (if applicable)

How to Test Manually (if necessary)

Run uv run pytest

@amandazhuyilan

Copy link
Copy Markdown
Contributor

Overall looks great - just a nick pick on linting...

amandazhuyilan
amandazhuyilan previously approved these changes May 25, 2025
Comment thread schemas/tokens.py
Comment thread tests/conftest.py
@marius-mather marius-mather merged commit 8ae8773 into main May 25, 2025
1 check 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.

2 participants