Permissions UI

Among other things, fixes #482 and #450.
Should all this be simply in `lib/documents/lib/document.coffee`, together with `ACCESS`.