INNER CODE UNIT · Python

verify_user_for_room

leonh/redis-streams-fastapi-chat · chat.py:374

async def verify_user_for_room(chat_info):
    verified = True
    pool = await get_redis_pool()
    if not pool:
        print('Redis connection failure')
        return False
    # check for duplicated user names
    already_exists = await pool.sismember(cvar_tenant.get()+":users", cvar_chat_info.get()['username'])
    if already_exists:
        print(chat_info['username'] +' user already_exists in ' + chat_info['room'])
        verified = False
    # check for restricted names

    # check for restricted rooms
    # check for non existent rooms
    # whitelist rooms
    if not chat_info['room'] in ALLOWED_ROOMS:
        verified = False

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…