couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From fdman...@apache.org
Subject svn commit: r1095650 - /couchdb/branches/1.1.x/src/couchdb/couch_js_functions.hrl
Date Thu, 21 Apr 2011 10:48:51 GMT
Author: fdmanana
Date: Thu Apr 21 10:48:50 2011
New Revision: 1095650

URL: http://svn.apache.org/viewvc?rev=1095650&view=rev
Log:
Merged revision 1095649 from trunk

    By default, allow only admins to trigger delegated replications


Modified:
    couchdb/branches/1.1.x/src/couchdb/couch_js_functions.hrl

Modified: couchdb/branches/1.1.x/src/couchdb/couch_js_functions.hrl
URL: http://svn.apache.org/viewvc/couchdb/branches/1.1.x/src/couchdb/couch_js_functions.hrl?rev=1095650&r1=1095649&r2=1095650&view=diff
==============================================================================
--- couchdb/branches/1.1.x/src/couchdb/couch_js_functions.hrl (original)
+++ couchdb/branches/1.1.x/src/couchdb/couch_js_functions.hrl Thu Apr 21 10:48:50 2011
@@ -138,6 +138,8 @@
         }
 
         var isReplicator = (userCtx.roles.indexOf('_replicator') >= 0);
+        var isAdmin = (userCtx.roles.indexOf('_admin') >= 0);
+
         if (oldDoc && !newDoc._deleted && !isReplicator) {
             reportError('Only the replicator can edit replication documents.');
         }
@@ -178,6 +180,12 @@
             }
 
             if (newDoc.user_ctx) {
+                if (!isAdmin) {
+                    reportError('Delegated replications (use of the ' +
+                        '`user_ctx\\' property) can only be triggered by ' +
+                        'administrators.');
+                }
+
                 var user_ctx = newDoc.user_ctx;
 
                 if ((typeof user_ctx !== 'object') || (user_ctx === null)) {



Mime
View raw message