You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by ja...@apache.org on 2022/08/06 13:44:02 UTC

[couchdb] 07/07: chore(access): style notes

This is an automated email from the ASF dual-hosted git repository.

jan pushed a commit to branch feat/access-2022
in repository https://gitbox.apache.org/repos/asf/couchdb.git

commit 1d12525ac4534bf6974e4aa8681d4174502e2759
Author: Jan Lehnardt <ja...@apache.org>
AuthorDate: Sat Aug 6 15:39:05 2022 +0200

    chore(access): style notes
---
 src/couch/src/couch_db_updater.erl | 2 +-
 src/couch/src/couch_httpd_auth.erl | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/couch/src/couch_db_updater.erl b/src/couch/src/couch_db_updater.erl
index 59de1fb0f..d491c0bbb 100644
--- a/src/couch/src/couch_db_updater.erl
+++ b/src/couch/src/couch_db_updater.erl
@@ -825,7 +825,7 @@ validate_docs_access(Db, UserCtx, [Docs | DocRest], [OldInfo | OldInfoRest], Doc
             true -> % if valid, then send to DocsListValidated, OldDocsInfo
                     % and store the access context on the new doc
                 [{Client, Doc} | Acc];
-            _Else2 -> % if invalid, then send_result tagged `access`(c.f. `conflict)
+            false -> % if invalid, then send_result tagged `access`(c.f. `conflict)
                       % and don’t add to DLV, nor ODI
                 send_result(Client, Doc, access),
                 Acc
diff --git a/src/couch/src/couch_httpd_auth.erl b/src/couch/src/couch_httpd_auth.erl
index eb3a1936f..25d6a8518 100644
--- a/src/couch/src/couch_httpd_auth.erl
+++ b/src/couch/src/couch_httpd_auth.erl
@@ -103,7 +103,7 @@ extract_roles(UserProps) ->
     Roles = couch_util:get_value(<<"roles">>, UserProps, []),
     case lists:member(<<"_admin">>, Roles) of
         true -> Roles;
-        _ -> Roles ++ [<<"_users">>]
+        _ -> [<<"_users">> | Roles]
     end.
 
 default_authentication_handler(Req) ->
@@ -196,7 +196,7 @@ proxy_auth_user(Req) ->
             Roles =
                 case header_value(Req, XHeaderRoles) of
                     undefined -> [];
-                    Else -> [?l2b(R) || R <- string:tokens(Else, ",")] ++ [<<"_users">>]
+                    Else -> [?l2b(R) || R <- [<<"_users">> | string:tokens(Else, ",")]]
                 end,
             case
                 chttpd_util:get_chttpd_auth_config_boolean(