def METHOD_NAME(clean_dbsession):
    from c2cgeoportal_commons.models.main import (
        OGCSERVER_AUTH_STANDARD,
        OGCSERVER_TYPE_QGISSERVER,
        LayerWMS,
        OGCServer,
        RestrictionArea,
        Role,
        TreeItem,
    )
    from c2cgeoportal_commons.models.static import User
    DBSession = clean_dbsession  # noqa: ignore=N806
    dbsession = DBSession()
    for r in dbsession.query(TreeItem).all():
        print(r.id)
    ogc_server1 = OGCServer(
        name="qgisserver",
        type_=OGCSERVER_TYPE_QGISSERVER,
        image_type="image/png",
        auth=OGCSERVER_AUTH_STANDARD,
    )
    dbsession.add(ogc_server1)
    role1 = Role("role_no_access")
    role2 = Role("role_full_access")
    role3 = Role("role_area_access")
    dbsession.add_all((role1, role2, role3))
    user_no_access = User("user_no_access", roles=[role1])
    user_full_access = User("user_full_access", roles=[role2])
    user_area_access = User("user_area_access", roles=[role3])
    dbsession.add_all((user_no_access, user_full_access, user_area_access))
    project = QgsProject.instance()
    for node in [
        {
            "name": "root",
            "type": "group",
            "children": [
                {
                    "name": "private_group",
                    "type": "group",
                    "children": [{"name": "private_layer", "type": "layer"}],
                },
            ],
        },
    ]:
        add_node_in_qgis_project(project, project.layerTreeRoot(), node)
    private_layer = LayerWMS(name="private_layer", layer="private_layer", public=False)
    private_layer.ogc_server = ogc_server1
    dbsession.add(private_layer)
    ra1 = RestrictionArea("restriction_area_no", layers=[private_layer], roles=[role1])
    ra2 = RestrictionArea("restriction_area_full", layers=[private_layer], roles=[role2], readwrite=True)
    ra3 = RestrictionArea(
        "restriction_area_area",
        layers=[private_layer],
        roles=[role3],
        readwrite=True,
        area=from_shape(area1, srid=21781),
    )
    dbsession.add_all((ra1, ra2, ra3))
    dbsession.flush()
    roles = {role.name: {"id": role.id} for role in (role1, role2, role3)}
    users = {
        user.username: {"id": user.id, "role_ids": [r.id for r in user.roles]}
        for user in (user_no_access, user_full_access, user_area_access)
    }
    dbsession.commit()
    dbsession.close()
    yield {
        "users": users,
        "roles": roles,
        "project": project,
    }