You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@couchdb.apache.org by kl...@apache.org on 2015/08/10 21:46:38 UTC

[12/15] couchdb-peruser git commit: Assert that shards have the same security object

Assert that shards have the same security object


Project: http://git-wip-us.apache.org/repos/asf/couchdb-peruser/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb-peruser/commit/ac8094fa
Tree: http://git-wip-us.apache.org/repos/asf/couchdb-peruser/tree/ac8094fa
Diff: http://git-wip-us.apache.org/repos/asf/couchdb-peruser/diff/ac8094fa

Branch: refs/heads/master
Commit: ac8094fa098a25726801f05480c172dc4c03188a
Parents: 5960518
Author: Klaus Trainer <kl...@posteo.de>
Authored: Mon Aug 10 18:01:50 2015 +0200
Committer: Klaus Trainer <kl...@posteo.de>
Committed: Mon Aug 10 18:04:04 2015 +0200

----------------------------------------------------------------------
 src/couchdb_peruser.erl | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb-peruser/blob/ac8094fa/src/couchdb_peruser.erl
----------------------------------------------------------------------
diff --git a/src/couchdb_peruser.erl b/src/couchdb_peruser.erl
index 2abb56c..370be31 100644
--- a/src/couchdb_peruser.erl
+++ b/src/couchdb_peruser.erl
@@ -125,11 +125,11 @@ add_user(User, Prop, {Modified, SecProps}) ->
 
 ensure_security(User, UserDb) ->
     {ok, Shards} = fabric_db_meta:get_all_security(UserDb, [admin_ctx()]),
-    % We assume that all shards have the same security object, and
-    % therefore just pick the first one.
     {_ShardInfo, {SecProps}} = hd(Shards),
+    % assert that shards have the same security object
+    true = lists:all(fun(Shard) -> {_, {SecProps}} =:= Shard end, Shards),
     case lists:foldl(
-           fun (Prop, SAcc) -> add_user(User, Prop, SAcc) end,
+           fun(Prop, SAcc) -> add_user(User, Prop, SAcc) end,
            {false, SecProps},
            [<<"admins">>, <<"members">>]) of
         {false, _} ->