couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mikewall...@apache.org
Subject [2/5] chttpd commit: updated refs/heads/2452-users-db-security-on-clustered-interface to 25ec565
Date Fri, 14 Nov 2014 19:35:04 GMT
Export function for updating auth docs

The process of writing documents to the authentication DB varies
depending whether the authentication DB is on the admin or the
clustered interface. Authentication handlers should therefore
abstract the details away and provide a generic update_doc
function.

This commit adds an update_auth_doc function to the chttpd auth
cache which proxies to fabric:update_doc/3.

COUCHDB-2452 2/5


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

Branch: refs/heads/2452-users-db-security-on-clustered-interface
Commit: ce83780490b4fefaa0df5df2ed7447cc6331befd
Parents: 748f535
Author: Mike Wallace <mikewallace@apache.org>
Authored: Mon Nov 10 23:19:37 2014 +0000
Committer: Mike Wallace <mikewallace@apache.org>
Committed: Wed Nov 12 16:00:47 2014 +0000

----------------------------------------------------------------------
 src/chttpd_auth_cache.erl | 5 +++++
 1 file changed, 5 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb-chttpd/blob/ce837804/src/chttpd_auth_cache.erl
----------------------------------------------------------------------
diff --git a/src/chttpd_auth_cache.erl b/src/chttpd_auth_cache.erl
index a78ab9e..afe522a 100644
--- a/src/chttpd_auth_cache.erl
+++ b/src/chttpd_auth_cache.erl
@@ -17,6 +17,7 @@
 -export([init/1, handle_call/3, handle_cast/2, handle_info/2, terminate/2,
 	 code_change/3]).
 -export([listen_for_changes/1, changes_callback/2]).
+-export([update_auth_doc/1]).
 
 -include_lib("couch/include/couch_db.hrl").
 
@@ -33,6 +34,10 @@
 start_link() ->
     gen_server:start_link({local, ?MODULE}, ?MODULE, [], []).
 
+update_auth_doc(Doc) ->
+    DbName = ?l2b(config:get("chttpd_auth", "authentication_db", "_users")),
+    fabric:update_doc(DbName, Doc, []).
+
 get_user_creds(UserName) when is_list(UserName) ->
     get_user_creds(?l2b(UserName));
 get_user_creds(UserName) when is_binary(UserName) ->


Mime
View raw message