You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by fd...@apache.org on 2011/05/20 12:55:06 UTC

svn commit: r1125319 - in /couchdb/trunk: share/www/script/test/replicator_db.js src/couchdb/couch_js_functions.hrl

Author: fdmanana
Date: Fri May 20 10:55:06 2011
New Revision: 1125319

URL: http://svn.apache.org/viewvc?rev=1125319&view=rev
Log:
Replication manager: allow edition of replication documents

Replication documents that are not in the triggered state can now
be edited by users. This is to make it simpler for Futon users
to restart replications - they can just edit the document, remove
its state field, and save it, instead of recreating it or adding
a similar document but with a different _id.


Modified:
    couchdb/trunk/share/www/script/test/replicator_db.js
    couchdb/trunk/src/couchdb/couch_js_functions.hrl

Modified: couchdb/trunk/share/www/script/test/replicator_db.js
URL: http://svn.apache.org/viewvc/couchdb/trunk/share/www/script/test/replicator_db.js?rev=1125319&r1=1125318&r2=1125319&view=diff
==============================================================================
--- couchdb/trunk/share/www/script/test/replicator_db.js (original)
+++ couchdb/trunk/share/www/script/test/replicator_db.js Fri May 20 10:55:06 2011
@@ -676,7 +676,8 @@ couchTests.replicator_db = function(debu
       var repDoc = {
         _id: "foo_rep_doc",
         source: dbA.name,
-        target: dbB.name
+        target: dbB.name,
+        continuous: true
       };
 
       T(CouchDB.login("fdmanana", "qwerty").ok);

Modified: couchdb/trunk/src/couchdb/couch_js_functions.hrl
URL: http://svn.apache.org/viewvc/couchdb/trunk/src/couchdb/couch_js_functions.hrl?rev=1125319&r1=1125318&r2=1125319&view=diff
==============================================================================
--- couchdb/trunk/src/couchdb/couch_js_functions.hrl (original)
+++ couchdb/trunk/src/couchdb/couch_js_functions.hrl Fri May 20 10:55:06 2011
@@ -149,8 +149,10 @@
         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.');
+        if (oldDoc && !newDoc._deleted && !isReplicator &&
+            (oldDoc._replication_state === 'triggered')) {
+            reportError('Only the replicator can edit replication documents ' +
+                'that are in the triggered state.');
         }
 
         if (!newDoc._deleted) {