Style.
Moved publish endpoint to server-level file.
Cleaned server side access logic.

Check for null explicitly. Return boolean instead of count. Don't throw
an exception if user does not have access to the document.