code: protected boolean objectVisibleToUser(String objectTenancyPath, String userTenancyPath) {
          // if in "same hierarchy"
          return objectTenancyPath.startsWith(userTenancyPath) ||
                  userTenancyPath.startsWith(objectTenancyPath);
      }
docs: Protected visibility so can be overridden if required, eg using wildcard matches.