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 302171777E for ; Fri, 20 Mar 2015 18:15:29 +0000 (UTC) Received: (qmail 68294 invoked by uid 500); 20 Mar 2015 18:15:29 -0000 Delivered-To: apmail-couchdb-commits-archive@couchdb.apache.org Received: (qmail 68248 invoked by uid 500); 20 Mar 2015 18:15:29 -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 68239 invoked by uid 99); 20 Mar 2015 18:15:29 -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; Fri, 20 Mar 2015 18:15:29 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id B1140E1102; Fri, 20 Mar 2015 18:15:28 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: kxepal@apache.org To: commits@couchdb.apache.org Message-Id: <98e6109731dc416d82e78ab16ccef93e@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: couchdb-cassim git commit: Add prefix for security metadata documents Date: Fri, 20 Mar 2015 18:15:28 +0000 (UTC) Repository: couchdb-cassim Updated Branches: refs/heads/master 0450d81ba -> 4c3179365 Add prefix for security metadata documents Because such documents starts with database name, metadata documents for system databases violates CouchDB restriction for document id which cannot starts with underscore unless they are not _design/ ones. COUCHDB-2422 Project: http://git-wip-us.apache.org/repos/asf/couchdb-cassim/repo Commit: http://git-wip-us.apache.org/repos/asf/couchdb-cassim/commit/4c317936 Tree: http://git-wip-us.apache.org/repos/asf/couchdb-cassim/tree/4c317936 Diff: http://git-wip-us.apache.org/repos/asf/couchdb-cassim/diff/4c317936 Branch: refs/heads/master Commit: 4c3179365e8d2bb65cd45049706d652374a548ba Parents: 0450d81 Author: Alexander Shorin Authored: Wed Mar 18 20:08:07 2015 +0300 Committer: Alexander Shorin Committed: Wed Mar 18 20:08:07 2015 +0300 ---------------------------------------------------------------------- src/cassim_metadata_cache.erl | 2 +- test/cassim_metadata_cache_test.erl | 24 ++++++++++++++++++++++++ 2 files changed, 25 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/couchdb-cassim/blob/4c317936/src/cassim_metadata_cache.erl ---------------------------------------------------------------------- diff --git a/src/cassim_metadata_cache.erl b/src/cassim_metadata_cache.erl index 85113e2..1e43dce 100644 --- a/src/cassim_metadata_cache.erl +++ b/src/cassim_metadata_cache.erl @@ -70,7 +70,7 @@ metadata_db_exists() -> security_meta_id(DbName) -> Suffix = list_to_binary(mem3:shard_suffix(DbName)), - <>. + <<"db/", DbName/binary, "/_security", Suffix/binary>>. start_link() -> http://git-wip-us.apache.org/repos/asf/couchdb-cassim/blob/4c317936/test/cassim_metadata_cache_test.erl ---------------------------------------------------------------------- diff --git a/test/cassim_metadata_cache_test.erl b/test/cassim_metadata_cache_test.erl new file mode 100644 index 0000000..20cb65f --- /dev/null +++ b/test/cassim_metadata_cache_test.erl @@ -0,0 +1,24 @@ +% Licensed under the Apache License, Version 2.0 (the "License"); you may not +% use this file except in compliance with the License. You may obtain a copy of +% the License at +% +% http://www.apache.org/licenses/LICENSE-2.0 +% +% Unless required by applicable law or agreed to in writing, software +% distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +% WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +% License for the specific language governing permissions and limitations under +% the License. + +-module(cassim_metadata_cache_test). + +-include_lib("eunit/include/eunit.hrl"). + +security_meta_id_test() -> + meck:new(mem3), + meck:expect(mem3, shard_suffix, fun(_) -> ".shard_suffix" end), + ?assertEqual( + <<"db/_metadata/_security.shard_suffix">>, + cassim_metadata_cache:security_meta_id(<<"_metadata">>) + ), + meck:unload(mem3).