We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent d4f78d6 commit 4d6970cCopy full SHA for 4d6970c
2 files changed
backend/common/context.py
@@ -22,6 +22,7 @@ class TypedContextProtocol(Protocol):
22
language: str
23
24
user_id: int | None
25
+ is_superuser: bool
26
27
28
class TypedContext(TypedContextProtocol, _Context):
backend/common/security/jwt.py
@@ -255,7 +255,9 @@ async def jwt_authentication(token: str) -> GetUserInfoWithRelationDetail:
255
if token != redis_token:
256
raise errors.TokenError(msg='Token 已失效')
257
258
- return await get_jwt_user(ctx.user_id)
+ user = await get_jwt_user(ctx.user_id)
259
+ ctx.is_superuser = user.is_superuser
260
+ return user
261
262
263
def jwt_authentication_verify(
0 commit comments