Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 0 additions & 6 deletions include/couch_js_functions.hrl
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,6 @@
throw({forbidden: 'doc.roles must be an array'});
}

for (var idx = 0; idx < newDoc.roles.length; idx++) {
if (typeof newDoc.roles[idx] !== 'string') {
throw({forbidden: 'doc.roles can only contain strings'});
}
}

if (newDoc._id !== ('org.couchdb.user:' + newDoc.name)) {
throw({
forbidden: 'Doc ID must be of the form org.couchdb.user:name'
Expand Down
6 changes: 2 additions & 4 deletions src/couch_db.erl
Original file line number Diff line number Diff line change
Expand Up @@ -397,10 +397,8 @@ validate_names_and_roles({Props}) when is_list(Props) ->
_ -> throw("names must be a JSON list of strings")
end,
case couch_util:get_value(<<"roles">>,Props,[]) of
Rs when is_list(Rs) ->
[throw("roles must be a JSON list of strings") ||R <- Rs, not is_binary(R)],
Rs;
_ -> throw("roles must be a JSON list of strings")
Rs when is_list(Rs) -> Rs;
_ -> throw("roles must be a JSON list.")
end,
ok.

Expand Down