couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From J Chris Anderson <jch...@gmail.com>
Subject Re: How to delete a user
Date Tue, 13 Jul 2010 15:00:12 GMT

On Jul 13, 2010, at 3:32 AM, mickael.bailly@free.fr wrote:

> My bad, the PUT trick does not work... I made a typo error ( using deleted instead of
_deleted)...
> 
> There seems to be no way of deleting a user...
> 

Whoops! sorry about that. I've fixed this bug in trunk.

If you need to delete users and don't want to upgrade to trunk, you can repair this issue
from Futon.

visit: http://127.0.0.1:5984/_utils/document.html?_users/_design/_auth

edit the validate_doc_update string so that the "if" block starting with:

"if (newDoc._deleted === true) {"

comes at the top of the function, above the doc.type checking section

save the design document, and now you should be able to delete users (as an admin).

Chris

> ----- Mail Original -----
> De: "mickael bailly" <mickael.bailly@free.fr>
> À: user@couchdb.apache.org
> Envoyé: Mardi 13 Juillet 2010 10h24:47 GMT +01:00 Amsterdam / Berlin / Berne / Rome
/ Stockholm / Vienne
> Objet: Re: How to delete a user
> 
> Hello,
> 
> the GET part :
> 
> $ curl --proxy "" -X GET http://adm:sometest@localhost:5984/_users/org.couchdb.user:joe
> {"_id":"org.couchdb.user:joe","_rev":"1-3aa8c71e227226e1363a759839a572d8","salt":"ab20f6a8e2cf91be6ce319d86be07a2a0207d7a1","password_sha":"d2fe4ed55fa1ef70b62b737d88890b38e5818106","name":"joe","type":"user","roles":[]}
> 
> the DELETE part :
> 
> curl --proxy "" -X DELETE "http://adm:sometest@localhost:5984/_users/org.couchdb.user:joe?rev=1-3aa8c71e227226e1363a759839a572d8"
> {"error":"forbidden","reason":"doc.type must be user"}
> 
> However, like J Chris suggest it, if I use a PUT request, adding the {"_deleted": true}
property, it works.
> 
> Sad but true.
> 
> Mickael
> 
> ----- Mail Original -----
> De: "Benoit Chesneau" <bchesneau@gmail.com>
> À: user@couchdb.apache.org
> Envoyé: Mardi 13 Juillet 2010 09h06:59 GMT +01:00 Amsterdam / Berlin / Berne / Rome
/ Stockholm / Vienne
> Objet: Re: How to delete a user
> 
> On Mon, Jul 12, 2010 at 1:36 PM,  <mickael.bailly@free.fr> wrote:
>> Hello Couchers,
>> 
>> I'm playing with CouchDB Security features, but can't get a user removal script to
work.
>> I try to fetch the user object, from the _users database, and then issue a DELETE
REST query (of course, including the revision).
>> 
>> It does not work, and returns an error "doc.type must be user". I went through the
wiki but did not find how to delete a user.
>> 
>> Anyone can help me ?
>> 
>> Regards,
>> 
>> Mickael
>> 
>> 
>> 
> 
> What are your GET and DELETE call ?
> 
> - benoît


Mime
View raw message