You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@couchdb.apache.org by svilen <az...@svilendobrev.com> on 2013/03/14 09:52:01 UTC

auto-generated user _id by POST?

g'day
i was trying to create a new user without specifying name/id, but seems
cannot do it:

$ curl  -X POST http://server:5984/_users -H 'Content-Type: application/json' -d '{"password":"mysecret", "type":"user", }' 

{"error":"forbidden","reason":"doc.name is required"}

tried with name:null but same. 

is this possible or forbidden by design?

svil

Re: auto-generated user _id by POST?

Posted by Stephen Bartell <sn...@gmail.com>.
svil,  there is a validate_doc_update function in _users (_desing/_auth) which enforces that the _user doc have a field "name" and that this value is also in the _id.

So AFAIK, it looks as if its by design.

On Mar 14, 2013, at 1:52 AM, svilen <az...@svilendobrev.com> wrote:

> g'day
> i was trying to create a new user without specifying name/id, but seems
> cannot do it:
> 
> $ curl  -X POST http://server:5984/_users -H 'Content-Type: application/json' -d '{"password":"mysecret", "type":"user", }' 
> 
> {"error":"forbidden","reason":"doc.name is required"}
> 
> tried with name:null but same. 
> 
> is this possible or forbidden by design?
> 
> svil


Re: auto-generated user _id by POST?

Posted by svilen <az...@svilendobrev.com>.
POST does return the new id/rev.. but anyway

On Thu, 14 Mar 2013 13:02:51 +0400
Alexander Shorin <kx...@gmail.com> wrote:

> Hi!
> 
> But if user doesn't know his name, how he will be able to log in?
> 
> --
> ,,,^..^,,,
> 
> 
> On Thu, Mar 14, 2013 at 12:52 PM, svilen <az...@svilendobrev.com> wrote:
> > g'day
> > i was trying to create a new user without specifying name/id, but
> > seems cannot do it:
> >
> > $ curl  -X POST http://server:5984/_users -H 'Content-Type:
> > application/json' -d '{"password":"mysecret", "type":"user", }'
> >
> > {"error":"forbidden","reason":"doc.name is required"}
> >
> > tried with name:null but same.
> >
> > is this possible or forbidden by design?
> >
> > svil

Re: auto-generated user _id by POST?

Posted by Alexander Shorin <kx...@gmail.com>.
Hi!

But if user doesn't know his name, how he will be able to log in?

--
,,,^..^,,,


On Thu, Mar 14, 2013 at 12:52 PM, svilen <az...@svilendobrev.com> wrote:
> g'day
> i was trying to create a new user without specifying name/id, but seems
> cannot do it:
>
> $ curl  -X POST http://server:5984/_users -H 'Content-Type: application/json' -d '{"password":"mysecret", "type":"user", }'
>
> {"error":"forbidden","reason":"doc.name is required"}
>
> tried with name:null but same.
>
> is this possible or forbidden by design?
>
> svil