Skip to content

Instantly share code, notes, and snippets.

@hostsamurai
Created April 5, 2011 17:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hostsamurai/904010 to your computer and use it in GitHub Desktop.
Save hostsamurai/904010 to your computer and use it in GitHub Desktop.
Set up a new user to be a reader
Add the user to _users:
$ curl -X POST 'http://admin:admin_pass@127.0.0.1:5984/_users/' -H 'Content-Type: application/json' -d @user.json
# do this in irb
require 'digest/sha1'
salt = "0719688397f634f5e6f0139593000a76" # from curl 'http://localhost:5984/_uuids'
pass = "mypassword"
Digest::SHA1.hexdigest("#{salt}#{pass}")
// If you're using soca, a simple `soca push` will push this to your design doc
{
"readers": {
"names": ["epic_user"],
"roles": ["whatever"]
}
}
{
"_id" : "org.couchdb.user:epic_user",
"type" : "user",
"name" : "epic_user",
"roles" : ["whatever"],
"password_sha" : "e97a410886400880705cdf17bbefd4e4deeaf802", // computed from the irb session above
"salt" : "0719688397f634f5e6f0139593000a76" // from curl 'http://localhost:5984/_uuids'
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment