Created
April 5, 2011 17:00
-
-
Save hostsamurai/904010 to your computer and use it in GitHub Desktop.
Set up a new user to be a reader
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add the user to _users: | |
$ curl -X POST 'http://admin:[email protected]:5984/_users/' -H 'Content-Type: application/json' -d @user.json | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# do this in irb | |
require 'digest/sha1' | |
salt = "0719688397f634f5e6f0139593000a76" # from curl 'http://localhost:5984/_uuids' | |
pass = "mypassword" | |
Digest::SHA1.hexdigest("#{salt}#{pass}") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// If you're using soca, a simple `soca push` will push this to your design doc | |
{ | |
"readers": { | |
"names": ["epic_user"], | |
"roles": ["whatever"] | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"_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