couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rnew...@apache.org
Subject couchdb-global-changes git commit: Open global changes db with admin context
Date Fri, 23 Jan 2015 16:34:49 GMT
Repository: couchdb-global-changes
Updated Branches:
  refs/heads/43665-open-db-with-admin-ctx [created] 60831fef4


Open global changes db with admin context

The global changes feed should work even if the security object says otherwise.

BugzID: 43665


Project: http://git-wip-us.apache.org/repos/asf/couchdb-global-changes/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb-global-changes/commit/60831fef
Tree: http://git-wip-us.apache.org/repos/asf/couchdb-global-changes/tree/60831fef
Diff: http://git-wip-us.apache.org/repos/asf/couchdb-global-changes/diff/60831fef

Branch: refs/heads/43665-open-db-with-admin-ctx
Commit: 60831fef4a92fe6b95e0d4a42690f1f603867cc1
Parents: 3400679
Author: Robert Newson <rnewson@apache.org>
Authored: Fri Jan 23 16:33:33 2015 +0000
Committer: Robert Newson <rnewson@apache.org>
Committed: Fri Jan 23 16:33:33 2015 +0000

----------------------------------------------------------------------
 src/global_changes_server.erl | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb-global-changes/blob/60831fef/src/global_changes_server.erl
----------------------------------------------------------------------
diff --git a/src/global_changes_server.erl b/src/global_changes_server.erl
index 812d6da..b69b17a 100644
--- a/src/global_changes_server.erl
+++ b/src/global_changes_server.erl
@@ -36,6 +36,7 @@
 -include_lib("couch/include/couch_db.hrl").
 -include_lib("mem3/include/mem3.hrl").
 
+-define(ADMIN_CTX, {user_ctx, #user_ctx{roles = [<<"_admin">>]}}).
 
 -record(state, {
     update_db,
@@ -151,7 +152,7 @@ flush_updates(State) ->
     try group_ids_by_shard(State#state.dbname, DocIds) of
     GroupedIds ->
         Docs = dict:fold(fun(ShardName, Ids, DocInfoAcc) ->
-            {ok, Shard} = couch_db:open(ShardName, []),
+            {ok, Shard} = couch_db:open(ShardName, [?ADMIN_CTX]),
             try
                 GroupedDocs = get_docs_locally(Shard, Ids),
                 GroupedDocs ++ DocInfoAcc


Mime
View raw message