Skip to content

User creation #56

Closed
ahamid opened this Issue Mar 6, 2011 · 4 comments

2 participants

@ahamid
ahamid commented Mar 6, 2011

Is user creation something that would be considered in scope for this library? E.g.:

def self.create_user_doc(username, password, roles = [])
  doc = {
    :name => username,
    :_id => "org.couchdb.user:" + username,
    :type => "user",
    :roles => (roles || [])
  }
  if !password.nil?
    doc[:salt] = UUID.generate
    doc[:password_sha] = Digest::SHA1.hexdigest(password + doc[:salt])
  end
  return doc
end
@ahamid
ahamid commented Mar 6, 2011

See pull request: #58

@ahamid
ahamid commented Mar 6, 2011

has patch and test, see last comment

@ahamid
ahamid commented Dec 24, 2011

comments...?

@samlown
CouchRest member
samlown commented Jul 13, 2015

4 and a half years later... I think this is a useful feature, but I'm not convinced on the User Document part. Given that this is a one-way process, i.e. fetching a user returns a regular Document, I think a UserDocument abstraction is beneficial.

If this is still useful, I'd suggest sticking create_user document in the Server class.

@samlown samlown closed this Jul 13, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.