Apply ACL restriction filters for a search query

That was better with a varible and a skinny `foreach`.