Skip to content

Instantly share code, notes, and snippets.

@janl
Created February 21, 2012 19:40
Show Gist options
  • Save janl/1878403 to your computer and use it in GitHub Desktop.
Save janl/1878403 to your computer and use it in GitHub Desktop.
diff --git a/src/couchdb/couch_httpd_db.erl b/src/couchdb/couch_httpd_db.erl
index bba9b7c..f5ed6a4 100644
--- a/src/couchdb/couch_httpd_db.erl
+++ b/src/couchdb/couch_httpd_db.erl
@@ -64,7 +64,17 @@ handle_changes_req(#httpd{path_parts=[_,<<"_changes">>]}=Req, _Db) ->
send_method_not_allowed(Req, "GET,HEAD,POST").
handle_changes_req1(Req, Db) ->
- ok = couch_db:check_is_admin(Db),
+ AuthDbName = ?l2b(couch_config:get("couch_httpd_auth", "authentication_db")),
+ case AuthDbName of
+ Db ->
+ % in the authentication database, _changes is admin-only.
+ ok = couch_db:check_is_admin(Db),
+ handle_changes_req2(Req, Db);
+ _Else ->
+ handle_changes_req2(Req, Db)
+ end.
+
+handle_changes_req2(Req, Db) ->
MakeCallback = fun(Resp) ->
fun({change, Change, _}, "continuous") ->
send_chunk(Resp, [?JSON_ENCODE(Change) | "\n"]);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment