eiri opened a new issue #653: User context not passed in `_show` for `_users` 
database
URL: https://github.com/apache/couchdb/issues/653
 
 
   ## Expected behavior
   
   View's `_show` supposed to work on admin-only databases, such as `_users` 
when accessed with admin privileges.
   
   ## Current behavior
   
   On attempt to access `_show` on `_users` database error 500 raised:
   ```
   {
       "error": "case_clause",
       "reason": "{forbidden,<<\"Only administrators can view design docs in 
the users database.\">>}",
       "ref": 1517023101
   }
   ```
   
   ## Possible Solution
   User context need to be passed to fabric's open_doc 
[here](https://github.com/apache/couchdb/blob/master/src/chttpd/src/chttpd_show.erl#L26)
   
   ## Steps to Reproduce
   In `_users` db create following two ddocs:
   ```
   {
       "_id": "_design/users",
       "views": {
           "names": {
               "map": "function(doc) { emit(doc.name); }"
           }
       },
       "lists": {
           "names": "function(head, req) { var row; while (row = getRow()) { 
send(\"name: \" + row.key + \"\\n\"); } }"
       }
   }
   
   {
       "_id": "_design/show-function-examples",
       "shows": {
           "summary": "function(doc, req) {return '<em>' + doc.name + '</em>';}"
       }
   }
   ```
   
   Run local cluster and query with `curl -u $CRED 
http://localhost:15984/_users/_design/show-function-examples/_show/summary/_design/users`
   
   ## Your Environment
   * Version used: 2.1.0-2f45a72cd
   * Browser Name and version: httpie 9.9.9
   * Operating System and version (desktop or mobile): Darwin Kernel Version 
15.6.0
   
 
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to