couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mark Hahn <>
Subject Re: copy request in _users
Date Sun, 06 Mar 2011 06:20:20 GMT
> which other case are you referring to?

When I was first storing attachments and fields in _users I somehow
managed to corrupt my installation.  (I know, couchdb can't be
corrupted). Anyway, I lost the ability to log in.  My old post is
below.  I should have tracked down what happened but I was in a rush
and I just reinstalled everything and restored my docs.

Thanks for the pointer to validation  functions.  I was a bit hasty in
concluding couch couldn't handle copy in _users.  In any case I'm
moving my data and attachments out of the user docs like I mentioned.
I am just being careful.

----- old post ----

I have gotten my installation to the point where only admins in the
config file can log in.  All the logins come back as incorrect name or
password, both with my app and futon.  When I create a new user with
futon it creates the user but before the dialog goes away it give the
same login error.

... snip ...

On Sat, Mar 5, 2011 at 7:20 PM, Martin Hilbig <> wrote:
> On 05.03.2011 20:09, Mark Hahn wrote:
>> Ah, I didn't think of that.  Having hidden code to check that the name field
>> matches the id is a real kludge.  So copy doesn't work in _users.  Using put
>> to copy would be a real pita because I have attachments.  I guess I'll have
>> to create a new doc in another db with a one-to-one relationship with the
>> users.
> hi,
> may i point out that the code which validates the docid is stored in the "validate_doc_update"
field of the "_design/_auth" design document?
> you may want to have a look at[1].
>> This is the second time I've gotten burned by storing stuff in _users.  The
>> docs should say to not store stuff in _users or couch should disallow it.
> which other case are you referring to? from what i know storing stuff in _users isn't
prevented, it's just need to be in a very specific form. i don't know if it persistent, but
a quick test showed you can even uncomment everything in the validation function mentioned
above, although i don't recommend it.
> have fun
> martin
>> On Sat, Mar 5, 2011 at 3:58 AM, Joe Freeman<>  wrote:
>>> I've never tried out COPY, but I suspect this is because when you copy
>>> the document over, the document's 'name' property stays the same
>>> (''). When the new document is validated, it has an ID of
>>> 'org.couchdb.user:xxx', but the name property is ''. The
>>> validation rule requires that the document ID is 'org.couchdb.user:'
>>> followed by the name.
>>> If you want to rename a user, you'll probably need to PUT the new user
>>> document manually with an updated 'name' property.
>>> On 5 March 2011 10:07, Mark Hahn<>  wrote:
>>>> When I try a copy request in the _users db I get the error ...
>>>>    403, forbidden, Doc ID must be of the form org.couchdb.user:name
>>>> The request as shown in the couch log is :
>>>> [debug] [<0.26409.36>] "COPY" /_users/ {1,1}
>>>> Headers: [{'Connection',"close"},
>>>>          {'Content-Type',"application/json"},
>>>>          {'Cookie'," ... snip ..."},
>>>>          {"Destination","org.couchdb.user:xxx"},
>>>>          {'Host',"localhost"},
>>>>          {'Transfer-Encoding',"chunked"}]
>>>> I've also tried encoding the Destination header
>>>> as {"Destination","org.couchdb.user%3Axxx"}.
>>>> The request path is url encoded the same way as in all of my other
>>> working
>>>> requests. The id shown above works in get, put, etc.  I'm using
>>>> jquery.couch.js so I'm pretty sure the only thing I could be doing wrong
>>> is
>>>> the Destination header. jquery.couch.js is formatting everything but the
>>>> headers.
>>>> Any ideas?

Mark Hahn
Website Manager

View raw message