bugfix
This commit is contained in:
parent
59d517cbd5
commit
f4b66212d5
@ -31,20 +31,20 @@ async def get_session_userinfo(request):
|
|||||||
d = await auth.get_auth(request)
|
d = await auth.get_auth(request)
|
||||||
if d is None:
|
if d is None:
|
||||||
return DictObject()
|
return DictObject()
|
||||||
info = d.split(':')
|
ui = d.split(':')
|
||||||
return DictObject(**{
|
return DictObject(**{
|
||||||
'userid':info[0],
|
'userid':ui[0],
|
||||||
'username':info[1],
|
'username':ui[1],
|
||||||
'userorgid':info[2]
|
'userorgid':ui[2]
|
||||||
})
|
})
|
||||||
|
|
||||||
async def get_session_user(request):
|
async def get_session_user(request):
|
||||||
userinfo = await get_session_userinfo(request)
|
userinfo = await get_session_userinfo(request)
|
||||||
return userinfo.userid
|
return userinfo.user
|
||||||
|
|
||||||
async def user_login(request, userid, username='', userorgid=''):
|
async def user_login(request, userid, username='', userorgid=''):
|
||||||
info = f'{userid}:{username}:{userorgid}'
|
ui = f'{userid}:{username}:{userorgid}'
|
||||||
await auth.remember(request, info)
|
await auth.remember(request, ui)
|
||||||
|
|
||||||
async def user_logout(request):
|
async def user_logout(request):
|
||||||
await auth.forget(request)
|
await auth.forget(request)
|
||||||
@ -151,8 +151,8 @@ class AuthAPI:
|
|||||||
info(f'checkAuth() called ... {request.path=}')
|
info(f'checkAuth() called ... {request.path=}')
|
||||||
t1 = time.time()
|
t1 = time.time()
|
||||||
path = request.path
|
path = request.path
|
||||||
info = await get_session_userinfo(request)
|
userinfo = await get_session_userinfo(request)
|
||||||
user = info.userid
|
user = userinfo.userid
|
||||||
is_ok = await self.checkUserPermission(user, path)
|
is_ok = await self.checkUserPermission(user, path)
|
||||||
t2 = time.time()
|
t2 = time.time()
|
||||||
ip = get_client_ip(None, request)
|
ip = get_client_ip(None, request)
|
||||||
|
Loading…
Reference in New Issue
Block a user