Guest User

Untitled

a guest
Jan 21st, 2018
284
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.03 KB | None | 0 0
  1. commit 08b26333c44f9a86a8d9b87f4a1e6d51e9ac624c
  2. Author: Jason Smith <jhs@iriscouch.com>
  3. Date: Wed May 18 08:08:36 2011 +0700
  4.  
  5. A configuration option httpd.cors_admin to allow _admin over CORS
  6.  
  7. diff --git a/src/couchdb/couch_httpd.erl b/src/couchdb/couch_httpd.erl
  8. index db6809b..3193855 100644
  9. --- a/src/couchdb/couch_httpd.erl
  10. +++ b/src/couchdb/couch_httpd.erl
  11. @@ -528,7 +528,14 @@ verify_is_server_admin(#httpd{user_ctx=UserCtx}=Req) ->
  12. % Normal verification for non-CORS request.
  13. verify_is_server_admin(UserCtx);
  14. _ ->
  15. - throw({unauthorized, <<"Cross-origin admin is not allowed.">>})
  16. + case couch_config:get("httpd", "cors_admin", "false") of
  17. + "true" ->
  18. + % Allow admin over CORS.
  19. + verify_is_server_admin(UserCtx);
  20. + _False ->
  21. + throw({unauthorized,
  22. + <<"Cross-origin admin is not allowed.">>})
  23. + end
  24. end;
  25.  
  26. verify_is_server_admin(#user_ctx{roles=Roles}) ->
Add Comment
Please, Sign In to add comment