Fix the algorithm for Role.isInRole and ACL.checkAccess