Compare commits
No commits in common. "3ee8d5bbab9f15f5e21b6eefdd1e0ebf7b1c4f62" and "9cf6dedc53cdf1a5f1f41eb8825ec8f5b1d8f37d" have entirely different histories.
3ee8d5bbab
...
9cf6dedc53
@ -16,7 +16,6 @@ from aiohttp_session.cookie_storage import EncryptedCookieStorage
|
||||
from aiohttp_session.redis_storage import RedisStorage
|
||||
|
||||
from appPublic.jsonConfig import getConfig
|
||||
from appPublic.dictObject import DictObject
|
||||
from appPublic.rsawrap import RSA
|
||||
from appPublic.log import info, debug, warning, error, critical, exception
|
||||
|
||||
@ -27,21 +26,12 @@ def get_client_ip(obj, request):
|
||||
request['client_ip'] = ip
|
||||
return ip
|
||||
|
||||
async def get_session_userinfo(request):
|
||||
info = await auth.get_auth(request).split(':')
|
||||
return DictObject(**{
|
||||
'userid':info[0],
|
||||
'username':info[1],
|
||||
'userorgid':info[2]
|
||||
})
|
||||
|
||||
async def get_session_user(request):
|
||||
userid = await get_session_userinfo(request).userid
|
||||
userid = await auth.get_auth(request)
|
||||
return userid
|
||||
|
||||
async def user_login(request, userid, username='', userorgid=''):
|
||||
info = f'{userid}:{username}:{userorgid}'
|
||||
await auth.remember(request, userinfo)
|
||||
async def user_login(request, userid):
|
||||
await auth.remember(request, userid)
|
||||
|
||||
async def user_logout(request):
|
||||
await auth.forget(request)
|
||||
|
@ -57,7 +57,7 @@ from .dbadmin import DBAdmin
|
||||
from .filedownload import file_download, path_decode
|
||||
from .utils import unicode_escape
|
||||
from .filetest import current_fileno
|
||||
from .auth_api import user_login, user_logout, get_session_user, get_session_userinfo
|
||||
from .auth_api import user_login, user_logout, get_session_user
|
||||
|
||||
def getHeaderLang(request):
|
||||
al = request.headers.get('Accept-Language')
|
||||
@ -256,18 +256,6 @@ class ProcessorResource(StaticResource,Url2File):
|
||||
async def forget_user():
|
||||
await user_logout(request)
|
||||
|
||||
async def get_username():
|
||||
info = await get_session_userinfo(request)
|
||||
return info.username
|
||||
|
||||
async def get_userinfo():
|
||||
info = await get_session_userinfo(request)
|
||||
return info
|
||||
|
||||
async def get_userorgid():
|
||||
info = await get_session_userinfo(request)
|
||||
return info.userorgid
|
||||
|
||||
async def get_user():
|
||||
return await get_session_user(request)
|
||||
|
||||
@ -285,9 +273,6 @@ class ProcessorResource(StaticResource,Url2File):
|
||||
self.y_env.remember_user = remember_user
|
||||
self.y_env.forget_user = forget_user
|
||||
self.y_env.get_user = get_user
|
||||
self.y_env.get_username = get_username
|
||||
self.y_env.get_userorgid = get_userorgid
|
||||
self.y_env.get_userinfo = get_userinfo
|
||||
self.y_env.i18nDict = i18nDICT
|
||||
self.y_env.terminalType = getClientType(request)
|
||||
self.y_env.entire_url = partial(self.entireUrl,request)
|
||||
|
Loading…
Reference in New Issue
Block a user