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 6ef421f commit 74e14ebCopy full SHA for 74e14eb
business_objects/user.py
@@ -14,6 +14,15 @@ def get(user_id: str) -> User:
14
return session.query(User).get(user_id)
15
16
17
+def get_user_cached_if_not_admin(user_id: str) -> Optional[User]:
18
+ user = get_user_cached(user_id)
19
+ if user.email.endswith("@kern.ai") and user.verified:
20
+ # for admins this could result in two db requests shortly after each other
21
+ # but it's better than having the jumping users without the correct org id
22
+ return get(user_id)
23
+ return user
24
+
25
26
@TTLCacheDecorator(CacheEnum.USER, 5, "user_id")
27
def get_user_cached(user_id: str) -> User:
28
user = get(user_id)
0 commit comments