feat: eigener benutzer per token abfragbar (/api/users/me)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
dbildhauerandClaude Opus 5.5 committed 2026-10-25 14:58:26 +01:00
1 parent 223eb4eb45
commit db700fd003
2 files changed
+11

No files matched your search

+6
View File
@@ -13,6 +13,12 @@ class UserName(BaseModel):
username: str
@router.get("/me", response_model=UserName)
def me(user: ApiUser) -> UserName:
"""Who a token belongs to (e.g. so the agent only takes over its owner's clips)."""
return UserName(id=user.id, username=user.username)
@router.get("", response_model=list[UserName])
def list_user_names(user: ApiUser, db: DbSession) -> list[UserName]:
"""Names of the other active users, for sharing projects; nothing else is revealed."""
+5
View File
@@ -239,3 +239,8 @@ def test_latest_clip_ignores_pinning_and_files(agent):
agent.post("/api/files", params={"name": "newer.txt"}, content=b"file")
assert agent.get("/api/clips/latest").json()["content"] == "newest text"
def test_token_knows_its_user(agent, db):
anna = db.query(User).filter_by(username="anna").one()
assert agent.get("/api/users/me").json() == {"id": anna.id, "username": "anna"}