def from_archive(httpreq: Request, archive: UploadFile) -> dict[str, int]:
    """Uncompresses a ZIP archive and processes the DFIQ content inside it."""
    with tempfile.TemporaryDirectory() as tempdir:
        contents = archive.file.read()
        ZipFile(BytesIO(contents)).extractall(path=tempdir)
        dfiq_addition = dfiq.read_from_data_directory(
            f"{tempdir}/*/*.yaml", user=httpreq.state.user.username
        )
        for indicator in dfiq_addition.indicators:
            rbac.set_acls(indicator, httpreq.state.user)
        for dfiq_object in dfiq_addition.dfiq:
            rbac.set_acls(dfiq_object, httpreq.state.user)

    return {"total_added": len(dfiq_addition.dfiq) + len(dfiq_addition.indicators)}
Uncompresses a ZIP archive and processes the DFIQ content inside it.
core/web/apiv2/dfiq.py