summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Newson <rnewson@apache.org>2012-09-28 18:17:46 +0100
committerRobert Newson <rnewson@apache.org>2012-09-28 18:19:18 +0100
commitac320479035ac7a844686f2efb5b314baa33e14c (patch)
tree599d1f13c9b0d1fb018e371e5ec0ca312851806b
parent03598c2f4ac0854cf2d703aecb00748d50ec7d03 (diff)
downloadcouchdb-ac320479035ac7a844686f2efb5b314baa33e14c.tar.gz
COUCHDB-1537 Include user_ctx.name in show/list ETag
-rw-r--r--CHANGES1
-rw-r--r--NEWS1
-rw-r--r--src/couch_mrview/src/couch_mrview_show.erl5
3 files changed, 5 insertions, 2 deletions
diff --git a/CHANGES b/CHANGES
index 94f2c175d..f2b5ca91d 100644
--- a/CHANGES
+++ b/CHANGES
@@ -20,6 +20,7 @@ HTTP Interface:
* Added Server-Sent Events protocol to db changes API.
See http://www.w3.org/TR/eventsource/ for details.
* Make password hashing synchronous when using the /_config/admins API.
+ * Include user name in show/list ETags.
Storage System:
diff --git a/NEWS b/NEWS
index 08088a72b..2abf0d538 100644
--- a/NEWS
+++ b/NEWS
@@ -24,6 +24,7 @@ This version has not been released yet.
* Make password hashing synchronous when using the /_config/admins API.
* Added utc_id UUID algorithm.
* encode database name during URL rewriting.
+ * Include user name in show/list ETags.
Version 1.2.1
-------------
diff --git a/src/couch_mrview/src/couch_mrview_show.erl b/src/couch_mrview/src/couch_mrview_show.erl
index 426b431f8..3bfa035f7 100644
--- a/src/couch_mrview/src/couch_mrview_show.erl
+++ b/src/couch_mrview/src/couch_mrview_show.erl
@@ -99,7 +99,7 @@ show_etag(#httpd{user_ctx=UserCtx}=Req, Doc, DDoc, More) ->
Doc -> couch_httpd:doc_etag(Doc)
end,
couch_httpd:make_etag({couch_httpd:doc_etag(DDoc), DocPart, Accept,
- UserCtx#user_ctx.roles, More}).
+ {UserCtx#user_ctx.name, UserCtx#user_ctx.roles}, More}).
% updates a doc based on a request
% handle_doc_update_req(#httpd{method = 'GET'}=Req, _Db, _DDoc) ->
@@ -191,9 +191,10 @@ handle_view_list(Req, Db, DDoc, LName, VDDoc, VName, Keys) ->
Args0 = couch_mrview_http:parse_qs(Req, Keys),
ETagFun = fun(BaseSig, Acc0) ->
UserCtx = Req#httpd.user_ctx,
+ Name = UserCtx#user_ctx.name,
Roles = UserCtx#user_ctx.roles,
Accept = couch_httpd:header_value(Req, "Accept"),
- Parts = {couch_httpd:doc_etag(DDoc), Accept, Roles},
+ Parts = {couch_httpd:doc_etag(DDoc), Accept, {Name, Roles}},
ETag = couch_httpd:make_etag({BaseSig, Parts}),
case couch_httpd:etag_match(Req, ETag) of
true -> throw({etag_match, ETag});