couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From j..@apache.org
Subject [1/2] chttpd commit: updated refs/heads/master to f3d5d1b
Date Mon, 16 May 2016 15:58:57 GMT
Repository: couchdb-chttpd
Updated Branches:
  refs/heads/master 34f0a81df -> f3d5d1b0c


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/master
Commit: 8dab8f87bff872d60bda5541cf926d7ca04ac205
Parents: 34f0a81
Author: Jan Lehnardt <jan@apache.org>
Authored: Mon May 16 14:13:46 2016 +0200
Committer: Jan Lehnardt <jan@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.


Mime
View raw message