adds helper function to restrict unauthorized access to protected pages, like edit pages, etc