def disable_account(uid):

    db = api.common.get_conn()
    result = db.users.update(
        {"uid": uid, "disabled": False},
        {"$set": {"disabled": True}})

    tid = api.user.get_team(uid=uid)["tid"]

    # Making certain that we have actually made a change.
    # result["n"] refers to how many documents have been updated.
    if result["n"] == 1:
        db.teams.find_and_modify(
            query={"tid": tid, "size": {"$gt": 0}},
            update={"$inc": {"size": -1}},
            new=True)

        api.team.determine_eligibility(tid)
Disables a user account. They will no longer be able to login and do not count
dataset/ETHPy150Open IceCTF/ctf-platform/api/api/user.py/disable_account