Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Treat db admins as admins.

  • Loading branch information...
commit 2a03fd36d689f59ab4bd2ad084e694b3ba304d66 1 parent 310d9af
@mikeal mikeal authored isaacs committed
Showing with 8 additions and 2 deletions.
  1. +8 −2 registry/app.js
View
10 registry/app.js
@@ -1117,7 +1117,7 @@ ddoc.updates.package = function (doc, req) {
}
}
-ddoc.validate_doc_update = function (newDoc, oldDoc, user) {
+ddoc.validate_doc_update = function (newDoc, oldDoc, user, dbCtx) {
function ISODateString(d){
function pad(n){return n<10 ? '0'+n : n}
return d.getUTCFullYear()+'-'
@@ -1182,7 +1182,13 @@ ddoc.validate_doc_update = function (newDoc, oldDoc, user) {
}
return false
}
- function isAdmin () { return user.roles.indexOf("_admin") >= 0 }
+ function isAdmin () {
+ if (dbCtx.admins.names.indexOf(user.name) !== -1) return true
+ for (var i;i<user.roles.length;i++) {
+ if (dbCtx.admins.roles.indexOf(user.roles[i]) !== -1) return true
+ }
+ return user.roles.indexOf("_admin") >= 0
+ }
assert(validUser(), "user: " + user.name + " not authorized to modify "
+ newDoc.name )
Please sign in to comment.
Something went wrong with that request. Please try again.