[JENKINS-61465] Make checkAnyPermission work on non-AccessControlled (cherry picked from commit bdff7475)