New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

User context not passed in `_show` for `_users` database #653

Closed
eiri opened this Issue Jul 7, 2017 · 1 comment

Comments

Projects
None yet
2 participants
@eiri
Member

eiri commented Jul 7, 2017

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

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
@eiri

This comment has been minimized.

Show comment
Hide comment
@eiri

eiri Jul 7, 2017

Member

Reference issue apache/couchdb#645

Member

eiri commented Jul 7, 2017

Reference issue apache/couchdb#645

@nickva nickva self-assigned this Jul 7, 2017

@nickva nickva removed their assignment Aug 22, 2017

@eiri eiri referenced this issue Sep 4, 2017

Merged

Pass user context when opening a doc in show handler #788

2 of 3 tasks complete

@eiri eiri closed this in #788 Sep 5, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment