[ https://issues.apache.org/jira/browse/COUCHDB-1121?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Denny Trebbin updated COUCHDB-1121:
-----------------------------------
Attachment: couch.log
> Signup error is shown after creating an administrator account
> -------------------------------------------------------------
>
> Key: COUCHDB-1121
> URL: https://issues.apache.org/jira/browse/COUCHDB-1121
> Project: CouchDB
> Issue Type: Bug
> Components: Futon
> Affects Versions: 1.0.2
> Environment: Mac OS X 10.6.7, Max OS X 10.7.preview2, Ubuntu 10.10, all systems
are running in x86_64 mode.
> Reporter: Denny Trebbin
> Priority: Minor
> Attachments: Apache CouchDB - Futon Overview - Google Chrome_001.png, couch.log
>
>
> A fresh new installation of CouchDB comes with no pre defined admin account. Futon shows
a little message and provides a Link to fix this.
> If I try to add an user named as root and give him a password then Futon will show an
error after saving this account.
> Signup error: {gen_server,call,
> [couch_query_servers,
> {get_proc,{doc,<<"_design/_auth">>,
> {1,
> [<<196,79,177,42,38,118,212,129,210,53,82,48,
> 146,224,206,196>>]},
> {[{<<"language">>,<<"javascript">>},
> {<<"validate_doc_update">>,
> <<"\n function(newDoc, oldDoc, userCtx) {\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 ((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.name) {\n throw({forbidden:
'doc.name is required'});\n }\n\n if (newDoc.roles && !isArray(newDoc.roles))
{\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-c44fb12a2676d481d235523092e0cec4">>}}]}
> The admin account will be created and I can log in with the admin account "root". This
problem showed up every time I installed CouchDB on my machine.
> On Mac OS I used Homebrew ($ brew install couchdb) to install CouchDB which downloads
all the sources, compiles them and install properly. On my Linux machine I've followed the
compile instructions from the Wiki page.
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
|