{"action":"created","comment":{"url":"https://api.github.com/repos/GPII/universal/pulls/comments/44323245","id":44323245,"diff_hunk":"@@ -341,4 +372,51 @@ var fluid = fluid || require(\"infusion\");\n         return undefined;\n     };\n \n+    gpii.oauth2.dataStore.findCredentialClientTokenById = function (credentialClientTokens, id) {\n+        return fluid.find_if(credentialClientTokens, function (cct) {\n+            return cct.id === id;\n+        });\n+    };\n+\n+    gpii.oauth2.dataStore.findCredentialClientTokenByClientId = function (credentialClientTokens, clientId) {\n+        var credentialClientToken = fluid.find_if(credentialClientTokens, function (cct) {\n+            return cct.clientId === clientId && cct.revoked === false;\n+        });\n+        return credentialClientToken ? credentialClientToken : undefined;\n+    };\n+\n+    gpii.oauth2.dataStore.findCredentialClientTokenByAccessToken = function (credentialClientTokens, accessToken) {\n+        var credentialClientToken = fluid.find_if(credentialClientTokens, function (cct) {\n+            return cct.accessToken === accessToken && cct.revoked === false;\n+        });\n+        return credentialClientToken ? credentialClientToken : undefined;\n+    };\n+\n+    gpii.oauth2.dataStore.addCredentialClientToken = function (model, applier, credentialClientTokenData) {\n+        var credentialClientTokenId = model.credentialClientTokensIdSeq;\n+        applier.change(\"credentialClientTokensIdSeq\", model.credentialClientTokensIdSeq + 1);\n+        var credentialClientToken = {\n+            id: credentialClientTokenId, // primary key\n+            clientId: credentialClientTokenData.clientId, // foreign key\n+            accessToken: credentialClientTokenData.accessToken,\n+            allowAddPrefs: credentialClientTokenData.allowAddPrefs,\n+            revoked: false\n+        };\n+        model.credentialClientTokens.push(credentialClientToken);\n+        applier.change(\"credentialClientTokens\", model.credentialClientTokens);\n+        return credentialClientToken;\n+    };\n+\n+    gpii.oauth2.dataStore.revokeCredentialClientToken = function (credentialClientTokens, applier, credentialClientTokenId) {\n+        var credentialClientToken = gpii.oauth2.dataStore.findCredentialClientTokenById(credentialClientTokens, credentialClientTokenId);\n+        if (credentialClientToken) {\n+            credentialClientToken.revoked = true;\n+            applier.change(\"credentialClientTokens\", credentialClientTokens);\n+        }\n+    };\n+\n+    gpii.oauth2.dataStore.findCredentialClientByAccessToken = function (credentialClientTokens, clients, accessToken) {","path":"gpii/node_modules/gpii-oauth2/gpii-oauth2-datastore/src/InMemoryDataStore.js","position":98,"original_position":98,"commit_id":"51f28ad86c0f3c966e20504f5d3278bb4393562f","original_commit_id":"51f28ad86c0f3c966e20504f5d3278bb4393562f","user":{"login":"simonbates","id":470482,"avatar_url":"https://avatars.githubusercontent.com/u/470482?v=3","gravatar_id":"","url":"https://api.github.com/users/simonbates","html_url":"https://github.com/simonbates","followers_url":"https://api.github.com/users/simonbates/followers","following_url":"https://api.github.com/users/simonbates/following{/other_user}","gists_url":"https://api.github.com/users/simonbates/gists{/gist_id}","starred_url":"https://api.github.com/users/simonbates/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/simonbates/subscriptions","organizations_url":"https://api.github.com/users/simonbates/orgs","repos_url":"https://api.github.com/users/simonbates/repos","events_url":"https://api.github.com/users/simonbates/events{/privacy}","received_events_url":"https://api.github.com/users/simonbates/received_events","type":"User","site_admin":false},"body":"Regarding the renaming we discussed, I'm thinking that we call this one findClientByClientCredentialsAccessToken.","created_at":"2015-11-09T20:01:54Z","updated_at":"2015-11-09T20:01:54Z","html_url":"https://github.com/GPII/universal/pull/421#discussion_r44323245","pull_request_url":"https://api.github.com/repos/GPII/universal/pulls/421","_links":{"self":{"href":"https://api.github.com/repos/GPII/universal/pulls/comments/44323245"},"html":{"href":"https://github.com/GPII/universal/pull/421#discussion_r44323245"},"pull_request":{"href":"https://api.github.com/repos/GPII/universal/pulls/421"}}},"pull_request":{"url":"https://api.github.com/repos/GPII/universal/pulls/421","id":49511132,"html_url":"https://github.com/GPII/universal/pull/421","diff_url":"https://github.com/GPII/universal/pull/421.diff","patch_url":"https://github.com/GPII/universal/pull/421.patch","issue_url":"https://api.github.com/repos/GPII/universal/issues/421","number":421,"state":"open","locked":false,"title":"GPII-1309: Add the new end point /add-preferences to the OAuth2 security server","user":{"login":"cindyli","id":572877,"avatar_url":"https://avatars.githubusercontent.com/u/572877?v=3","gravatar_id":"","url":"https://api.github.com/users/cindyli","html_url":"https://github.com/cindyli","followers_url":"https://api.github.com/users/cindyli/followers","following_url":"https://api.github.com/users/cindyli/following{/other_user}","gists_url":"https://api.github.com/users/cindyli/gists{/gist_id}","starred_url":"https://api.github.com/users/cindyli/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cindyli/subscriptions","organizations_url":"https://api.github.com/users/cindyli/orgs","repos_url":"https://api.github.com/users/cindyli/repos","events_url":"https://api.github.com/users/cindyli/events{/privacy}","received_events_url":"https://api.github.com/users/cindyli/received_events","type":"User","site_admin":false},"body":"This pull request is dependent on https://github.com/GPII/universal/pull/406 that should be reviewed and merged first.","created_at":"2015-11-03T01:44:08Z","updated_at":"2015-11-09T20:01:54Z","closed_at":null,"merged_at":null,"merge_commit_sha":"1d1b9aa4c8faf7ddfd0925b8fd8053bd99531f1a","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/GPII/universal/pulls/421/commits","review_comments_url":"https://api.github.com/repos/GPII/universal/pulls/421/comments","review_comment_url":"https://api.github.com/repos/GPII/universal/pulls/comments{/number}","comments_url":"https://api.github.com/repos/GPII/universal/issues/421/comments","statuses_url":"https://api.github.com/repos/GPII/universal/statuses/51f28ad86c0f3c966e20504f5d3278bb4393562f","head":{"label":"cindyli:GPII-1309","ref":"GPII-1309","sha":"51f28ad86c0f3c966e20504f5d3278bb4393562f","user":{"login":"cindyli","id":572877,"avatar_url":"https://avatars.githubusercontent.com/u/572877?v=3","gravatar_id":"","url":"https://api.github.com/users/cindyli","html_url":"https://github.com/cindyli","followers_url":"https://api.github.com/users/cindyli/followers","following_url":"https://api.github.com/users/cindyli/following{/other_user}","gists_url":"https://api.github.com/users/cindyli/gists{/gist_id}","starred_url":"https://api.github.com/users/cindyli/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cindyli/subscriptions","organizations_url":"https://api.github.com/users/cindyli/orgs","repos_url":"https://api.github.com/users/cindyli/repos","events_url":"https://api.github.com/users/cindyli/events{/privacy}","received_events_url":"https://api.github.com/users/cindyli/received_events","type":"User","site_admin":false},"repo":{"id":15742418,"name":"universal","full_name":"cindyli/universal","owner":{"login":"cindyli","id":572877,"avatar_url":"https://avatars.githubusercontent.com/u/572877?v=3","gravatar_id":"","url":"https://api.github.com/users/cindyli","html_url":"https://github.com/cindyli","followers_url":"https://api.github.com/users/cindyli/followers","following_url":"https://api.github.com/users/cindyli/following{/other_user}","gists_url":"https://api.github.com/users/cindyli/gists{/gist_id}","starred_url":"https://api.github.com/users/cindyli/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cindyli/subscriptions","organizations_url":"https://api.github.com/users/cindyli/orgs","repos_url":"https://api.github.com/users/cindyli/repos","events_url":"https://api.github.com/users/cindyli/events{/privacy}","received_events_url":"https://api.github.com/users/cindyli/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/cindyli/universal","description":"Cross platform, core components of the GPII personalization infrastructure","fork":true,"url":"https://api.github.com/repos/cindyli/universal","forks_url":"https://api.github.com/repos/cindyli/universal/forks","keys_url":"https://api.github.com/repos/cindyli/universal/keys{/key_id}","collaborators_url":"https://api.github.com/repos/cindyli/universal/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/cindyli/universal/teams","hooks_url":"https://api.github.com/repos/cindyli/universal/hooks","issue_events_url":"https://api.github.com/repos/cindyli/universal/issues/events{/number}","events_url":"https://api.github.com/repos/cindyli/universal/events","assignees_url":"https://api.github.com/repos/cindyli/universal/assignees{/user}","branches_url":"https://api.github.com/repos/cindyli/universal/branches{/branch}","tags_url":"https://api.github.com/repos/cindyli/universal/tags","blobs_url":"https://api.github.com/repos/cindyli/universal/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/cindyli/universal/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/cindyli/universal/git/refs{/sha}","trees_url":"https://api.github.com/repos/cindyli/universal/git/trees{/sha}","statuses_url":"https://api.github.com/repos/cindyli/universal/statuses/{sha}","languages_url":"https://api.github.com/repos/cindyli/universal/languages","stargazers_url":"https://api.github.com/repos/cindyli/universal/stargazers","contributors_url":"https://api.github.com/repos/cindyli/universal/contributors","subscribers_url":"https://api.github.com/repos/cindyli/universal/subscribers","subscription_url":"https://api.github.com/repos/cindyli/universal/subscription","commits_url":"https://api.github.com/repos/cindyli/universal/commits{/sha}","git_commits_url":"https://api.github.com/repos/cindyli/universal/git/commits{/sha}","comments_url":"https://api.github.com/repos/cindyli/universal/comments{/number}","issue_comment_url":"https://api.github.com/repos/cindyli/universal/issues/comments{/number}","contents_url":"https://api.github.com/repos/cindyli/universal/contents/{+path}","compare_url":"https://api.github.com/repos/cindyli/universal/compare/{base}...{head}","merges_url":"https://api.github.com/repos/cindyli/universal/merges","archive_url":"https://api.github.com/repos/cindyli/universal/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/cindyli/universal/downloads","issues_url":"https://api.github.com/repos/cindyli/universal/issues{/number}","pulls_url":"https://api.github.com/repos/cindyli/universal/pulls{/number}","milestones_url":"https://api.github.com/repos/cindyli/universal/milestones{/number}","notifications_url":"https://api.github.com/repos/cindyli/universal/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/cindyli/universal/labels{/name}","releases_url":"https://api.github.com/repos/cindyli/universal/releases{/id}","created_at":"2014-01-08T17:22:21Z","updated_at":"2014-12-19T19:14:16Z","pushed_at":"2015-11-03T01:40:48Z","git_url":"git://github.com/cindyli/universal.git","ssh_url":"git@github.com:cindyli/universal.git","clone_url":"https://github.com/cindyli/universal.git","svn_url":"https://github.com/cindyli/universal","homepage":"gpii.net","size":91814,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"GPII:master","ref":"master","sha":"56a5b38e7c4215023b84d6fc14103cb29c4fcb95","user":{"login":"GPII","id":1343050,"avatar_url":"https://avatars.githubusercontent.com/u/1343050?v=3","gravatar_id":"","url":"https://api.github.com/users/GPII","html_url":"https://github.com/GPII","followers_url":"https://api.github.com/users/GPII/followers","following_url":"https://api.github.com/users/GPII/following{/other_user}","gists_url":"https://api.github.com/users/GPII/gists{/gist_id}","starred_url":"https://api.github.com/users/GPII/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/GPII/subscriptions","organizations_url":"https://api.github.com/users/GPII/orgs","repos_url":"https://api.github.com/users/GPII/repos","events_url":"https://api.github.com/users/GPII/events{/privacy}","received_events_url":"https://api.github.com/users/GPII/received_events","type":"Organization","site_admin":false},"repo":{"id":3623720,"name":"universal","full_name":"GPII/universal","owner":{"login":"GPII","id":1343050,"avatar_url":"https://avatars.githubusercontent.com/u/1343050?v=3","gravatar_id":"","url":"https://api.github.com/users/GPII","html_url":"https://github.com/GPII","followers_url":"https://api.github.com/users/GPII/followers","following_url":"https://api.github.com/users/GPII/following{/other_user}","gists_url":"https://api.github.com/users/GPII/gists{/gist_id}","starred_url":"https://api.github.com/users/GPII/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/GPII/subscriptions","organizations_url":"https://api.github.com/users/GPII/orgs","repos_url":"https://api.github.com/users/GPII/repos","events_url":"https://api.github.com/users/GPII/events{/privacy}","received_events_url":"https://api.github.com/users/GPII/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/GPII/universal","description":"Cross platform, core components of the GPII personalization infrastructure","fork":false,"url":"https://api.github.com/repos/GPII/universal","forks_url":"https://api.github.com/repos/GPII/universal/forks","keys_url":"https://api.github.com/repos/GPII/universal/keys{/key_id}","collaborators_url":"https://api.github.com/repos/GPII/universal/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/GPII/universal/teams","hooks_url":"https://api.github.com/repos/GPII/universal/hooks","issue_events_url":"https://api.github.com/repos/GPII/universal/issues/events{/number}","events_url":"https://api.github.com/repos/GPII/universal/events","assignees_url":"https://api.github.com/repos/GPII/universal/assignees{/user}","branches_url":"https://api.github.com/repos/GPII/universal/branches{/branch}","tags_url":"https://api.github.com/repos/GPII/universal/tags","blobs_url":"https://api.github.com/repos/GPII/universal/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/GPII/universal/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/GPII/universal/git/refs{/sha}","trees_url":"https://api.github.com/repos/GPII/universal/git/trees{/sha}","statuses_url":"https://api.github.com/repos/GPII/universal/statuses/{sha}","languages_url":"https://api.github.com/repos/GPII/universal/languages","stargazers_url":"https://api.github.com/repos/GPII/universal/stargazers","contributors_url":"https://api.github.com/repos/GPII/universal/contributors","subscribers_url":"https://api.github.com/repos/GPII/universal/subscribers","subscription_url":"https://api.github.com/repos/GPII/universal/subscription","commits_url":"https://api.github.com/repos/GPII/universal/commits{/sha}","git_commits_url":"https://api.github.com/repos/GPII/universal/git/commits{/sha}","comments_url":"https://api.github.com/repos/GPII/universal/comments{/number}","issue_comment_url":"https://api.github.com/repos/GPII/universal/issues/comments{/number}","contents_url":"https://api.github.com/repos/GPII/universal/contents/{+path}","compare_url":"https://api.github.com/repos/GPII/universal/compare/{base}...{head}","merges_url":"https://api.github.com/repos/GPII/universal/merges","archive_url":"https://api.github.com/repos/GPII/universal/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/GPII/universal/downloads","issues_url":"https://api.github.com/repos/GPII/universal/issues{/number}","pulls_url":"https://api.github.com/repos/GPII/universal/pulls{/number}","milestones_url":"https://api.github.com/repos/GPII/universal/milestones{/number}","notifications_url":"https://api.github.com/repos/GPII/universal/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/GPII/universal/labels{/name}","releases_url":"https://api.github.com/repos/GPII/universal/releases{/id}","created_at":"2012-03-05T04:01:44Z","updated_at":"2015-10-13T15:17:11Z","pushed_at":"2015-11-06T12:58:44Z","git_url":"git://github.com/GPII/universal.git","ssh_url":"git@github.com:GPII/universal.git","clone_url":"https://github.com/GPII/universal.git","svn_url":"https://github.com/GPII/universal","homepage":"gpii.net","size":95378,"stargazers_count":22,"watchers_count":22,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":48,"mirror_url":null,"open_issues_count":41,"forks":48,"open_issues":41,"watchers":22,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/GPII/universal/pulls/421"},"html":{"href":"https://github.com/GPII/universal/pull/421"},"issue":{"href":"https://api.github.com/repos/GPII/universal/issues/421"},"comments":{"href":"https://api.github.com/repos/GPII/universal/issues/421/comments"},"review_comments":{"href":"https://api.github.com/repos/GPII/universal/pulls/421/comments"},"review_comment":{"href":"https://api.github.com/repos/GPII/universal/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/GPII/universal/pulls/421/commits"},"statuses":{"href":"https://api.github.com/repos/GPII/universal/statuses/51f28ad86c0f3c966e20504f5d3278bb4393562f"}}}}