private void throwPermissionException(final UserRef userRef, final String message) {
        try {
            throw new PermissionException(userRef, message);
        } catch (final PermissionException e) {
            LOGGER.error(e::getMessage, e);
            throw e;
        }
    }
Run the supplied code as the specified user.
stroom-security/stroom-security-impl/src/main/java/stroom/security/impl/SecurityContextImpl.java