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
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ share/server/main-coffee.js
share/server/main.js
share/server/main-ast-bypass.js
share/www
src/argparse/
src/bear/
src/certifi/
src/couch/priv/couch_js/**/config.h
Expand All @@ -55,6 +56,7 @@ src/couch/priv/couch_js/**/*.d
src/couch/priv/icu_driver/couch_icu_driver.d
src/cowlib/
src/mango/src/mango_cursor_text.nocompile
src/erlperf/
src/excoveralls/
src/fauxton/
src/folsom/
Expand Down
4 changes: 3 additions & 1 deletion rebar.config.script
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,9 @@ DepDescs = [
{jiffy, "jiffy", {tag, "1.1.3"}},
{mochiweb, "mochiweb", {tag, "v3.3.0"}},
{meck, "meck", {tag, "v1.1.0"}},
{recon, "recon", {tag, "2.5.6"}}
{recon, "recon", {tag, "2.5.6"}},
{argparse, {url, "https://github.com/max-au/argparse"}, "1.2.4"},
{erlperf, {url, "https://github.com/max-au/erlperf"}, "2.3.0"}
].

WithProper = lists:keyfind(with_proper, 1, CouchConfig) == {with_proper, true}.
Expand Down
2 changes: 2 additions & 0 deletions src/couch/src/couch_query_servers.erl
Original file line number Diff line number Diff line change
Expand Up @@ -490,6 +490,8 @@ validate_doc_update(Db, DDoc, EditDoc, DiskDoc, Ctx, SecObj) ->
case Resp of
ok ->
ok;
{[{<<"forbidden">>, Message}, {<<"failures">>, Failures}]} ->
throw({forbidden, Message, Failures});
{[{<<"forbidden">>, Message}]} ->
throw({forbidden, Message});
{[{<<"unauthorized">>, Message}]} ->
Expand Down
11 changes: 8 additions & 3 deletions src/mango/src/mango_native_proc.erl
Original file line number Diff line number Diff line change
Expand Up @@ -115,9 +115,14 @@ handle_call({prompt, [<<"ddoc">>, DDocId, [<<"validate_doc_update">>], Args]}, _
[NewDoc, OldDoc, _Ctx, _SecObj] = Args,
Struct = {[{<<"newDoc">>, NewDoc}, {<<"oldDoc">>, OldDoc}]},
Reply =
case mango_selector:match(Selector, Struct) of
true -> true;
_ -> {[{<<"forbidden">>, <<"document is not valid">>}]}
case mango_selector:match_failures(Selector, Struct) of
[] ->
true;
Failures ->
{[
{<<"forbidden">>, <<"forbidden">>},
{<<"failures">>, Failures}
]}
end,
{reply, Reply, St}
end;
Expand Down
Loading