mirror of
https://github.com/GNS3/gns3-server.git
synced 2026-09-29 15:20:13 +03:00
fix: Hard-delete API keys instead of soft delete (revoked flag)
Removing the soft-delete approach — revoked keys are now deleted from the database entirely via DELETE endpoint. This prevents the api_keys table from accumulating stale records.
This commit is contained in:
parent
bfef0a36e3
commit
9d441517fd
@ -119,9 +119,9 @@ async def revoke_api_key(
|
|||||||
from fastapi import HTTPException
|
from fastapi import HTTPException
|
||||||
raise HTTPException(status_code=404, detail="API key not found")
|
raise HTTPException(status_code=404, detail="API key not found")
|
||||||
|
|
||||||
# Only the key owner can revoke it
|
# Only the key owner can delete it
|
||||||
if key.user_id != current_user.user_id:
|
if key.user_id != current_user.user_id:
|
||||||
from fastapi import HTTPException
|
from fastapi import HTTPException
|
||||||
raise HTTPException(status_code=403, detail="Cannot revoke another user's API key")
|
raise HTTPException(status_code=403, detail="Cannot delete another user's API key")
|
||||||
|
|
||||||
await api_keys_repo.revoke_api_key(api_key_id)
|
await api_keys_repo.delete_api_key(api_key_id)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user