The fix;

diff --git a/src/couchdb/couch_users_db.erl b/src/couchdb/couch_users_db.erl
index 6735fb6..434ca6b 100644
--- a/src/couchdb/couch_users_db.erl
+++ b/src/couchdb/couch_users_db.erl
@@ -104,5 +104,5 @@ after_doc_read(Doc, #db{user_ctx = UserCtx} = Db) ->
         throw(not_found)
     end.
 
-get_doc_name(#doc{body={Body}}) ->
-    couch_util:get_value(?NAME, Body).
+get_doc_name(#doc{id= <<"org.couchdb.user:",Name/binary>>}) ->
+    Name.

On 22 Jun 2012, at 16:35, Gregor Martynus wrote:

> Can anybody confirm that when signed in as a user, I cannot DELETE my own 
> _users doc? It's simple to test in futon. 
> Is this a feature, or a bug?
> 
> I tested it on couchDB 1.2 myself. 
> 
> -- 
> Gregor Martynus
> 
> 
> On Wednesday, 20. June 2012 at 19:35, Gregor Martynus wrote:
> 
>> Robert, I get a 200 when I GET the same path. When I'm signed in as "test" 
>> in futon and delete my own /_users doc, I get a 404 as well. Is that not the 
>> case for you?
>> 
>> I'm on couchDB 1.2, tested locally and on IrisCouch 
>> 
>> -- 
>> Gregor Martynus
>> 
>> 
>> On Wednesday, 20. June 2012 at 18:45, Robert Newson wrote:
>> 
>>> 
>>> Do you get a 200 when you GET that same doc id? I suspect you get a 404. If 
>>> so, check you have the right id, perhaps you need to escape some fields. 
>>> Better, try deleting it from Futon which handles the escaping for you.
>>> 
>>> If you're deleting an admin user, then you need to modify your .ini files 
>>> (preferably via /_config/admins) instead.
>>> 
>>> B.
>>> 
>>> On 20 Jun 2012, at 17:28, Gregor Martynus wrote:
>>> 
>>>> I'm quite sure that this worked before, but doesn't seem to work anymore. 
>>>> 
>>>> Let's say I have a user account "test" and am signed in as "test".
>>>> The _rev number of users/org.couchdb.user:test is '1-234'
>>>> 
>>>> Shouldn't I be able to delete my own account with
>>>> DELETE /users/org.couchdb.user:test?rev=1-234
>>>> ?
>>>> 
>>>> I get a 404 response, but am still signed in as test
>>>> 
>>>> The same happens when I try to PUT the document with _deleted: true ...
>>>> 
>>>> Any idea? 
>>>> 
>>>> -- 
>>>> Gregor
>>>> 
>>> 
>>> 
>>> 
>>> 
>> 
>> 
> 

Reply via email to