You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by ja...@apache.org on 2016/05/16 12:14:47 UTC

chttpd commit: updated refs/heads/fix-conflicted-user-docs to 8dab8f8 [Forced Update!]

Repository: couchdb-chttpd
Updated Branches:
  refs/heads/fix-conflicted-user-docs dc0fa0a13 -> 8dab8f87b (forced update)


fix in logic that denies login with conflicted user docs


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

Branch: refs/heads/fix-conflicted-user-docs
Commit: 8dab8f87bff872d60bda5541cf926d7ca04ac205
Parents: 34f0a81
Author: Jan Lehnardt <ja...@apache.org>
Authored: Mon May 16 14:13:46 2016 +0200
Committer: Jan Lehnardt <ja...@apache.org>
Committed: Mon May 16 14:14:42 2016 +0200

----------------------------------------------------------------------
 src/chttpd_auth_cache.erl | 25 +++++++++----------------
 1 file changed, 9 insertions(+), 16 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb-chttpd/blob/8dab8f87/src/chttpd_auth_cache.erl
----------------------------------------------------------------------
diff --git a/src/chttpd_auth_cache.erl b/src/chttpd_auth_cache.erl
index 3f07adb..6e14263 100644
--- a/src/chttpd_auth_cache.erl
+++ b/src/chttpd_auth_cache.erl
@@ -212,25 +212,18 @@ update_doc_ignoring_conflict(DbName, Doc, Options) ->
 
 maybe_validate_user_creds(nil) ->
     nil;
-maybe_validate_user_creds(UserCreds) ->
-    AllowConflictedUserDocs = config:get_boolean("chttpd_auth", "allow_conflicted_user_docs", false),
-    maybe_validate_user_creds(UserCreds, AllowConflictedUserDocs).
-
-maybe_validate_user_creds(UserCreds, false) ->
-    {ok, UserCreds, nil};
-maybe_validate_user_creds(UserCreds, true) ->
-    validate_user_creds(UserCreds).
-
 % throws if UserCreds includes a _conflicts member
 % returns UserCreds otherwise
-validate_user_creds(UserCreds) ->
-    case couch_util:get_value(<<"_conflicts">>, UserCreds) of
-        undefined ->
-            ok;
-        _ConflictList ->
+maybe_validate_user_creds(UserCreds) ->
+    AllowConflictedUserDocs = config:get_boolean("chttpd_auth", "allow_conflicted_user_docs", false),
+    case {couch_util:get_value(<<"_conflicts">>, UserCreds), AllowConflictedUserDocs} of
+        {undefined, _} ->
+            {ok, UserCreds, nil};
+        {_, true} ->
+            {ok, UserCreds, nil};
+        {_ConflictList, false} ->
             throw({unauthorized,
                 <<"User document conflicts must be resolved before the document",
                   " is used for authentication purposes.">>
             })
-    end,
-    {ok, UserCreds, nil}.
+    end.