Author: fdmanana Date: Fri May 20 10:57:28 2011 New Revision: 1125321 URL: http://svn.apache.org/viewvc?rev=1125321&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. This is a backport of revision 1125319 (trunk). Modified: couchdb/branches/1.1.x/share/www/script/test/replicator_db.js couchdb/branches/1.1.x/src/couchdb/couch_js_functions.hrl Modified: couchdb/branches/1.1.x/share/www/script/test/replicator_db.js URL: http://svn.apache.org/viewvc/couchdb/branches/1.1.x/share/www/script/test/replicator_db.js?rev=1125321&r1=1125320&r2=1125321&view=diff ============================================================================== --- couchdb/branches/1.1.x/share/www/script/test/replicator_db.js (original) +++ couchdb/branches/1.1.x/share/www/script/test/replicator_db.js Fri May 20 10:57:28 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/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=1125321&r1=1125320&r2=1125321&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 Fri May 20 10:57:28 2011 @@ -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) {