mirror of
https://github.com/hansjone/netx.git
synced 2026-10-15 07:10:45 +08:00
Unify NetX UI to compact ops chrome and add API key purge.
Align network/list shells and audit header with industrial panels; allow permanently deleting revoked API keys. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
parent
4d60601050
commit
046029aa16
11 changed files with 417 additions and 286 deletions
|
|
@ -667,6 +667,18 @@ def revoke_api_token(db: Session, *, token_id: str, actor: AppUser) -> ApiToken:
|
|||
return row
|
||||
|
||||
|
||||
def delete_api_token(db: Session, *, token_id: str, actor: AppUser) -> ApiToken:
|
||||
"""Permanently remove an API key row (revoked or active)."""
|
||||
row = db.query(ApiToken).filter(ApiToken.id == str(token_id)).one_or_none()
|
||||
if row is None:
|
||||
raise HTTPException(status_code=404, detail="api_token_not_found")
|
||||
if actor.role != "admin" and row.user_id != actor.id:
|
||||
raise HTTPException(status_code=403, detail="forbidden")
|
||||
db.delete(row)
|
||||
db.commit()
|
||||
return row
|
||||
|
||||
|
||||
def update_api_token(
|
||||
db: Session,
|
||||
*,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue