Skip to content
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

Allow db multi-use by only validating user type docs. #13

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# pouchdb-users

> PouchDB plugin to simulate CouchDB’s \_users database behavior
> PouchDB plugin to simulate CouchDB’s \_users database behavior.

This forked version allows _users behavior to be added to any db while still retaining the ability to add other doc types as well. Only 'user' doc types are validated for _user db behavior.

[![Build Status](https://travis-ci.org/hoodiehq/pouchdb-users.svg?branch=master)](https://travis-ci.org/hoodiehq/pouchdb-users)
[![Coverage Status](https://coveralls.io/repos/hoodiehq/pouchdb-users/badge.svg?branch=master)](https://coveralls.io/r/hoodiehq/pouchdb-users?branch=master)
Expand Down
10 changes: 1 addition & 9 deletions lib/validate-doc-update.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,8 @@ module.exports = function (newDoc, oldDoc, userCtx, secObj) {
throw error
}

if (newDoc._id.substr(0, 8) === '_design/') {
return
}

if (newDoc._id.substr(0, 7) === '_local/') {
return
}

if ((oldDoc && oldDoc.type !== 'user') || newDoc.type !== 'user') {
throwError('doc.type must be user')
return
}

if (!newDoc.name) {
Expand Down
9 changes: 5 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"name": "pouchdb-users",
"name": "@inator/pouchdb-users",
"version": "1.0.8",
"description": "PouchDB plugin to simulate CouchDB’s _users database behavior",
"main": "index.js",
"scripts": {
Expand All @@ -14,7 +15,7 @@
},
"repository": {
"type": "git",
"url": "https://github.com/hoodiehq/pouchdb-users.git"
"url": "https://github.com/inator/pouchdb-users"
},
"keywords": [
"couchdb",
Expand All @@ -26,9 +27,9 @@
"author": "The Hoodie Community",
"license": "Apache-2.0",
"bugs": {
"url": "https://github.com/hoodiehq/pouchdb-users/issues"
"url": "https://github.com/inator/pouchdb-users/issues"
},
"homepage": "https://github.com/hoodiehq/pouchdb-users#readme",
"homepage": "https://github.com/inator/pouchdb-users#readme",
"dependencies": {
"lie": "^3.1.1",
"pouchdb-bulkdocs-wrapper": "^1.0.2",
Expand Down