summaryrefslogtreecommitdiff
path: root/src/couchdb/couch_httpd_auth.erl
diff options
context:
space:
mode:
authorDamien F. Katz <damien@apache.org>2009-09-11 23:23:07 +0000
committerDamien F. Katz <damien@apache.org>2009-09-11 23:23:07 +0000
commit45796298231349dadf650e9ddefd7a6ff32e1302 (patch)
tree4de5543e9584a2c8a91f0b27b5b8f9e43de3fe46 /src/couchdb/couch_httpd_auth.erl
parent773a23353b9101620ebb91183cb67240c17aa2c9 (diff)
Refactoring of endkey code in views and btrees. End key functionaility is now handled inside the btree code, simplfying calling code and making it trivial to add new collation options
git-svn-id: https://svn.apache.org/repos/asf/couchdb/trunk@814078 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/couchdb/couch_httpd_auth.erl')
-rw-r--r--src/couchdb/couch_httpd_auth.erl13
1 files changed, 4 insertions, 9 deletions
diff --git a/src/couchdb/couch_httpd_auth.erl b/src/couchdb/couch_httpd_auth.erl
index 1c1ad0a9..6df1a393 100644
--- a/src/couchdb/couch_httpd_auth.erl
+++ b/src/couchdb/couch_httpd_auth.erl
@@ -114,7 +114,6 @@ get_user(Db, UserName) ->
% then fall back to querying the db.
case couch_config:get("admins", ?b2l(UserName)) of
"-hashed-" ++ HashedPwdAndSalt ->
- io:format("hashed: '~p'~n", [hashed]),
[HashedPwd, Salt] = string:tokens(HashedPwdAndSalt, ","),
[{<<"roles">>, [<<"_admin">>]},
{<<"salt">>, ?l2b(Salt)},
@@ -127,14 +126,10 @@ get_user(Db, UserName) ->
case (catch couch_view:get_map_view(Db, DesignId, ViewName, nil)) of
{ok, View, _Group} ->
- FoldlFun = fun
- ({{Key, _DocId}, Value}, _, nil) when Key == UserName -> {ok, Value};
- (_, _, Acc) -> {stop, Acc}
- end,
- case couch_view:fold(View, {UserName, nil}, fwd, FoldlFun, nil) of
- {ok, {Result}} -> Result;
- _Else -> nil
- end;
+ FoldFun = fun({_, Value}, _, {_}) -> {stop, Value} end,
+ {ok, _, {Result}} = couch_view:fold(View, FoldFun, {nil},
+ [{start_key, {UserName, nil}},{end_key, {UserName, {}}}]),
+ Result;
{not_found, _Reason} ->
nil
% case (catch couch_view:get_reduce_view(Db, DesignId, ViewName, nil)) of