Interesting case. Hard to make that call with "allemansrätten", this could be considered "hemfridszon" as your passing right by the buildings. But it is also a road passing through which is publicly accessible by the law. This would need to be tried in court, the landowner might also have gotten permission from the municipality to restrict access, this is unclear, and would be interesting as the border between two municipalities runs here.