AAI-421: add admin endpoints for approve and revoke access to platforms and groups#81
Conversation
4db2994 to
fbdf319
Compare
877c22b to
f628917
Compare
There was a problem hiding this comment.
Pull Request Overview
This PR adds administrative endpoints for approving and revoking user access to platforms and groups, with support for storing revocation reasons up to 1024 characters.
Key changes:
- New admin endpoints for approve/revoke operations on platforms, groups, and generic services
- Database schema updates to store revocation reasons in membership and history tables
- Request validation model that enforces trimming and character limits for revocation reasons
Reviewed Changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| routers/admin.py | Adds new admin endpoints and helper functions for approve/revoke operations |
| db/models.py | Updates membership models to include revocation_reason field and history tracking |
| db/types.py | Adds revocation_reason field to membership data models |
| tests/test_admin.py | Test coverage for new approve/revoke functionality |
| tests/db/test_models.py | Tests for revocation reason storage in models and history |
| migrations/ | Database migration files for adding revocation_reason columns |
| README.md | Minor documentation improvements for migration generation |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
marius-mather
left a comment
There was a problem hiding this comment.
A few changes needed here:
- Unless I've missed something, platform and group approvals are separate and done by different people. So we don't need combined endpoints that do both.
- We need to confirm that the admin has permission to act on the specific platform/group by checking their roles in their access token against the admin roles defined in the DB
- Not sure why we ended up with multiple migration files - is it possible to delete the new ones, and see if generating them again creates a single migration (might help to merge
maininto this branch first)
a9c84f2 to
7557256
Compare
|
Ready for review again @marius-mather 👍 - a list of changes:
|
marius-mather
left a comment
There was a problem hiding this comment.
Needs some slight tweaking in terms of how we look up groups and platforms - we should do this from the DB wherever possible, PLATFORM_MAPPING/GROUP_MAPPING are workarounds that should only be needed in specific cases.
I've fixed up the migrations so that the previous platform-related ones aren't deleted - they might have already been applied on the deployment so we don't want to remove them.
Otherwise looks good to go.
e3afb56 to
9d9218c
Compare
|
One last review please @marius-mather 🙏 |
|
@amandazhuyilan force-pushing undid the fix I did for migrations - please don't force push or it can break things like that. I will fix migrations again now, after that this is looking good to merge. |
This reverts commit 18c7a84.
…ng platform migrations
marius-mather
left a comment
There was a problem hiding this comment.
Looking good now, thanks!
Description
AAI-421: add admin endpoints for approve and revocation (with reasons) for groups and platforms.
Changes
Checklist
How to Test Manually (if necessary)
<Describe how reviewers can manually, if necessary, test the changes>