Added a permission model for pages

Public pages can be viewed by anyone. Pages that are not public can be
viewed only by groups with permission to view pages. Big thanks to
@onmoon for original implementation.