Permissions UI

Among other things, fixes #482 and #450.
Having it in its own file is hard to find. Also, I see roles as something which are defined *over* documents, so there is some relation to documents. We have even field names name "admin" and "maintainer". Not to mention that field names and role names have to be kept in sync, no? So I would be for moving it.