Return-Path: X-Original-To: apmail-couchdb-commits-archive@www.apache.org Delivered-To: apmail-couchdb-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id C54C61801F for ; Wed, 15 Jul 2015 10:19:31 +0000 (UTC) Received: (qmail 33336 invoked by uid 500); 15 Jul 2015 10:19:31 -0000 Delivered-To: apmail-couchdb-commits-archive@couchdb.apache.org Received: (qmail 33287 invoked by uid 500); 15 Jul 2015 10:19:31 -0000 Mailing-List: contact commits-help@couchdb.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@couchdb.apache.org Delivered-To: mailing list commits@couchdb.apache.org Received: (qmail 33278 invoked by uid 99); 15 Jul 2015 10:19:31 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 15 Jul 2015 10:19:31 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 7C43CE0F7B; Wed, 15 Jul 2015 10:19:31 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: mikewallace@apache.org To: commits@couchdb.apache.org Message-Id: <1865bc0f0dae44f482c29d08d6132fbe@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: couch-index commit: updated refs/heads/master to cc7850c Date: Wed, 15 Jul 2015 10:19:31 +0000 (UTC) Repository: couchdb-couch-index Updated Branches: refs/heads/master 13fed1ed2 -> cc7850c6d Allow couch_index to open restricted design docs Design docs in the authentication DB cannot be opened without an admin context so this commit teaches couch_index to always use ?ADMIN_CTX when opening documents. COUCHDB-2738 This closes #6 Project: http://git-wip-us.apache.org/repos/asf/couchdb-couch-index/repo Commit: http://git-wip-us.apache.org/repos/asf/couchdb-couch-index/commit/cc7850c6 Tree: http://git-wip-us.apache.org/repos/asf/couchdb-couch-index/tree/cc7850c6 Diff: http://git-wip-us.apache.org/repos/asf/couchdb-couch-index/diff/cc7850c6 Branch: refs/heads/master Commit: cc7850c6d15125fd8e1c7e4969e4bf76a140c6b0 Parents: 13fed1e Author: Mike Wallace Authored: Tue Jun 30 21:52:58 2015 +0100 Committer: Mike Wallace Committed: Wed Jul 15 11:14:52 2015 +0100 ---------------------------------------------------------------------- src/couch_index.erl | 2 +- src/couch_index_server.erl | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/couchdb-couch-index/blob/cc7850c6/src/couch_index.erl ---------------------------------------------------------------------- diff --git a/src/couch_index.erl b/src/couch_index.erl index a554c0e..fa08dd1 100644 --- a/src/couch_index.erl +++ b/src/couch_index.erl @@ -283,7 +283,7 @@ handle_cast(ddoc_updated, State) -> DbName = Mod:get(db_name, IdxState), DDocId = Mod:get(idx_name, IdxState), Shutdown = couch_util:with_db(DbName, fun(Db) -> - case couch_db:open_doc(Db, DDocId, [ejson_body]) of + case couch_db:open_doc(Db, DDocId, [ejson_body, ?ADMIN_CTX]) of {not_found, deleted} -> true; {ok, DDoc} -> http://git-wip-us.apache.org/repos/asf/couchdb-couch-index/blob/cc7850c6/src/couch_index_server.erl ---------------------------------------------------------------------- diff --git a/src/couch_index_server.erl b/src/couch_index_server.erl index 4b60a39..42a122b 100644 --- a/src/couch_index_server.erl +++ b/src/couch_index_server.erl @@ -73,7 +73,7 @@ get_index(Module, #db{name = <<"shards/", _/binary>> = DbName}, DDoc) -> end; get_index(Module, <<"shards/", _/binary>> = DbName, DDoc) -> {Pid, Ref} = spawn_monitor(fun() -> - exit(fabric:open_doc(mem3:dbname(DbName), DDoc, [ejson_body])) + exit(fabric:open_doc(mem3:dbname(DbName), DDoc, [ejson_body, ?ADMIN_CTX])) end), receive {'DOWN', Ref, process, Pid, {ok, Doc}} -> get_index(Module, DbName, Doc, nil); @@ -93,7 +93,7 @@ get_index(Module, DbName, DDoc, Fun) when is_binary(DbName) -> get_index(Module, Db, DDoc, Fun) end); get_index(Module, Db, DDoc, Fun) when is_binary(DDoc) -> - case couch_db:open_doc(Db, DDoc, [ejson_body]) of + case couch_db:open_doc(Db, DDoc, [ejson_body, ?ADMIN_CTX]) of {ok, Doc} -> get_index(Module, Db, Doc, Fun); Error -> Error end;