Clean up updateDoc, and sequence of db changes

* Fixed the ordering of db changes made by the core db.updateDoc method.
  The user/role documents now have their cached channels invalidated
  AFTER the new document revision has been saved; this fixes a race
  condition.
* Multiple retries in updateDoc (if there are race conditions) no longer
  cause multiple sequence numbers to be generated.
* Refactored some Database methods into document.
* Added a way to get the IDs of all users/roles:
  DatabaseContext.AllPrincipalIDs.
* Added admin REST API to get list of users/roles (GET /db/users, etc.)
Update to newer revision of gomemcached (some bug fixes)