From 5b8d4522255662ce2b8637680ed1a3db24c2bcef Mon Sep 17 00:00:00 2001 From: Filipe David Borba Manana Date: Fri, 20 May 2011 10:57:28 +0000 Subject: 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. This is a backport of revision 1125319 (trunk). git-svn-id: https://svn.apache.org/repos/asf/couchdb/branches/1.1.x@1125321 13f79535-47bb-0310-9956-ffa450edef68 --- share/www/script/test/replicator_db.js | 3 ++- src/couchdb/couch_js_functions.hrl | 6 ++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/share/www/script/test/replicator_db.js b/share/www/script/test/replicator_db.js index 2810352c..48e5d5c6 100644 --- a/share/www/script/test/replicator_db.js +++ b/share/www/script/test/replicator_db.js @@ -676,7 +676,8 @@ couchTests.replicator_db = function(debug) { var repDoc = { _id: "foo_rep_doc", source: dbA.name, - target: dbB.name + target: dbB.name, + continuous: true }; T(CouchDB.login("fdmanana", "qwerty").ok); diff --git a/src/couchdb/couch_js_functions.hrl b/src/couchdb/couch_js_functions.hrl index 0cc49d62..1e3ed4e9 100644 --- a/src/couchdb/couch_js_functions.hrl +++ b/src/couchdb/couch_js_functions.hrl @@ -140,8 +140,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) { -- cgit v1.2.3