def check_accessible_cases(item, user):
    """Check if all cases of a cohort are accessible for a user."""
    if user == item.user or user.is_superuser:
        return True

    return set(item.cases.filter(project__roles__user=user)) == set(item.cases.all())