couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rnew...@apache.org
Subject [2/2] git commit: COUCHDB-1060 - Prevent _admin appearing twice
Date Fri, 06 Apr 2012 19:26:09 GMT
COUCHDB-1060 - Prevent _admin appearing twice


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

Branch: refs/heads/master
Commit: bdc0385aba7a0b88046c84d30608fccb420ebd36
Parents: 6a5f324
Author: Robert Newson <rnewson@apache.org>
Authored: Fri Apr 6 09:53:18 2012 -0400
Committer: Robert Newson <rnewson@apache.org>
Committed: Fri Apr 6 12:24:44 2012 -0400

----------------------------------------------------------------------
 src/couchdb/couch_auth_cache.erl |   12 ++++++------
 1 files changed, 6 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb/blob/bdc0385a/src/couchdb/couch_auth_cache.erl
----------------------------------------------------------------------
diff --git a/src/couchdb/couch_auth_cache.erl b/src/couchdb/couch_auth_cache.erl
index 9fb778a..f90a5be 100644
--- a/src/couchdb/couch_auth_cache.erl
+++ b/src/couchdb/couch_auth_cache.erl
@@ -49,7 +49,7 @@ get_user_creds(UserName) ->
         [HashedPwd, Salt] = string:tokens(HashedPwdAndSalt, ","),
         case get_from_cache(UserName) of
         nil ->
-            make_admin_doc(HashedPwd, Salt, [<<"_admin">>]);
+            make_admin_doc(HashedPwd, Salt, []);
         UserProps when is_list(UserProps) ->
             make_admin_doc(HashedPwd, Salt, couch_util:get_value(<<"roles">>,
UserProps))
         end;
@@ -57,7 +57,7 @@ get_user_creds(UserName) ->
         [HashedPwd, Salt, Iterations] = string:tokens(HashedPwdSaltAndIterations, ","),
         case get_from_cache(UserName) of
         nil ->
-            make_admin_doc(HashedPwd, Salt, Iterations, [<<"_admin">>]);
+            make_admin_doc(HashedPwd, Salt, Iterations, []);
         UserProps when is_list(UserProps) ->
             make_admin_doc(HashedPwd, Salt, Iterations, couch_util:get_value(<<"roles">>,
UserProps))
     end;
@@ -66,14 +66,14 @@ get_user_creds(UserName) ->
     end,
     validate_user_creds(UserCreds).
 
-make_admin_doc(HashedPwd, Salt, Roles) ->
-    [{<<"roles">>, Roles},
+make_admin_doc(HashedPwd, Salt, ExtraRoles) ->
+    [{<<"roles">>, [<<"_admin">>|ExtraRoles]},
      {<<"salt">>, ?l2b(Salt)},
      {<<"password_scheme">>, <<"simple">>},
      {<<"password_sha">>, ?l2b(HashedPwd)}].
 
-make_admin_doc(DerivedKey, Salt, Iterations, Roles) ->
-    [{<<"roles">>, [<<"_admin">>|Roles]},
+make_admin_doc(DerivedKey, Salt, Iterations, ExtraRoles) ->
+    [{<<"roles">>, [<<"_admin">>|ExtraRoles]},
      {<<"salt">>, ?l2b(Salt)},
      {<<"iterations">>, list_to_integer(Iterations)},
      {<<"password_scheme">>, <<"pbkdf2">>},


Mime
View raw message