def with_organisation_permissions(
    organisation: Organisation, staff_user: FFAdminUser
) -> WithOrganisationPermissionsCallable:
    """
    Add organisation permissions to the staff_user fixture.
    Defaults to associating to the organisation fixture.
    """

    def _with_organisation_permissions(
        permission_keys: list[str], organisation_id: int | None = None
    ) -> UserOrganisationPermission:
        organisation_id = organisation_id or organisation.id
        uop, __ = UserOrganisationPermission.objects.get_or_create(
            organisation_id=organisation_id, user=staff_user
        )
        uop.permissions.add(*permission_keys)  # type: ignore[arg-type]

        return uop

    return _with_organisation_permissions

    Add organisation permissions to the staff_user fixture.
    Defaults to associating to the organisation fixture.
    
api/conftest.py