{"action":"created","comment":{"url":"https://api.github.com/repos/strongloop/loopback/pulls/comments/28302961","id":28302961,"diff_hunk":"@@ -703,6 +707,23 @@ module.exports = function(Change) {\n   };\n \n   /**\n+   * Return a new Conflict instance with swapped Source and Target models.\n+   *\n+   * This is useful for example when resolving a conflict in one-way","path":"common/models/change.js","position":null,"original_position":62,"commit_id":"cf2acb3cd23f9bcd8736a703093f6c7ca6b9aee3","original_commit_id":"fab03d1bd369100d954c4283a69c468fe1a1d9b6","user":{"login":"bajtos","id":1140553,"avatar_url":"https://avatars.githubusercontent.com/u/1140553?v=3","gravatar_id":"","url":"https://api.github.com/users/bajtos","html_url":"https://github.com/bajtos","followers_url":"https://api.github.com/users/bajtos/followers","following_url":"https://api.github.com/users/bajtos/following{/other_user}","gists_url":"https://api.github.com/users/bajtos/gists{/gist_id}","starred_url":"https://api.github.com/users/bajtos/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bajtos/subscriptions","organizations_url":"https://api.github.com/users/bajtos/orgs","repos_url":"https://api.github.com/users/bajtos/repos","events_url":"https://api.github.com/users/bajtos/events{/privacy}","received_events_url":"https://api.github.com/users/bajtos/received_events","type":"User","site_admin":false},"body":":+1: ","created_at":"2015-04-14T06:23:28Z","updated_at":"2015-04-14T06:23:28Z","html_url":"https://github.com/strongloop/loopback/pull/1294#discussion_r28302961","pull_request_url":"https://api.github.com/repos/strongloop/loopback/pulls/1294","_links":{"self":{"href":"https://api.github.com/repos/strongloop/loopback/pulls/comments/28302961"},"html":{"href":"https://github.com/strongloop/loopback/pull/1294#discussion_r28302961"},"pull_request":{"href":"https://api.github.com/repos/strongloop/loopback/pulls/1294"}}},"pull_request":{"url":"https://api.github.com/repos/strongloop/loopback/pulls/1294","id":32944916,"html_url":"https://github.com/strongloop/loopback/pull/1294","diff_url":"https://github.com/strongloop/loopback/pull/1294.diff","patch_url":"https://github.com/strongloop/loopback/pull/1294.patch","issue_url":"https://api.github.com/repos/strongloop/loopback/issues/1294","number":1294,"state":"open","locked":false,"title":"Conflict resolution and Access control","user":{"login":"bajtos","id":1140553,"avatar_url":"https://avatars.githubusercontent.com/u/1140553?v=3","gravatar_id":"","url":"https://api.github.com/users/bajtos","html_url":"https://github.com/bajtos","followers_url":"https://api.github.com/users/bajtos/followers","following_url":"https://api.github.com/users/bajtos/following{/other_user}","gists_url":"https://api.github.com/users/bajtos/gists{/gist_id}","starred_url":"https://api.github.com/users/bajtos/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bajtos/subscriptions","organizations_url":"https://api.github.com/users/bajtos/orgs","repos_url":"https://api.github.com/users/bajtos/repos","events_url":"https://api.github.com/users/bajtos/events{/privacy}","received_events_url":"https://api.github.com/users/bajtos/received_events","type":"User","site_admin":false},"body":"**Fix PersistedModel._defineChangeModel** (the first commit)\r\n\r\n - Correctly handle the case when the model is attached multiple times during the lifecycle, this happens because `loopback.createModel` always makes an attempt to auto-attach.\r\n\r\n**Conflict resolution and Access control** (the second commit)\r\n\r\n- Add end-to-end unit-tests verifying enforcement of access control during conflict resolution.\r\n\r\n- Implement two facade methods providing REST API for Change methods used\r\nby conflict resolution:\r\n\r\n        PersistedModel.findLastChange\r\n        GET /api/{model.pluralName}/{id}/changes/last\r\n\r\n        PersistedModel.updateLastChange\r\n        PUT /api/{model.pluralName}/{id}/changes/last\r\n\r\n  By providing these two methods on PersistedModel, replication users don't have to expose the Change model via the REST API. What's even more important, these two methods use the same set of ACL rules as other (regular) PersistedModel methods.\r\n\r\n- Rework `Conflict.prototype.changes()` and `Conflict.prototype.resolve()` to use these new facade methods.\r\n\r\n- Implement a new method `Conflict.prototype.swapParties()` that provides better API for the situation when a conflict detected in Remote->Local replication should be resolved locally (i.e. in the replication target).\r\n\r\nConnect to strongloop/loopback#1166\r\n\r\n/to @ritch please review","created_at":"2015-04-09T10:55:33Z","updated_at":"2015-04-14T06:23:28Z","closed_at":null,"merged_at":null,"merge_commit_sha":"97329d073c41ae3aba4ec63305248b3895f8255e","assignee":{"login":"bajtos","id":1140553,"avatar_url":"https://avatars.githubusercontent.com/u/1140553?v=3","gravatar_id":"","url":"https://api.github.com/users/bajtos","html_url":"https://github.com/bajtos","followers_url":"https://api.github.com/users/bajtos/followers","following_url":"https://api.github.com/users/bajtos/following{/other_user}","gists_url":"https://api.github.com/users/bajtos/gists{/gist_id}","starred_url":"https://api.github.com/users/bajtos/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bajtos/subscriptions","organizations_url":"https://api.github.com/users/bajtos/orgs","repos_url":"https://api.github.com/users/bajtos/repos","events_url":"https://api.github.com/users/bajtos/events{/privacy}","received_events_url":"https://api.github.com/users/bajtos/received_events","type":"User","site_admin":false},"milestone":{"url":"https://api.github.com/repos/strongloop/loopback/milestones/17","html_url":"https://github.com/strongloop/loopback/milestones/%23Epic:%20Offline%20Sync%20V1","labels_url":"https://api.github.com/repos/strongloop/loopback/milestones/17/labels","id":928316,"number":17,"title":"#Epic: Offline Sync V1","description":null,"creator":{"login":"bajtos","id":1140553,"avatar_url":"https://avatars.githubusercontent.com/u/1140553?v=3","gravatar_id":"","url":"https://api.github.com/users/bajtos","html_url":"https://github.com/bajtos","followers_url":"https://api.github.com/users/bajtos/followers","following_url":"https://api.github.com/users/bajtos/following{/other_user}","gists_url":"https://api.github.com/users/bajtos/gists{/gist_id}","starred_url":"https://api.github.com/users/bajtos/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bajtos/subscriptions","organizations_url":"https://api.github.com/users/bajtos/orgs","repos_url":"https://api.github.com/users/bajtos/repos","events_url":"https://api.github.com/users/bajtos/events{/privacy}","received_events_url":"https://api.github.com/users/bajtos/received_events","type":"User","site_admin":false},"open_issues":4,"closed_issues":19,"state":"open","created_at":"2015-01-09T09:26:13Z","updated_at":"2015-04-09T10:55:33Z","due_on":null,"closed_at":null},"commits_url":"https://api.github.com/repos/strongloop/loopback/pulls/1294/commits","review_comments_url":"https://api.github.com/repos/strongloop/loopback/pulls/1294/comments","review_comment_url":"https://api.github.com/repos/strongloop/loopback/pulls/comments{/number}","comments_url":"https://api.github.com/repos/strongloop/loopback/issues/1294/comments","statuses_url":"https://api.github.com/repos/strongloop/loopback/statuses/cf2acb3cd23f9bcd8736a703093f6c7ca6b9aee3","head":{"label":"strongloop:feature/conflict-resolution-access-control","ref":"feature/conflict-resolution-access-control","sha":"cf2acb3cd23f9bcd8736a703093f6c7ca6b9aee3","user":{"login":"strongloop","id":3020012,"avatar_url":"https://avatars.githubusercontent.com/u/3020012?v=3","gravatar_id":"","url":"https://api.github.com/users/strongloop","html_url":"https://github.com/strongloop","followers_url":"https://api.github.com/users/strongloop/followers","following_url":"https://api.github.com/users/strongloop/following{/other_user}","gists_url":"https://api.github.com/users/strongloop/gists{/gist_id}","starred_url":"https://api.github.com/users/strongloop/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/strongloop/subscriptions","organizations_url":"https://api.github.com/users/strongloop/orgs","repos_url":"https://api.github.com/users/strongloop/repos","events_url":"https://api.github.com/users/strongloop/events{/privacy}","received_events_url":"https://api.github.com/users/strongloop/received_events","type":"Organization","site_admin":false},"repo":{"id":9325315,"name":"loopback","full_name":"strongloop/loopback","owner":{"login":"strongloop","id":3020012,"avatar_url":"https://avatars.githubusercontent.com/u/3020012?v=3","gravatar_id":"","url":"https://api.github.com/users/strongloop","html_url":"https://github.com/strongloop","followers_url":"https://api.github.com/users/strongloop/followers","following_url":"https://api.github.com/users/strongloop/following{/other_user}","gists_url":"https://api.github.com/users/strongloop/gists{/gist_id}","starred_url":"https://api.github.com/users/strongloop/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/strongloop/subscriptions","organizations_url":"https://api.github.com/users/strongloop/orgs","repos_url":"https://api.github.com/users/strongloop/repos","events_url":"https://api.github.com/users/strongloop/events{/privacy}","received_events_url":"https://api.github.com/users/strongloop/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/strongloop/loopback","description":"LoopBack is an open source Node.js framework built on top of Express optimized for building APIs for mobile, web, and other devices. Connect to multiple data sources, write business logic in Node.js, glue on top of your existing services and data, connect using JS, iOS & Android SDKs.","fork":false,"url":"https://api.github.com/repos/strongloop/loopback","forks_url":"https://api.github.com/repos/strongloop/loopback/forks","keys_url":"https://api.github.com/repos/strongloop/loopback/keys{/key_id}","collaborators_url":"https://api.github.com/repos/strongloop/loopback/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/strongloop/loopback/teams","hooks_url":"https://api.github.com/repos/strongloop/loopback/hooks","issue_events_url":"https://api.github.com/repos/strongloop/loopback/issues/events{/number}","events_url":"https://api.github.com/repos/strongloop/loopback/events","assignees_url":"https://api.github.com/repos/strongloop/loopback/assignees{/user}","branches_url":"https://api.github.com/repos/strongloop/loopback/branches{/branch}","tags_url":"https://api.github.com/repos/strongloop/loopback/tags","blobs_url":"https://api.github.com/repos/strongloop/loopback/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/strongloop/loopback/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/strongloop/loopback/git/refs{/sha}","trees_url":"https://api.github.com/repos/strongloop/loopback/git/trees{/sha}","statuses_url":"https://api.github.com/repos/strongloop/loopback/statuses/{sha}","languages_url":"https://api.github.com/repos/strongloop/loopback/languages","stargazers_url":"https://api.github.com/repos/strongloop/loopback/stargazers","contributors_url":"https://api.github.com/repos/strongloop/loopback/contributors","subscribers_url":"https://api.github.com/repos/strongloop/loopback/subscribers","subscription_url":"https://api.github.com/repos/strongloop/loopback/subscription","commits_url":"https://api.github.com/repos/strongloop/loopback/commits{/sha}","git_commits_url":"https://api.github.com/repos/strongloop/loopback/git/commits{/sha}","comments_url":"https://api.github.com/repos/strongloop/loopback/comments{/number}","issue_comment_url":"https://api.github.com/repos/strongloop/loopback/issues/comments{/number}","contents_url":"https://api.github.com/repos/strongloop/loopback/contents/{+path}","compare_url":"https://api.github.com/repos/strongloop/loopback/compare/{base}...{head}","merges_url":"https://api.github.com/repos/strongloop/loopback/merges","archive_url":"https://api.github.com/repos/strongloop/loopback/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/strongloop/loopback/downloads","issues_url":"https://api.github.com/repos/strongloop/loopback/issues{/number}","pulls_url":"https://api.github.com/repos/strongloop/loopback/pulls{/number}","milestones_url":"https://api.github.com/repos/strongloop/loopback/milestones{/number}","notifications_url":"https://api.github.com/repos/strongloop/loopback/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/strongloop/loopback/labels{/name}","releases_url":"https://api.github.com/repos/strongloop/loopback/releases{/id}","created_at":"2013-04-09T16:02:18Z","updated_at":"2015-04-14T05:52:33Z","pushed_at":"2015-04-14T06:23:22Z","git_url":"git://github.com/strongloop/loopback.git","ssh_url":"git@github.com:strongloop/loopback.git","clone_url":"https://github.com/strongloop/loopback.git","svn_url":"https://github.com/strongloop/loopback","homepage":"http://loopback.io","size":15731,"stargazers_count":3623,"watchers_count":3623,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":323,"mirror_url":null,"open_issues_count":370,"forks":323,"open_issues":370,"watchers":3623,"default_branch":"master"}},"base":{"label":"strongloop:master","ref":"master","sha":"b4c487b191c9b58834dd1a37c3682acf5e38443a","user":{"login":"strongloop","id":3020012,"avatar_url":"https://avatars.githubusercontent.com/u/3020012?v=3","gravatar_id":"","url":"https://api.github.com/users/strongloop","html_url":"https://github.com/strongloop","followers_url":"https://api.github.com/users/strongloop/followers","following_url":"https://api.github.com/users/strongloop/following{/other_user}","gists_url":"https://api.github.com/users/strongloop/gists{/gist_id}","starred_url":"https://api.github.com/users/strongloop/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/strongloop/subscriptions","organizations_url":"https://api.github.com/users/strongloop/orgs","repos_url":"https://api.github.com/users/strongloop/repos","events_url":"https://api.github.com/users/strongloop/events{/privacy}","received_events_url":"https://api.github.com/users/strongloop/received_events","type":"Organization","site_admin":false},"repo":{"id":9325315,"name":"loopback","full_name":"strongloop/loopback","owner":{"login":"strongloop","id":3020012,"avatar_url":"https://avatars.githubusercontent.com/u/3020012?v=3","gravatar_id":"","url":"https://api.github.com/users/strongloop","html_url":"https://github.com/strongloop","followers_url":"https://api.github.com/users/strongloop/followers","following_url":"https://api.github.com/users/strongloop/following{/other_user}","gists_url":"https://api.github.com/users/strongloop/gists{/gist_id}","starred_url":"https://api.github.com/users/strongloop/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/strongloop/subscriptions","organizations_url":"https://api.github.com/users/strongloop/orgs","repos_url":"https://api.github.com/users/strongloop/repos","events_url":"https://api.github.com/users/strongloop/events{/privacy}","received_events_url":"https://api.github.com/users/strongloop/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/strongloop/loopback","description":"LoopBack is an open source Node.js framework built on top of Express optimized for building APIs for mobile, web, and other devices. Connect to multiple data sources, write business logic in Node.js, glue on top of your existing services and data, connect using JS, iOS & Android SDKs.","fork":false,"url":"https://api.github.com/repos/strongloop/loopback","forks_url":"https://api.github.com/repos/strongloop/loopback/forks","keys_url":"https://api.github.com/repos/strongloop/loopback/keys{/key_id}","collaborators_url":"https://api.github.com/repos/strongloop/loopback/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/strongloop/loopback/teams","hooks_url":"https://api.github.com/repos/strongloop/loopback/hooks","issue_events_url":"https://api.github.com/repos/strongloop/loopback/issues/events{/number}","events_url":"https://api.github.com/repos/strongloop/loopback/events","assignees_url":"https://api.github.com/repos/strongloop/loopback/assignees{/user}","branches_url":"https://api.github.com/repos/strongloop/loopback/branches{/branch}","tags_url":"https://api.github.com/repos/strongloop/loopback/tags","blobs_url":"https://api.github.com/repos/strongloop/loopback/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/strongloop/loopback/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/strongloop/loopback/git/refs{/sha}","trees_url":"https://api.github.com/repos/strongloop/loopback/git/trees{/sha}","statuses_url":"https://api.github.com/repos/strongloop/loopback/statuses/{sha}","languages_url":"https://api.github.com/repos/strongloop/loopback/languages","stargazers_url":"https://api.github.com/repos/strongloop/loopback/stargazers","contributors_url":"https://api.github.com/repos/strongloop/loopback/contributors","subscribers_url":"https://api.github.com/repos/strongloop/loopback/subscribers","subscription_url":"https://api.github.com/repos/strongloop/loopback/subscription","commits_url":"https://api.github.com/repos/strongloop/loopback/commits{/sha}","git_commits_url":"https://api.github.com/repos/strongloop/loopback/git/commits{/sha}","comments_url":"https://api.github.com/repos/strongloop/loopback/comments{/number}","issue_comment_url":"https://api.github.com/repos/strongloop/loopback/issues/comments{/number}","contents_url":"https://api.github.com/repos/strongloop/loopback/contents/{+path}","compare_url":"https://api.github.com/repos/strongloop/loopback/compare/{base}...{head}","merges_url":"https://api.github.com/repos/strongloop/loopback/merges","archive_url":"https://api.github.com/repos/strongloop/loopback/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/strongloop/loopback/downloads","issues_url":"https://api.github.com/repos/strongloop/loopback/issues{/number}","pulls_url":"https://api.github.com/repos/strongloop/loopback/pulls{/number}","milestones_url":"https://api.github.com/repos/strongloop/loopback/milestones{/number}","notifications_url":"https://api.github.com/repos/strongloop/loopback/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/strongloop/loopback/labels{/name}","releases_url":"https://api.github.com/repos/strongloop/loopback/releases{/id}","created_at":"2013-04-09T16:02:18Z","updated_at":"2015-04-14T05:52:33Z","pushed_at":"2015-04-14T06:23:22Z","git_url":"git://github.com/strongloop/loopback.git","ssh_url":"git@github.com:strongloop/loopback.git","clone_url":"https://github.com/strongloop/loopback.git","svn_url":"https://github.com/strongloop/loopback","homepage":"http://loopback.io","size":15731,"stargazers_count":3623,"watchers_count":3623,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":323,"mirror_url":null,"open_issues_count":370,"forks":323,"open_issues":370,"watchers":3623,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/strongloop/loopback/pulls/1294"},"html":{"href":"https://github.com/strongloop/loopback/pull/1294"},"issue":{"href":"https://api.github.com/repos/strongloop/loopback/issues/1294"},"comments":{"href":"https://api.github.com/repos/strongloop/loopback/issues/1294/comments"},"review_comments":{"href":"https://api.github.com/repos/strongloop/loopback/pulls/1294/comments"},"review_comment":{"href":"https://api.github.com/repos/strongloop/loopback/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/strongloop/loopback/pulls/1294/commits"},"statuses":{"href":"https://api.github.com/repos/strongloop/loopback/statuses/cf2acb3cd23f9bcd8736a703093f6c7ca6b9aee3"}}}}