Fixed EZP-21959: Security: Siteaccess matching is loose, in legacy stack

Based on https://github.com/ezsystems/ezpublish-legacy/pull/907
Working on my fork since I don't have access on ezsystems.
Fixed CS nitpick: indentation.