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_doc function to the chttpd auth cache which proxies to fabric:update_doc/3. COUCHDB-2452 2/? Project: http://git-wip-us.apache.org/repos/asf/couchdb-chttpd/repo Commit: http://git-wip-us.apache.org/repos/asf/couchdb-chttpd/commit/a7080c28 Tree: http://git-wip-us.apache.org/repos/asf/couchdb-chttpd/tree/a7080c28 Diff: http://git-wip-us.apache.org/repos/asf/couchdb-chttpd/diff/a7080c28 Branch: refs/heads/2452-users-db-security-on-clustered-interface Commit: a7080c28c51d281db7d93fe129af15ac53cf599a Parents: 1193c3c Author: Mike Wallace <[email protected]> Authored: Mon Nov 10 23:19:37 2014 +0000 Committer: Mike Wallace <[email protected]> Committed: Mon Nov 10 23:25:00 2014 +0000 ---------------------------------------------------------------------- src/chttpd_auth_cache.erl | 4 ++++ 1 file changed, 4 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/couchdb-chttpd/blob/a7080c28/src/chttpd_auth_cache.erl ---------------------------------------------------------------------- diff --git a/src/chttpd_auth_cache.erl b/src/chttpd_auth_cache.erl index a78ab9e..de91453 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_doc/2]). -include_lib("couch/include/couch_db.hrl"). @@ -33,6 +34,9 @@ start_link() -> gen_server:start_link({local, ?MODULE}, ?MODULE, [], []). +update_doc(DbName, Doc) -> + 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) ->
