You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@couchdb.apache.org by Paweł Stawicki <pa...@gmail.com> on 2010/08/05 01:27:16 UTC

Problem with creating user on Ubuntu 10.04, CouchDB 1.0.

Hi,

I have installed couchdb 1.0 on my Ubuntu 10.04 machine, according to this
page: http://wiki.apache.org/couchdb/Installing_on_Ubuntu, example 1.

I have created admin account, but cannot create any non-admin accounts. When
I am not logged in on Futon, and I click Signup link, there is form
displayed with fields to enter username/password. But when I enter anything
there, I am getting very long error message and user is not created (it is
not in _users db). Error message is displayed below "username" field. Here
it is:

Signup error: {gen_server,call, [couch_query_servers,
{get_proc,{doc,<<"_design/_auth">>, {1,
[<<84,165,145,147,156,145,146,42,53,239,238,7, 235,44,58,114>>]},
{[{<<"language">>,<<"javascript">>}, {<<"validate_doc_update">>, <<"\n
function(newDoc, oldDoc, userCtx) {\n if ((oldDoc && oldDoc.type !== 'user')
|| newDoc.type !== 'user') {\n throw({forbidden : 'doc.type must be
user'});\n } // we only allow user docs for now\n\n if (newDoc._deleted ===
true) {\n // allow deletes by admins and matching users\n // without
checking the other fields\n if ((userCtx.roles.indexOf('_admin') !== -1)
||\n (userCtx.name == oldDoc.name)) {\n return;\n } else {\n
throw({forbidden: 'Only admins may delete other user docs.'});\n }\n }\n\n
if (!newDoc.name) {\n throw({forbidden: 'doc.name is required'});\n }\n\n if
(!(newDoc.roles && (typeof newDoc.roles.length !== 'undefined'))) {\n
throw({forbidden: 'doc.roles must be an array'});\n }\n\n if (newDoc._id !==
('org.couchdb.user:' + newDoc.name)) {\n throw({\n forbidden: 'Doc ID must
be of the form org.couchdb.user:name'\n });\n }\n\n if (oldDoc) { //
validate all updates\n if (oldDoc.name !== newDoc.name) {\n
throw({forbidden: 'Usernames can not be changed.'});\n }\n }\n\n if
(newDoc.password_sha && !newDoc.salt) {\n throw({\n forbidden: 'Users with
password_sha must have a salt.' +\n 'See /_utils/script/couch.js for example
code.'\n });\n }\n\n if (userCtx.roles.indexOf('_admin') === -1) {\n if
(oldDoc) { // validate non-admin updates\n if (userCtx.name !== newDoc.name)
{\n throw({\n forbidden: 'You may only update your own user document.'\n
});\n }\n // validate role updates\n var oldRoles = oldDoc.roles.sort();\n
var newRoles = newDoc.roles.sort();\n\n if (oldRoles.length !==
newRoles.length) {\n throw({forbidden: 'Only _admin may edit roles'});\n
}\n\n for (var i = 0; i < oldRoles.length; i++) {\n if (oldRoles[i] !==
newRoles[i]) {\n throw({forbidden: 'Only _admin may edit roles'});\n }\n }\n
} else if (newDoc.roles.length > 0) {\n throw({forbidden: 'Only _admin may
set roles'});\n }\n }\n\n // no system roles in users db\n for (var i = 0; i
< newDoc.roles.length; i++) {\n if (newDoc.roles[i][0] === '_') {\n
throw({\n forbidden:\n 'No system roles (starting with underscore) in users
db.'\n });\n }\n }\n\n // no system names as names\n if (newDoc.name[0] ===
'_') {\n throw({forbidden: 'Username may not start with underscore.'});\n
}\n }\n">>}]}, [],false,[]}, {<<"_design/_auth">>,
<<"1-54a591939c91922a35efee07eb2c3a72">>}}]}

Best regards
--
Paweł Stawicki
http://pawelstawicki.blogspot.com
http://szczecin.jug.pl