def get_token_owner(self, db_connection: IConnection, token: str): client_id = None token = db_connection.find({'token': token}) if len(token) > 0: client_id = token[0].get('client_id', None) return client_id
def find_user(self, db_connection: IConnection, username: str, client_id: str): user = db_connection.find({ 'username': username, 'client_id': client_id }) return user[0] if len(user) > 0 else None
def get_client(self, db_connection: IConnection, client_id): client = db_connection.find({'client_id': str(client_id)}) return client[0] if len(client) > 0 else None