added handler to ensure only logged in users can add documents to the posts collection