couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kxe...@apache.org
Subject [1/2] chttpd commit: updated refs/heads/master to 417679a
Date Mon, 21 Dec 2015 21:38:56 GMT
Repository: couchdb-chttpd
Updated Branches:
  refs/heads/master d31b2a4d4 -> 417679a9c


Ask cassim for secObj value


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

Branch: refs/heads/master
Commit: 417679a9cf2277693253d3f9c2ac0e52fa1ba75c
Parents: 9f267e1
Author: Alexander Shorin <kxepal@apache.org>
Authored: Wed Nov 18 21:37:41 2015 +0300
Committer: Alexander Shorin <kxepal@apache.org>
Committed: Tue Dec 22 00:23:00 2015 +0300

----------------------------------------------------------------------
 src/chttpd_external.erl | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb-chttpd/blob/417679a9/src/chttpd_external.erl
----------------------------------------------------------------------
diff --git a/src/chttpd_external.erl b/src/chttpd_external.erl
index 3802c97..8521676 100644
--- a/src/chttpd_external.erl
+++ b/src/chttpd_external.erl
@@ -112,8 +112,8 @@ json_req_obj_field(<<"cookie">>, #httpd{mochi_req=Req}, _Db,
_DocId) ->
     to_json_terms(Req:parse_cookie());
 json_req_obj_field(<<"userCtx">>, #httpd{}, Db, _DocId) ->
     couch_util:json_user_ctx(Db);
-json_req_obj_field(<<"secObj">>, #httpd{}, Db, _DocId) ->
-    couch_db:get_security(Db).
+json_req_obj_field(<<"secObj">>, #httpd{user_ctx=UserCtx}, Db, _DocId) ->
+    get_db_security(Db, UserCtx).
 
 
 get_db_info(#db{main_pid = nil} = Db) ->
@@ -121,6 +121,13 @@ get_db_info(#db{main_pid = nil} = Db) ->
 get_db_info(#db{} = Db) ->
     couch_db:get_db_info(Db).
 
+
+get_db_security(#db{main_pid = nil}=Db, #user_ctx{}=UserCtx) ->
+    cassim:get_security(Db, [{user_ctx, UserCtx}]);
+get_db_security(#db{}=Db, #user_ctx{}) ->
+    couch_db:get_security(Db).
+
+
 to_json_terms(Data) ->
     to_json_terms(Data, []).
 to_json_terms([], Acc) ->


Mime
View raw message