private void checkLogin() {
        final Boolean currentCheckType = checkTypeThreadLocal.get();
        try {
            // Don't check any further permissions.
            checkTypeThreadLocal.set(Boolean.FALSE);
            if (getUserIdentity() == null) {
                throw new PermissionException(
                        getUserRef(),
                        "A user must be logged in to call service");
            }
        } finally {
            checkTypeThreadLocal.set(currentCheckType);
        }
    }
Run the supplied code regardless of whether there is a current user and also allow all inner code to run
insecurely even if it is often secured when executed from other entry points.
stroom-security/stroom-security-impl/src/main/java/stroom/security/impl/SecurityContextImpl.java