{"action":"created","comment":{"url":"https://api.github.com/repos/digitalbazaar/bedrock-identity-rest/pulls/comments/61159284","id":61159284,"diff_hunk":"@@ -376,6 +432,60 @@ bedrock.events.on('bedrock-express.configure.routes', function(app) {\n       404: 'The identity was not found on the system.'\n     }\n   });\n+\n+  app.delete(idPath, ensureAuthenticated, function(req, res, next) {\n+    var fullUrl = req.protocol + '://' + req.get('host') + req.originalUrl;\n+    brIdentity.setStatus(req.user.identity, fullUrl, 'deleted', function(err) {\n+      if(err) {\n+        return next(err);\n+      }\n+      res.sendStatus(204);\n+    });\n+  });\n+\n+  // TODO: endpoint for batch update operations, needs fix-up and tests\n+  app.patch(basePath,\n+    ensureAuthenticated,\n+    function(req, res, next) {\n+      var operations = req.body;\n+      var deleteOperations = operations.filter(function(operation) {\n+        return operation.op === 'delete';\n+      });\n+      var updateOperations = operations.filter(function(operation) {\n+        return operation.op === 'update';\n+      });\n+      var updateRoleOperations = operations.filter(function(operation) {\n+        return operation.op === 'updateRoles';\n+      });\n+\n+      async.auto({\n+        delete: function(callback) {\n+          return callback();\n+        },\n+        update: function(callback) {\n+          return callback();\n+        },\n+        updateRoles: function(callback) {\n+          if(updateRoleOperations.length === 0) {\n+            return callback();\n+          }\n+          async.each(updateRoleOperations,\n+            function(operation, callback) {\n+              var identity = operation.identity;\n+              brIdentity.setRoles(null, identity, function(err, record) {\n+                return callback(err, record);\n+              });\n+            }, function(err, results) {\n+              return callback(err, results);\n+            });\n+        }\n+      }, function(err, results) {\n+        if(err) {\n+          return next(err);\n+        }\n+        res.json(results);","path":"lib/services.identity.js","position":354,"original_position":354,"commit_id":"e02d87bff2d77c9a3ac94656a34794080617c67a","original_commit_id":"e02d87bff2d77c9a3ac94656a34794080617c67a","user":{"login":"dlongley","id":168137,"avatar_url":"https://avatars.githubusercontent.com/u/168137?v=3","gravatar_id":"","url":"https://api.github.com/users/dlongley","html_url":"https://github.com/dlongley","followers_url":"https://api.github.com/users/dlongley/followers","following_url":"https://api.github.com/users/dlongley/following{/other_user}","gists_url":"https://api.github.com/users/dlongley/gists{/gist_id}","starred_url":"https://api.github.com/users/dlongley/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dlongley/subscriptions","organizations_url":"https://api.github.com/users/dlongley/orgs","repos_url":"https://api.github.com/users/dlongley/repos","events_url":"https://api.github.com/users/dlongley/events{/privacy}","received_events_url":"https://api.github.com/users/dlongley/received_events","type":"User","site_admin":false},"body":"We should not be returning `results` from the async API to the client. Maybe a 204 instead?","created_at":"2016-04-26T20:35:24Z","updated_at":"2016-04-26T20:35:24Z","html_url":"https://github.com/digitalbazaar/bedrock-identity-rest/pull/1#discussion_r61159284","pull_request_url":"https://api.github.com/repos/digitalbazaar/bedrock-identity-rest/pulls/1","_links":{"self":{"href":"https://api.github.com/repos/digitalbazaar/bedrock-identity-rest/pulls/comments/61159284"},"html":{"href":"https://github.com/digitalbazaar/bedrock-identity-rest/pull/1#discussion_r61159284"},"pull_request":{"href":"https://api.github.com/repos/digitalbazaar/bedrock-identity-rest/pulls/1"}}},"pull_request":{"url":"https://api.github.com/repos/digitalbazaar/bedrock-identity-rest/pulls/1","id":67556564,"html_url":"https://github.com/digitalbazaar/bedrock-identity-rest/pull/1","diff_url":"https://github.com/digitalbazaar/bedrock-identity-rest/pull/1.diff","patch_url":"https://github.com/digitalbazaar/bedrock-identity-rest/pull/1.patch","issue_url":"https://api.github.com/repos/digitalbazaar/bedrock-identity-rest/issues/1","number":1,"state":"open","locked":false,"title":"Admin tool testing","user":{"login":"mattcollier","id":902041,"avatar_url":"https://avatars.githubusercontent.com/u/902041?v=3","gravatar_id":"","url":"https://api.github.com/users/mattcollier","html_url":"https://github.com/mattcollier","followers_url":"https://api.github.com/users/mattcollier/followers","following_url":"https://api.github.com/users/mattcollier/following{/other_user}","gists_url":"https://api.github.com/users/mattcollier/gists{/gist_id}","starred_url":"https://api.github.com/users/mattcollier/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mattcollier/subscriptions","organizations_url":"https://api.github.com/users/mattcollier/orgs","repos_url":"https://api.github.com/users/mattcollier/repos","events_url":"https://api.github.com/users/mattcollier/events{/privacy}","received_events_url":"https://api.github.com/users/mattcollier/received_events","type":"User","site_admin":false},"body":"","created_at":"2016-04-22T18:53:28Z","updated_at":"2016-04-26T20:35:24Z","closed_at":null,"merged_at":null,"merge_commit_sha":"827174f841de087b1e4a13b3462b46a3127ccf8c","assignee":{"login":"dlongley","id":168137,"avatar_url":"https://avatars.githubusercontent.com/u/168137?v=3","gravatar_id":"","url":"https://api.github.com/users/dlongley","html_url":"https://github.com/dlongley","followers_url":"https://api.github.com/users/dlongley/followers","following_url":"https://api.github.com/users/dlongley/following{/other_user}","gists_url":"https://api.github.com/users/dlongley/gists{/gist_id}","starred_url":"https://api.github.com/users/dlongley/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dlongley/subscriptions","organizations_url":"https://api.github.com/users/dlongley/orgs","repos_url":"https://api.github.com/users/dlongley/repos","events_url":"https://api.github.com/users/dlongley/events{/privacy}","received_events_url":"https://api.github.com/users/dlongley/received_events","type":"User","site_admin":false},"milestone":null,"commits_url":"https://api.github.com/repos/digitalbazaar/bedrock-identity-rest/pulls/1/commits","review_comments_url":"https://api.github.com/repos/digitalbazaar/bedrock-identity-rest/pulls/1/comments","review_comment_url":"https://api.github.com/repos/digitalbazaar/bedrock-identity-rest/pulls/comments{/number}","comments_url":"https://api.github.com/repos/digitalbazaar/bedrock-identity-rest/issues/1/comments","statuses_url":"https://api.github.com/repos/digitalbazaar/bedrock-identity-rest/statuses/e02d87bff2d77c9a3ac94656a34794080617c67a","head":{"label":"digitalbazaar:admin-tool-testing","ref":"admin-tool-testing","sha":"e02d87bff2d77c9a3ac94656a34794080617c67a","user":{"login":"digitalbazaar","id":167436,"avatar_url":"https://avatars.githubusercontent.com/u/167436?v=3","gravatar_id":"","url":"https://api.github.com/users/digitalbazaar","html_url":"https://github.com/digitalbazaar","followers_url":"https://api.github.com/users/digitalbazaar/followers","following_url":"https://api.github.com/users/digitalbazaar/following{/other_user}","gists_url":"https://api.github.com/users/digitalbazaar/gists{/gist_id}","starred_url":"https://api.github.com/users/digitalbazaar/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/digitalbazaar/subscriptions","organizations_url":"https://api.github.com/users/digitalbazaar/orgs","repos_url":"https://api.github.com/users/digitalbazaar/repos","events_url":"https://api.github.com/users/digitalbazaar/events{/privacy}","received_events_url":"https://api.github.com/users/digitalbazaar/received_events","type":"Organization","site_admin":false},"repo":{"id":43888573,"name":"bedrock-identity-rest","full_name":"digitalbazaar/bedrock-identity-rest","owner":{"login":"digitalbazaar","id":167436,"avatar_url":"https://avatars.githubusercontent.com/u/167436?v=3","gravatar_id":"","url":"https://api.github.com/users/digitalbazaar","html_url":"https://github.com/digitalbazaar","followers_url":"https://api.github.com/users/digitalbazaar/followers","following_url":"https://api.github.com/users/digitalbazaar/following{/other_user}","gists_url":"https://api.github.com/users/digitalbazaar/gists{/gist_id}","starred_url":"https://api.github.com/users/digitalbazaar/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/digitalbazaar/subscriptions","organizations_url":"https://api.github.com/users/digitalbazaar/orgs","repos_url":"https://api.github.com/users/digitalbazaar/repos","events_url":"https://api.github.com/users/digitalbazaar/events{/privacy}","received_events_url":"https://api.github.com/users/digitalbazaar/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/digitalbazaar/bedrock-identity-rest","description":"","fork":false,"url":"https://api.github.com/repos/digitalbazaar/bedrock-identity-rest","forks_url":"https://api.github.com/repos/digitalbazaar/bedrock-identity-rest/forks","keys_url":"https://api.github.com/repos/digitalbazaar/bedrock-identity-rest/keys{/key_id}","collaborators_url":"https://api.github.com/repos/digitalbazaar/bedrock-identity-rest/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/digitalbazaar/bedrock-identity-rest/teams","hooks_url":"https://api.github.com/repos/digitalbazaar/bedrock-identity-rest/hooks","issue_events_url":"https://api.github.com/repos/digitalbazaar/bedrock-identity-rest/issues/events{/number}","events_url":"https://api.github.com/repos/digitalbazaar/bedrock-identity-rest/events","assignees_url":"https://api.github.com/repos/digitalbazaar/bedrock-identity-rest/assignees{/user}","branches_url":"https://api.github.com/repos/digitalbazaar/bedrock-identity-rest/branches{/branch}","tags_url":"https://api.github.com/repos/digitalbazaar/bedrock-identity-rest/tags","blobs_url":"https://api.github.com/repos/digitalbazaar/bedrock-identity-rest/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/digitalbazaar/bedrock-identity-rest/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/digitalbazaar/bedrock-identity-rest/git/refs{/sha}","trees_url":"https://api.github.com/repos/digitalbazaar/bedrock-identity-rest/git/trees{/sha}","statuses_url":"https://api.github.com/repos/digitalbazaar/bedrock-identity-rest/statuses/{sha}","languages_url":"https://api.github.com/repos/digitalbazaar/bedrock-identity-rest/languages","stargazers_url":"https://api.github.com/repos/digitalbazaar/bedrock-identity-rest/stargazers","contributors_url":"https://api.github.com/repos/digitalbazaar/bedrock-identity-rest/contributors","subscribers_url":"https://api.github.com/repos/digitalbazaar/bedrock-identity-rest/subscribers","subscription_url":"https://api.github.com/repos/digitalbazaar/bedrock-identity-rest/subscription","commits_url":"https://api.github.com/repos/digitalbazaar/bedrock-identity-rest/commits{/sha}","git_commits_url":"https://api.github.com/repos/digitalbazaar/bedrock-identity-rest/git/commits{/sha}","comments_url":"https://api.github.com/repos/digitalbazaar/bedrock-identity-rest/comments{/number}","issue_comment_url":"https://api.github.com/repos/digitalbazaar/bedrock-identity-rest/issues/comments{/number}","contents_url":"https://api.github.com/repos/digitalbazaar/bedrock-identity-rest/contents/{+path}","compare_url":"https://api.github.com/repos/digitalbazaar/bedrock-identity-rest/compare/{base}...{head}","merges_url":"https://api.github.com/repos/digitalbazaar/bedrock-identity-rest/merges","archive_url":"https://api.github.com/repos/digitalbazaar/bedrock-identity-rest/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/digitalbazaar/bedrock-identity-rest/downloads","issues_url":"https://api.github.com/repos/digitalbazaar/bedrock-identity-rest/issues{/number}","pulls_url":"https://api.github.com/repos/digitalbazaar/bedrock-identity-rest/pulls{/number}","milestones_url":"https://api.github.com/repos/digitalbazaar/bedrock-identity-rest/milestones{/number}","notifications_url":"https://api.github.com/repos/digitalbazaar/bedrock-identity-rest/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/digitalbazaar/bedrock-identity-rest/labels{/name}","releases_url":"https://api.github.com/repos/digitalbazaar/bedrock-identity-rest/releases{/id}","deployments_url":"https://api.github.com/repos/digitalbazaar/bedrock-identity-rest/deployments","created_at":"2015-10-08T13:01:41Z","updated_at":"2016-01-31T23:06:54Z","pushed_at":"2016-04-26T17:49:54Z","git_url":"git://github.com/digitalbazaar/bedrock-identity-rest.git","ssh_url":"git@github.com:digitalbazaar/bedrock-identity-rest.git","clone_url":"https://github.com/digitalbazaar/bedrock-identity-rest.git","svn_url":"https://github.com/digitalbazaar/bedrock-identity-rest","homepage":null,"size":55,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":1,"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"base":{"label":"digitalbazaar:master","ref":"master","sha":"1e685620ee8505f1ba8aa67594b9bb03e8b9a63e","user":{"login":"digitalbazaar","id":167436,"avatar_url":"https://avatars.githubusercontent.com/u/167436?v=3","gravatar_id":"","url":"https://api.github.com/users/digitalbazaar","html_url":"https://github.com/digitalbazaar","followers_url":"https://api.github.com/users/digitalbazaar/followers","following_url":"https://api.github.com/users/digitalbazaar/following{/other_user}","gists_url":"https://api.github.com/users/digitalbazaar/gists{/gist_id}","starred_url":"https://api.github.com/users/digitalbazaar/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/digitalbazaar/subscriptions","organizations_url":"https://api.github.com/users/digitalbazaar/orgs","repos_url":"https://api.github.com/users/digitalbazaar/repos","events_url":"https://api.github.com/users/digitalbazaar/events{/privacy}","received_events_url":"https://api.github.com/users/digitalbazaar/received_events","type":"Organization","site_admin":false},"repo":{"id":43888573,"name":"bedrock-identity-rest","full_name":"digitalbazaar/bedrock-identity-rest","owner":{"login":"digitalbazaar","id":167436,"avatar_url":"https://avatars.githubusercontent.com/u/167436?v=3","gravatar_id":"","url":"https://api.github.com/users/digitalbazaar","html_url":"https://github.com/digitalbazaar","followers_url":"https://api.github.com/users/digitalbazaar/followers","following_url":"https://api.github.com/users/digitalbazaar/following{/other_user}","gists_url":"https://api.github.com/users/digitalbazaar/gists{/gist_id}","starred_url":"https://api.github.com/users/digitalbazaar/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/digitalbazaar/subscriptions","organizations_url":"https://api.github.com/users/digitalbazaar/orgs","repos_url":"https://api.github.com/users/digitalbazaar/repos","events_url":"https://api.github.com/users/digitalbazaar/events{/privacy}","received_events_url":"https://api.github.com/users/digitalbazaar/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/digitalbazaar/bedrock-identity-rest","description":"","fork":false,"url":"https://api.github.com/repos/digitalbazaar/bedrock-identity-rest","forks_url":"https://api.github.com/repos/digitalbazaar/bedrock-identity-rest/forks","keys_url":"https://api.github.com/repos/digitalbazaar/bedrock-identity-rest/keys{/key_id}","collaborators_url":"https://api.github.com/repos/digitalbazaar/bedrock-identity-rest/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/digitalbazaar/bedrock-identity-rest/teams","hooks_url":"https://api.github.com/repos/digitalbazaar/bedrock-identity-rest/hooks","issue_events_url":"https://api.github.com/repos/digitalbazaar/bedrock-identity-rest/issues/events{/number}","events_url":"https://api.github.com/repos/digitalbazaar/bedrock-identity-rest/events","assignees_url":"https://api.github.com/repos/digitalbazaar/bedrock-identity-rest/assignees{/user}","branches_url":"https://api.github.com/repos/digitalbazaar/bedrock-identity-rest/branches{/branch}","tags_url":"https://api.github.com/repos/digitalbazaar/bedrock-identity-rest/tags","blobs_url":"https://api.github.com/repos/digitalbazaar/bedrock-identity-rest/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/digitalbazaar/bedrock-identity-rest/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/digitalbazaar/bedrock-identity-rest/git/refs{/sha}","trees_url":"https://api.github.com/repos/digitalbazaar/bedrock-identity-rest/git/trees{/sha}","statuses_url":"https://api.github.com/repos/digitalbazaar/bedrock-identity-rest/statuses/{sha}","languages_url":"https://api.github.com/repos/digitalbazaar/bedrock-identity-rest/languages","stargazers_url":"https://api.github.com/repos/digitalbazaar/bedrock-identity-rest/stargazers","contributors_url":"https://api.github.com/repos/digitalbazaar/bedrock-identity-rest/contributors","subscribers_url":"https://api.github.com/repos/digitalbazaar/bedrock-identity-rest/subscribers","subscription_url":"https://api.github.com/repos/digitalbazaar/bedrock-identity-rest/subscription","commits_url":"https://api.github.com/repos/digitalbazaar/bedrock-identity-rest/commits{/sha}","git_commits_url":"https://api.github.com/repos/digitalbazaar/bedrock-identity-rest/git/commits{/sha}","comments_url":"https://api.github.com/repos/digitalbazaar/bedrock-identity-rest/comments{/number}","issue_comment_url":"https://api.github.com/repos/digitalbazaar/bedrock-identity-rest/issues/comments{/number}","contents_url":"https://api.github.com/repos/digitalbazaar/bedrock-identity-rest/contents/{+path}","compare_url":"https://api.github.com/repos/digitalbazaar/bedrock-identity-rest/compare/{base}...{head}","merges_url":"https://api.github.com/repos/digitalbazaar/bedrock-identity-rest/merges","archive_url":"https://api.github.com/repos/digitalbazaar/bedrock-identity-rest/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/digitalbazaar/bedrock-identity-rest/downloads","issues_url":"https://api.github.com/repos/digitalbazaar/bedrock-identity-rest/issues{/number}","pulls_url":"https://api.github.com/repos/digitalbazaar/bedrock-identity-rest/pulls{/number}","milestones_url":"https://api.github.com/repos/digitalbazaar/bedrock-identity-rest/milestones{/number}","notifications_url":"https://api.github.com/repos/digitalbazaar/bedrock-identity-rest/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/digitalbazaar/bedrock-identity-rest/labels{/name}","releases_url":"https://api.github.com/repos/digitalbazaar/bedrock-identity-rest/releases{/id}","deployments_url":"https://api.github.com/repos/digitalbazaar/bedrock-identity-rest/deployments","created_at":"2015-10-08T13:01:41Z","updated_at":"2016-01-31T23:06:54Z","pushed_at":"2016-04-26T17:49:54Z","git_url":"git://github.com/digitalbazaar/bedrock-identity-rest.git","ssh_url":"git@github.com:digitalbazaar/bedrock-identity-rest.git","clone_url":"https://github.com/digitalbazaar/bedrock-identity-rest.git","svn_url":"https://github.com/digitalbazaar/bedrock-identity-rest","homepage":null,"size":55,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":1,"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/digitalbazaar/bedrock-identity-rest/pulls/1"},"html":{"href":"https://github.com/digitalbazaar/bedrock-identity-rest/pull/1"},"issue":{"href":"https://api.github.com/repos/digitalbazaar/bedrock-identity-rest/issues/1"},"comments":{"href":"https://api.github.com/repos/digitalbazaar/bedrock-identity-rest/issues/1/comments"},"review_comments":{"href":"https://api.github.com/repos/digitalbazaar/bedrock-identity-rest/pulls/1/comments"},"review_comment":{"href":"https://api.github.com/repos/digitalbazaar/bedrock-identity-rest/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/digitalbazaar/bedrock-identity-rest/pulls/1/commits"},"statuses":{"href":"https://api.github.com/repos/digitalbazaar/bedrock-identity-rest/statuses/e02d87bff2d77c9a3ac94656a34794080617c67a"}}}}