incubator-couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Martin Hilbig <blueo...@gmx.net>
Subject Re: copy request in _users
Date Sun, 06 Mar 2011 03:21:20 GMT
[1]: http://guide.couchdb.org/draft/validation.html

sorry
martin

On 06.03.2011 04:20, 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<joe.freeman@bitroot.com>
>> 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
>>> ('q@q.qa'). When the new document is validated, it has an ID of
>>> 'org.couchdb.user:xxx', but the name property is 'q@q.qa'. 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<mark@boutiquing.com> 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/org.couchdb.user%3Aq%40q.qa {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?
>>>>
>>>
>>
>>
>>
>

Mime
View raw message