{"action":"created","comment":{"url":"https://api.github.com/repos/ciscospark/spark-js-sdk/pulls/comments/144924201","pull_request_review_id":69648987,"id":144924201,"diff_hunk":"@@ -91,6 +91,89 @@ describe(`Encryption`, function() {\n         }));\n     });\n \n+    /**\n+     *Test getAuthorizationList function\n+     *Setup: Create a resource, then authorize a user to a key, then authorize a resource to a key\n+     *Test:\n+     *1)Invoke getAuthorizationList on the resource, verify that the function returns the array that contains two authorized items\n+     *2)Remove the authorized user from the resource, then invoke getAuthorizationList again, verify that the returned array doesn't have the user.\n+     *3)Remove the authorized resource from the resource again, then invoke getAuthorizationList again, verify that he returned array doesn't have the resource.\n+     */\n+    describe(`#getAuthorizationList()`, () => {\n+      let boundedKeyUri, kro, otherKro;\n+      const testUserId = mccoy.spark.internal.device.userId;\n+      let testResourceId;\n+\n+      before(`creates a resource`, () => spark.internal.encryption.kms.createUnboundKeys({count: 1})\n+        .then(([key]) => spark.internal.encryption.kms.createResource({\n+          key\n+        }))\n+        .then((k) => {\n+          kro = k;\n+          boundedKeyUri = kro.keyUris[0];\n+          assert.lengthOf(kro.authorizationUris, 1);\n+        }));\n+\n+      before(`authorizes a user to a key`, () => spark.internal.encryption.kms.addAuthorization({\n+        userIds: [testUserId],\n+        kroUri: kro.uri\n+      })\n+        .then(([auth]) => {\n+          assert.equal(auth.resourceUri, kro.uri);\n+          assert.equal(auth.authId, testUserId);\n+          return assert.isFulfilled(mccoy.spark.internal.encryption.kms.fetchKey({uri: boundedKeyUri}));\n+        }));\n+\n+      before(`authorizes a resource to a key`, () => spark.internal.encryption.kms.createUnboundKeys({count: 1})\n+        .then(([key]) => spark.internal.encryption.kms.createResource({key}))\n+        .then((k) => {\n+          otherKro = k;\n+          testResourceId = otherKro.uri;\n+          return spark.internal.encryption.kms.addAuthorization({\n+            authIds: [testResourceId],\n+            kro\n+          });\n+        })\n+        .then(([auth]) => {\n+          assert.equal(auth.resourceUri, kro.uri);\n+          assert.equal(auth.authId, otherKro.uri);\n+          return spark.internal.encryption.kms.getAuthorizationList({kroUri: kro.uri})\n+            .then((authIds) => {\n+              assert.equal(authIds.length, 2);\n+              assert.notEqual(authIds.indexOf(testUserId), -1);\n+              assert.notEqual(authIds.indexOf(testResourceId), -1);\n+            });\n+        }));\n+\n+\n+      it(`remove the user and verify this user is not in the authorization list `, () => spark.internal.encryption.kms.removeAuthorization({\n+        userId: testUserId,\n+        kroUri: kro.uri\n+      })\n+        .then(([auth]) => {\n+          assert.equal(auth.resourceUri, kro.uri);\n+          assert.equal(auth.authId, testUserId);\n+          return spark.internal.encryption.kms.getAuthorizationList({kroUri: kro.uri})\n+            .then((authIds) => {\n+              assert.equal(authIds.indexOf(testUserId), -1);\n+            });\n+        }));\n+\n+\n+      it(`remove the resource and verify this resource is not in the authorizaiton list`, () => spark.internal.encryption.kms.removeAuthorization({","path":"packages/node_modules/@ciscospark/internal-plugin-encryption/test/integration/spec/kms.js","position":73,"original_position":73,"commit_id":"1526b47e8c4dcaffb43d8e9d3767056f3fb5dcf0","original_commit_id":"1526b47e8c4dcaffb43d8e9d3767056f3fb5dcf0","user":{"login":"huichecisco","id":15214759,"avatar_url":"https://avatars1.githubusercontent.com/u/15214759?v=4","gravatar_id":"","url":"https://api.github.com/users/huichecisco","html_url":"https://github.com/huichecisco","followers_url":"https://api.github.com/users/huichecisco/followers","following_url":"https://api.github.com/users/huichecisco/following{/other_user}","gists_url":"https://api.github.com/users/huichecisco/gists{/gist_id}","starred_url":"https://api.github.com/users/huichecisco/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/huichecisco/subscriptions","organizations_url":"https://api.github.com/users/huichecisco/orgs","repos_url":"https://api.github.com/users/huichecisco/repos","events_url":"https://api.github.com/users/huichecisco/events{/privacy}","received_events_url":"https://api.github.com/users/huichecisco/received_events","type":"User","site_admin":false},"body":"One removes user from authorization list, another one  removes the resource from the resource from the authorization list.","created_at":"2017-10-16T18:08:54Z","updated_at":"2017-10-16T18:08:54Z","html_url":"https://github.com/ciscospark/spark-js-sdk/pull/724#discussion_r144924201","pull_request_url":"https://api.github.com/repos/ciscospark/spark-js-sdk/pulls/724","author_association":"NONE","_links":{"self":{"href":"https://api.github.com/repos/ciscospark/spark-js-sdk/pulls/comments/144924201"},"html":{"href":"https://github.com/ciscospark/spark-js-sdk/pull/724#discussion_r144924201"},"pull_request":{"href":"https://api.github.com/repos/ciscospark/spark-js-sdk/pulls/724"}},"in_reply_to_id":144890913},"pull_request":{"url":"https://api.github.com/repos/ciscospark/spark-js-sdk/pulls/724","id":146304247,"html_url":"https://github.com/ciscospark/spark-js-sdk/pull/724","diff_url":"https://github.com/ciscospark/spark-js-sdk/pull/724.diff","patch_url":"https://github.com/ciscospark/spark-js-sdk/pull/724.patch","issue_url":"https://api.github.com/repos/ciscospark/spark-js-sdk/issues/724","number":724,"state":"open","locked":false,"title":"feat(@ciscospark/i-p-encryption): get auth list of the resource","user":{"login":"huichecisco","id":15214759,"avatar_url":"https://avatars1.githubusercontent.com/u/15214759?v=4","gravatar_id":"","url":"https://api.github.com/users/huichecisco","html_url":"https://github.com/huichecisco","followers_url":"https://api.github.com/users/huichecisco/followers","following_url":"https://api.github.com/users/huichecisco/following{/other_user}","gists_url":"https://api.github.com/users/huichecisco/gists{/gist_id}","starred_url":"https://api.github.com/users/huichecisco/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/huichecisco/subscriptions","organizations_url":"https://api.github.com/users/huichecisco/orgs","repos_url":"https://api.github.com/users/huichecisco/repos","events_url":"https://api.github.com/users/huichecisco/events{/privacy}","received_events_url":"https://api.github.com/users/huichecisco/received_events","type":"User","site_admin":false},"body":"need to get authorization list of the resource, so we can authorize user to the resource if the user is not authorized, also only de-authorize the user that is authorized.","created_at":"2017-10-12T20:18:07Z","updated_at":"2017-10-16T18:08:54Z","closed_at":null,"merged_at":null,"merge_commit_sha":"40b50f517d4acf081fe23b374993fbf3f8d9a112","assignee":null,"assignees":[],"requested_reviewers":[],"milestone":null,"commits_url":"https://api.github.com/repos/ciscospark/spark-js-sdk/pulls/724/commits","review_comments_url":"https://api.github.com/repos/ciscospark/spark-js-sdk/pulls/724/comments","review_comment_url":"https://api.github.com/repos/ciscospark/spark-js-sdk/pulls/comments{/number}","comments_url":"https://api.github.com/repos/ciscospark/spark-js-sdk/issues/724/comments","statuses_url":"https://api.github.com/repos/ciscospark/spark-js-sdk/statuses/1526b47e8c4dcaffb43d8e9d3767056f3fb5dcf0","head":{"label":"huichecisco:tequila/getAuthListForKMSRes","ref":"tequila/getAuthListForKMSRes","sha":"1526b47e8c4dcaffb43d8e9d3767056f3fb5dcf0","user":{"login":"huichecisco","id":15214759,"avatar_url":"https://avatars1.githubusercontent.com/u/15214759?v=4","gravatar_id":"","url":"https://api.github.com/users/huichecisco","html_url":"https://github.com/huichecisco","followers_url":"https://api.github.com/users/huichecisco/followers","following_url":"https://api.github.com/users/huichecisco/following{/other_user}","gists_url":"https://api.github.com/users/huichecisco/gists{/gist_id}","starred_url":"https://api.github.com/users/huichecisco/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/huichecisco/subscriptions","organizations_url":"https://api.github.com/users/huichecisco/orgs","repos_url":"https://api.github.com/users/huichecisco/repos","events_url":"https://api.github.com/users/huichecisco/events{/privacy}","received_events_url":"https://api.github.com/users/huichecisco/received_events","type":"User","site_admin":false},"repo":{"id":106590237,"name":"spark-js-sdk","full_name":"huichecisco/spark-js-sdk","owner":{"login":"huichecisco","id":15214759,"avatar_url":"https://avatars1.githubusercontent.com/u/15214759?v=4","gravatar_id":"","url":"https://api.github.com/users/huichecisco","html_url":"https://github.com/huichecisco","followers_url":"https://api.github.com/users/huichecisco/followers","following_url":"https://api.github.com/users/huichecisco/following{/other_user}","gists_url":"https://api.github.com/users/huichecisco/gists{/gist_id}","starred_url":"https://api.github.com/users/huichecisco/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/huichecisco/subscriptions","organizations_url":"https://api.github.com/users/huichecisco/orgs","repos_url":"https://api.github.com/users/huichecisco/repos","events_url":"https://api.github.com/users/huichecisco/events{/privacy}","received_events_url":"https://api.github.com/users/huichecisco/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/huichecisco/spark-js-sdk","description":"JavaScript SDK for CiscoSpark","fork":true,"url":"https://api.github.com/repos/huichecisco/spark-js-sdk","forks_url":"https://api.github.com/repos/huichecisco/spark-js-sdk/forks","keys_url":"https://api.github.com/repos/huichecisco/spark-js-sdk/keys{/key_id}","collaborators_url":"https://api.github.com/repos/huichecisco/spark-js-sdk/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/huichecisco/spark-js-sdk/teams","hooks_url":"https://api.github.com/repos/huichecisco/spark-js-sdk/hooks","issue_events_url":"https://api.github.com/repos/huichecisco/spark-js-sdk/issues/events{/number}","events_url":"https://api.github.com/repos/huichecisco/spark-js-sdk/events","assignees_url":"https://api.github.com/repos/huichecisco/spark-js-sdk/assignees{/user}","branches_url":"https://api.github.com/repos/huichecisco/spark-js-sdk/branches{/branch}","tags_url":"https://api.github.com/repos/huichecisco/spark-js-sdk/tags","blobs_url":"https://api.github.com/repos/huichecisco/spark-js-sdk/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/huichecisco/spark-js-sdk/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/huichecisco/spark-js-sdk/git/refs{/sha}","trees_url":"https://api.github.com/repos/huichecisco/spark-js-sdk/git/trees{/sha}","statuses_url":"https://api.github.com/repos/huichecisco/spark-js-sdk/statuses/{sha}","languages_url":"https://api.github.com/repos/huichecisco/spark-js-sdk/languages","stargazers_url":"https://api.github.com/repos/huichecisco/spark-js-sdk/stargazers","contributors_url":"https://api.github.com/repos/huichecisco/spark-js-sdk/contributors","subscribers_url":"https://api.github.com/repos/huichecisco/spark-js-sdk/subscribers","subscription_url":"https://api.github.com/repos/huichecisco/spark-js-sdk/subscription","commits_url":"https://api.github.com/repos/huichecisco/spark-js-sdk/commits{/sha}","git_commits_url":"https://api.github.com/repos/huichecisco/spark-js-sdk/git/commits{/sha}","comments_url":"https://api.github.com/repos/huichecisco/spark-js-sdk/comments{/number}","issue_comment_url":"https://api.github.com/repos/huichecisco/spark-js-sdk/issues/comments{/number}","contents_url":"https://api.github.com/repos/huichecisco/spark-js-sdk/contents/{+path}","compare_url":"https://api.github.com/repos/huichecisco/spark-js-sdk/compare/{base}...{head}","merges_url":"https://api.github.com/repos/huichecisco/spark-js-sdk/merges","archive_url":"https://api.github.com/repos/huichecisco/spark-js-sdk/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/huichecisco/spark-js-sdk/downloads","issues_url":"https://api.github.com/repos/huichecisco/spark-js-sdk/issues{/number}","pulls_url":"https://api.github.com/repos/huichecisco/spark-js-sdk/pulls{/number}","milestones_url":"https://api.github.com/repos/huichecisco/spark-js-sdk/milestones{/number}","notifications_url":"https://api.github.com/repos/huichecisco/spark-js-sdk/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/huichecisco/spark-js-sdk/labels{/name}","releases_url":"https://api.github.com/repos/huichecisco/spark-js-sdk/releases{/id}","deployments_url":"https://api.github.com/repos/huichecisco/spark-js-sdk/deployments","created_at":"2017-10-11T18:01:12Z","updated_at":"2017-10-11T18:01:14Z","pushed_at":"2017-10-13T21:40:06Z","git_url":"git://github.com/huichecisco/spark-js-sdk.git","ssh_url":"git@github.com:huichecisco/spark-js-sdk.git","clone_url":"https://github.com/huichecisco/spark-js-sdk.git","svn_url":"https://github.com/huichecisco/spark-js-sdk","homepage":"https://ciscospark.github.io/spark-js-sdk/","size":41008,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":false,"has_projects":true,"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":"ciscospark:master","ref":"master","sha":"b8ccebc8afaa79a0f6a9a195c63b01d31f7b66e4","user":{"login":"ciscospark","id":15900782,"avatar_url":"https://avatars0.githubusercontent.com/u/15900782?v=4","gravatar_id":"","url":"https://api.github.com/users/ciscospark","html_url":"https://github.com/ciscospark","followers_url":"https://api.github.com/users/ciscospark/followers","following_url":"https://api.github.com/users/ciscospark/following{/other_user}","gists_url":"https://api.github.com/users/ciscospark/gists{/gist_id}","starred_url":"https://api.github.com/users/ciscospark/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ciscospark/subscriptions","organizations_url":"https://api.github.com/users/ciscospark/orgs","repos_url":"https://api.github.com/users/ciscospark/repos","events_url":"https://api.github.com/users/ciscospark/events{/privacy}","received_events_url":"https://api.github.com/users/ciscospark/received_events","type":"Organization","site_admin":false},"repo":{"id":62836827,"name":"spark-js-sdk","full_name":"ciscospark/spark-js-sdk","owner":{"login":"ciscospark","id":15900782,"avatar_url":"https://avatars0.githubusercontent.com/u/15900782?v=4","gravatar_id":"","url":"https://api.github.com/users/ciscospark","html_url":"https://github.com/ciscospark","followers_url":"https://api.github.com/users/ciscospark/followers","following_url":"https://api.github.com/users/ciscospark/following{/other_user}","gists_url":"https://api.github.com/users/ciscospark/gists{/gist_id}","starred_url":"https://api.github.com/users/ciscospark/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ciscospark/subscriptions","organizations_url":"https://api.github.com/users/ciscospark/orgs","repos_url":"https://api.github.com/users/ciscospark/repos","events_url":"https://api.github.com/users/ciscospark/events{/privacy}","received_events_url":"https://api.github.com/users/ciscospark/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/ciscospark/spark-js-sdk","description":"JavaScript SDK for CiscoSpark","fork":false,"url":"https://api.github.com/repos/ciscospark/spark-js-sdk","forks_url":"https://api.github.com/repos/ciscospark/spark-js-sdk/forks","keys_url":"https://api.github.com/repos/ciscospark/spark-js-sdk/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ciscospark/spark-js-sdk/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ciscospark/spark-js-sdk/teams","hooks_url":"https://api.github.com/repos/ciscospark/spark-js-sdk/hooks","issue_events_url":"https://api.github.com/repos/ciscospark/spark-js-sdk/issues/events{/number}","events_url":"https://api.github.com/repos/ciscospark/spark-js-sdk/events","assignees_url":"https://api.github.com/repos/ciscospark/spark-js-sdk/assignees{/user}","branches_url":"https://api.github.com/repos/ciscospark/spark-js-sdk/branches{/branch}","tags_url":"https://api.github.com/repos/ciscospark/spark-js-sdk/tags","blobs_url":"https://api.github.com/repos/ciscospark/spark-js-sdk/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ciscospark/spark-js-sdk/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ciscospark/spark-js-sdk/git/refs{/sha}","trees_url":"https://api.github.com/repos/ciscospark/spark-js-sdk/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ciscospark/spark-js-sdk/statuses/{sha}","languages_url":"https://api.github.com/repos/ciscospark/spark-js-sdk/languages","stargazers_url":"https://api.github.com/repos/ciscospark/spark-js-sdk/stargazers","contributors_url":"https://api.github.com/repos/ciscospark/spark-js-sdk/contributors","subscribers_url":"https://api.github.com/repos/ciscospark/spark-js-sdk/subscribers","subscription_url":"https://api.github.com/repos/ciscospark/spark-js-sdk/subscription","commits_url":"https://api.github.com/repos/ciscospark/spark-js-sdk/commits{/sha}","git_commits_url":"https://api.github.com/repos/ciscospark/spark-js-sdk/git/commits{/sha}","comments_url":"https://api.github.com/repos/ciscospark/spark-js-sdk/comments{/number}","issue_comment_url":"https://api.github.com/repos/ciscospark/spark-js-sdk/issues/comments{/number}","contents_url":"https://api.github.com/repos/ciscospark/spark-js-sdk/contents/{+path}","compare_url":"https://api.github.com/repos/ciscospark/spark-js-sdk/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ciscospark/spark-js-sdk/merges","archive_url":"https://api.github.com/repos/ciscospark/spark-js-sdk/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ciscospark/spark-js-sdk/downloads","issues_url":"https://api.github.com/repos/ciscospark/spark-js-sdk/issues{/number}","pulls_url":"https://api.github.com/repos/ciscospark/spark-js-sdk/pulls{/number}","milestones_url":"https://api.github.com/repos/ciscospark/spark-js-sdk/milestones{/number}","notifications_url":"https://api.github.com/repos/ciscospark/spark-js-sdk/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ciscospark/spark-js-sdk/labels{/name}","releases_url":"https://api.github.com/repos/ciscospark/spark-js-sdk/releases{/id}","deployments_url":"https://api.github.com/repos/ciscospark/spark-js-sdk/deployments","created_at":"2016-07-07T20:41:12Z","updated_at":"2017-10-03T00:21:48Z","pushed_at":"2017-10-16T17:29:48Z","git_url":"git://github.com/ciscospark/spark-js-sdk.git","ssh_url":"git@github.com:ciscospark/spark-js-sdk.git","clone_url":"https://github.com/ciscospark/spark-js-sdk.git","svn_url":"https://github.com/ciscospark/spark-js-sdk","homepage":"https://ciscospark.github.io/spark-js-sdk/","size":41001,"stargazers_count":40,"watchers_count":40,"language":"JavaScript","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":61,"mirror_url":null,"open_issues_count":112,"forks":61,"open_issues":112,"watchers":40,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/ciscospark/spark-js-sdk/pulls/724"},"html":{"href":"https://github.com/ciscospark/spark-js-sdk/pull/724"},"issue":{"href":"https://api.github.com/repos/ciscospark/spark-js-sdk/issues/724"},"comments":{"href":"https://api.github.com/repos/ciscospark/spark-js-sdk/issues/724/comments"},"review_comments":{"href":"https://api.github.com/repos/ciscospark/spark-js-sdk/pulls/724/comments"},"review_comment":{"href":"https://api.github.com/repos/ciscospark/spark-js-sdk/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/ciscospark/spark-js-sdk/pulls/724/commits"},"statuses":{"href":"https://api.github.com/repos/ciscospark/spark-js-sdk/statuses/1526b47e8c4dcaffb43d8e9d3767056f3fb5dcf0"}},"author_association":"NONE"}}
{"actor":{"display_login":"huichecisco"}}