diff --git a/kyapikeyclient/client.py b/kyapikeyclient/client.py index 778510f..17c2e62 100644 --- a/kyapikeyclient/client.py +++ b/kyapikeyclient/client.py @@ -1,6 +1,9 @@ from time import time from appPublic.aes import aes_encrypt_ecb, aes_decrypt_ecb +from sqlor.dbpools import DBPools +from ahserver.serverenv import get_serverenv +from ahserver.auth_api import get_session_userinfo def build_beardata(appid, apikey, secretkey): """ @@ -13,3 +16,21 @@ def build_beardata(appid, apikey, secretkey): cyber = aes_encrypt_ecb(secretkey, txt) return f'Bear {appid}-:-{cyber}' +async def get_org(sor, orgid): + orgs = await sor.R('organization', {'id': orgid}) + if len(orgs) < 1: + return None + return orgs[0] + + +async def sync_users(request, upappid, orgid): + db = DBPools() + dbname = get_dbname() + async with db.sqlorContext(dbname) as sor: + upapp = await get_upapp(sor, upappid) +async def sysn_user(request, upappid, userid): + db = DBPools() + dbname = get_dbname() + async with db.sqlorContext(dbname) as sor: + upapp = await get_upapp(sor, upappid) +