{"action":"created","comment":{"url":"https://api.github.com/repos/Harvard-University-iCommons/canvas_account_admin_tools/pulls/comments/49601154","id":49601154,"diff_hunk":"@@ -33,26 +45,15 @@ def get_administered_school_accounts(canvas_user_id, allowed_roles=ADMINISTRATOR\n         for account in assigned_accounts:\n             admins = get_all_list_data(SDK_CONTEXT, list_account_admins,\n                                        account['id'], user_id=canvas_user_id)\n+\n             if allowed_roles.intersection({a['role'] for a in admins}):\n                 allowed_accounts[account['id']] = account\n \n-        # now that we know which accounts pass the permissions tests, pull in\n-        # their child accounts\n-        all_accounts = {}\n-        for id_ in sorted(allowed_accounts):\n-            if id_ in all_accounts:\n-                # we've already found this account and its children by way of\n-                # a parent account.  no need to check for this account again.\n-                continue\n-\n-            all_accounts[id_] = allowed_accounts[id_]\n-            subaccounts = get_all_list_data(\n-                              SDK_CONTEXT, get_sub_accounts_of_account, id_,\n-                              recursive=True, as_user_id=canvas_user_id)\n-            all_accounts.update({s['id']: s for s in subaccounts})\n-\n-        # filter down to just school accounts\n-        school_accounts = filter(lambda a: (a.get('sis_account_id') or '').startswith('school'),\n-                                 all_accounts.values())\n+        # filter out the accounts where the user does not have the proper permissions\n+        school_accounts = []\n+        for k, v in all_school_accounts.iteritems():\n+            if k in allowed_accounts.keys():","path":"course_info/canvas.py","position":48,"original_position":48,"commit_id":"37d064a2c8712ff877db40a19dfe5b7da564806c","original_commit_id":"37d064a2c8712ff877db40a19dfe5b7da564806c","user":{"login":"eparker71","id":1084287,"avatar_url":"https://avatars.githubusercontent.com/u/1084287?v=3","gravatar_id":"","url":"https://api.github.com/users/eparker71","html_url":"https://github.com/eparker71","followers_url":"https://api.github.com/users/eparker71/followers","following_url":"https://api.github.com/users/eparker71/following{/other_user}","gists_url":"https://api.github.com/users/eparker71/gists{/gist_id}","starred_url":"https://api.github.com/users/eparker71/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/eparker71/subscriptions","organizations_url":"https://api.github.com/users/eparker71/orgs","repos_url":"https://api.github.com/users/eparker71/repos","events_url":"https://api.github.com/users/eparker71/events{/privacy}","received_events_url":"https://api.github.com/users/eparker71/received_events","type":"User","site_admin":false},"body":"cool, one less call","created_at":"2016-01-13T15:10:08Z","updated_at":"2016-01-13T15:10:08Z","html_url":"https://github.com/Harvard-University-iCommons/canvas_account_admin_tools/pull/47#discussion_r49601154","pull_request_url":"https://api.github.com/repos/Harvard-University-iCommons/canvas_account_admin_tools/pulls/47","_links":{"self":{"href":"https://api.github.com/repos/Harvard-University-iCommons/canvas_account_admin_tools/pulls/comments/49601154"},"html":{"href":"https://github.com/Harvard-University-iCommons/canvas_account_admin_tools/pull/47#discussion_r49601154"},"pull_request":{"href":"https://api.github.com/repos/Harvard-University-iCommons/canvas_account_admin_tools/pulls/47"}}},"pull_request":{"url":"https://api.github.com/repos/Harvard-University-iCommons/canvas_account_admin_tools/pulls/47","id":55825982,"html_url":"https://github.com/Harvard-University-iCommons/canvas_account_admin_tools/pull/47","diff_url":"https://github.com/Harvard-University-iCommons/canvas_account_admin_tools/pull/47.diff","patch_url":"https://github.com/Harvard-University-iCommons/canvas_account_admin_tools/pull/47.patch","issue_url":"https://api.github.com/repos/Harvard-University-iCommons/canvas_account_admin_tools/issues/47","number":47,"state":"closed","locked":false,"title":"fixed for getting school list where user cannot see sis_account_id","user":{"login":"eparker71","id":1084287,"avatar_url":"https://avatars.githubusercontent.com/u/1084287?v=3","gravatar_id":"","url":"https://api.github.com/users/eparker71","html_url":"https://github.com/eparker71","followers_url":"https://api.github.com/users/eparker71/followers","following_url":"https://api.github.com/users/eparker71/following{/other_user}","gists_url":"https://api.github.com/users/eparker71/gists{/gist_id}","starred_url":"https://api.github.com/users/eparker71/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/eparker71/subscriptions","organizations_url":"https://api.github.com/users/eparker71/orgs","repos_url":"https://api.github.com/users/eparker71/repos","events_url":"https://api.github.com/users/eparker71/events{/privacy}","received_events_url":"https://api.github.com/users/eparker71/received_events","type":"User","site_admin":false},"body":"get a list of all the accounts\r\nget a list of the accounts the user can see (they won't contain the sis_account_id)\r\nuse the user list to filter out the accounts from the all accounts list so it only contains the accounts the user has access to.","created_at":"2016-01-12T22:19:05Z","updated_at":"2016-01-13T15:10:08Z","closed_at":"2016-01-13T13:43:05Z","merged_at":"2016-01-13T13:43:05Z","merge_commit_sha":"c1de147dcd0bc5bdd960186b7c95eb969297bfd2","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/Harvard-University-iCommons/canvas_account_admin_tools/pulls/47/commits","review_comments_url":"https://api.github.com/repos/Harvard-University-iCommons/canvas_account_admin_tools/pulls/47/comments","review_comment_url":"https://api.github.com/repos/Harvard-University-iCommons/canvas_account_admin_tools/pulls/comments{/number}","comments_url":"https://api.github.com/repos/Harvard-University-iCommons/canvas_account_admin_tools/issues/47/comments","statuses_url":"https://api.github.com/repos/Harvard-University-iCommons/canvas_account_admin_tools/statuses/37d064a2c8712ff877db40a19dfe5b7da564806c","head":{"label":"Harvard-University-iCommons:task/eparker71/TLT-2321-add-LTI-permissions-to-account-admin","ref":"task/eparker71/TLT-2321-add-LTI-permissions-to-account-admin","sha":"37d064a2c8712ff877db40a19dfe5b7da564806c","user":{"login":"Harvard-University-iCommons","id":1083915,"avatar_url":"https://avatars.githubusercontent.com/u/1083915?v=3","gravatar_id":"","url":"https://api.github.com/users/Harvard-University-iCommons","html_url":"https://github.com/Harvard-University-iCommons","followers_url":"https://api.github.com/users/Harvard-University-iCommons/followers","following_url":"https://api.github.com/users/Harvard-University-iCommons/following{/other_user}","gists_url":"https://api.github.com/users/Harvard-University-iCommons/gists{/gist_id}","starred_url":"https://api.github.com/users/Harvard-University-iCommons/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Harvard-University-iCommons/subscriptions","organizations_url":"https://api.github.com/users/Harvard-University-iCommons/orgs","repos_url":"https://api.github.com/users/Harvard-University-iCommons/repos","events_url":"https://api.github.com/users/Harvard-University-iCommons/events{/privacy}","received_events_url":"https://api.github.com/users/Harvard-University-iCommons/received_events","type":"Organization","site_admin":false},"repo":{"id":43321944,"name":"canvas_account_admin_tools","full_name":"Harvard-University-iCommons/canvas_account_admin_tools","owner":{"login":"Harvard-University-iCommons","id":1083915,"avatar_url":"https://avatars.githubusercontent.com/u/1083915?v=3","gravatar_id":"","url":"https://api.github.com/users/Harvard-University-iCommons","html_url":"https://github.com/Harvard-University-iCommons","followers_url":"https://api.github.com/users/Harvard-University-iCommons/followers","following_url":"https://api.github.com/users/Harvard-University-iCommons/following{/other_user}","gists_url":"https://api.github.com/users/Harvard-University-iCommons/gists{/gist_id}","starred_url":"https://api.github.com/users/Harvard-University-iCommons/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Harvard-University-iCommons/subscriptions","organizations_url":"https://api.github.com/users/Harvard-University-iCommons/orgs","repos_url":"https://api.github.com/users/Harvard-University-iCommons/repos","events_url":"https://api.github.com/users/Harvard-University-iCommons/events{/privacy}","received_events_url":"https://api.github.com/users/Harvard-University-iCommons/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/Harvard-University-iCommons/canvas_account_admin_tools","description":"","fork":false,"url":"https://api.github.com/repos/Harvard-University-iCommons/canvas_account_admin_tools","forks_url":"https://api.github.com/repos/Harvard-University-iCommons/canvas_account_admin_tools/forks","keys_url":"https://api.github.com/repos/Harvard-University-iCommons/canvas_account_admin_tools/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Harvard-University-iCommons/canvas_account_admin_tools/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Harvard-University-iCommons/canvas_account_admin_tools/teams","hooks_url":"https://api.github.com/repos/Harvard-University-iCommons/canvas_account_admin_tools/hooks","issue_events_url":"https://api.github.com/repos/Harvard-University-iCommons/canvas_account_admin_tools/issues/events{/number}","events_url":"https://api.github.com/repos/Harvard-University-iCommons/canvas_account_admin_tools/events","assignees_url":"https://api.github.com/repos/Harvard-University-iCommons/canvas_account_admin_tools/assignees{/user}","branches_url":"https://api.github.com/repos/Harvard-University-iCommons/canvas_account_admin_tools/branches{/branch}","tags_url":"https://api.github.com/repos/Harvard-University-iCommons/canvas_account_admin_tools/tags","blobs_url":"https://api.github.com/repos/Harvard-University-iCommons/canvas_account_admin_tools/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Harvard-University-iCommons/canvas_account_admin_tools/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Harvard-University-iCommons/canvas_account_admin_tools/git/refs{/sha}","trees_url":"https://api.github.com/repos/Harvard-University-iCommons/canvas_account_admin_tools/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Harvard-University-iCommons/canvas_account_admin_tools/statuses/{sha}","languages_url":"https://api.github.com/repos/Harvard-University-iCommons/canvas_account_admin_tools/languages","stargazers_url":"https://api.github.com/repos/Harvard-University-iCommons/canvas_account_admin_tools/stargazers","contributors_url":"https://api.github.com/repos/Harvard-University-iCommons/canvas_account_admin_tools/contributors","subscribers_url":"https://api.github.com/repos/Harvard-University-iCommons/canvas_account_admin_tools/subscribers","subscription_url":"https://api.github.com/repos/Harvard-University-iCommons/canvas_account_admin_tools/subscription","commits_url":"https://api.github.com/repos/Harvard-University-iCommons/canvas_account_admin_tools/commits{/sha}","git_commits_url":"https://api.github.com/repos/Harvard-University-iCommons/canvas_account_admin_tools/git/commits{/sha}","comments_url":"https://api.github.com/repos/Harvard-University-iCommons/canvas_account_admin_tools/comments{/number}","issue_comment_url":"https://api.github.com/repos/Harvard-University-iCommons/canvas_account_admin_tools/issues/comments{/number}","contents_url":"https://api.github.com/repos/Harvard-University-iCommons/canvas_account_admin_tools/contents/{+path}","compare_url":"https://api.github.com/repos/Harvard-University-iCommons/canvas_account_admin_tools/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Harvard-University-iCommons/canvas_account_admin_tools/merges","archive_url":"https://api.github.com/repos/Harvard-University-iCommons/canvas_account_admin_tools/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Harvard-University-iCommons/canvas_account_admin_tools/downloads","issues_url":"https://api.github.com/repos/Harvard-University-iCommons/canvas_account_admin_tools/issues{/number}","pulls_url":"https://api.github.com/repos/Harvard-University-iCommons/canvas_account_admin_tools/pulls{/number}","milestones_url":"https://api.github.com/repos/Harvard-University-iCommons/canvas_account_admin_tools/milestones{/number}","notifications_url":"https://api.github.com/repos/Harvard-University-iCommons/canvas_account_admin_tools/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Harvard-University-iCommons/canvas_account_admin_tools/labels{/name}","releases_url":"https://api.github.com/repos/Harvard-University-iCommons/canvas_account_admin_tools/releases{/id}","created_at":"2015-09-28T19:25:52Z","updated_at":"2016-01-11T20:30:35Z","pushed_at":"2016-01-13T14:01:01Z","git_url":"git://github.com/Harvard-University-iCommons/canvas_account_admin_tools.git","ssh_url":"git@github.com:Harvard-University-iCommons/canvas_account_admin_tools.git","clone_url":"https://github.com/Harvard-University-iCommons/canvas_account_admin_tools.git","svn_url":"https://github.com/Harvard-University-iCommons/canvas_account_admin_tools","homepage":null,"size":331,"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":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"develop"}},"base":{"label":"Harvard-University-iCommons:develop","ref":"develop","sha":"d35859de866a0f60b1e9adc780d5df88347f0cfe","user":{"login":"Harvard-University-iCommons","id":1083915,"avatar_url":"https://avatars.githubusercontent.com/u/1083915?v=3","gravatar_id":"","url":"https://api.github.com/users/Harvard-University-iCommons","html_url":"https://github.com/Harvard-University-iCommons","followers_url":"https://api.github.com/users/Harvard-University-iCommons/followers","following_url":"https://api.github.com/users/Harvard-University-iCommons/following{/other_user}","gists_url":"https://api.github.com/users/Harvard-University-iCommons/gists{/gist_id}","starred_url":"https://api.github.com/users/Harvard-University-iCommons/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Harvard-University-iCommons/subscriptions","organizations_url":"https://api.github.com/users/Harvard-University-iCommons/orgs","repos_url":"https://api.github.com/users/Harvard-University-iCommons/repos","events_url":"https://api.github.com/users/Harvard-University-iCommons/events{/privacy}","received_events_url":"https://api.github.com/users/Harvard-University-iCommons/received_events","type":"Organization","site_admin":false},"repo":{"id":43321944,"name":"canvas_account_admin_tools","full_name":"Harvard-University-iCommons/canvas_account_admin_tools","owner":{"login":"Harvard-University-iCommons","id":1083915,"avatar_url":"https://avatars.githubusercontent.com/u/1083915?v=3","gravatar_id":"","url":"https://api.github.com/users/Harvard-University-iCommons","html_url":"https://github.com/Harvard-University-iCommons","followers_url":"https://api.github.com/users/Harvard-University-iCommons/followers","following_url":"https://api.github.com/users/Harvard-University-iCommons/following{/other_user}","gists_url":"https://api.github.com/users/Harvard-University-iCommons/gists{/gist_id}","starred_url":"https://api.github.com/users/Harvard-University-iCommons/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Harvard-University-iCommons/subscriptions","organizations_url":"https://api.github.com/users/Harvard-University-iCommons/orgs","repos_url":"https://api.github.com/users/Harvard-University-iCommons/repos","events_url":"https://api.github.com/users/Harvard-University-iCommons/events{/privacy}","received_events_url":"https://api.github.com/users/Harvard-University-iCommons/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/Harvard-University-iCommons/canvas_account_admin_tools","description":"","fork":false,"url":"https://api.github.com/repos/Harvard-University-iCommons/canvas_account_admin_tools","forks_url":"https://api.github.com/repos/Harvard-University-iCommons/canvas_account_admin_tools/forks","keys_url":"https://api.github.com/repos/Harvard-University-iCommons/canvas_account_admin_tools/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Harvard-University-iCommons/canvas_account_admin_tools/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Harvard-University-iCommons/canvas_account_admin_tools/teams","hooks_url":"https://api.github.com/repos/Harvard-University-iCommons/canvas_account_admin_tools/hooks","issue_events_url":"https://api.github.com/repos/Harvard-University-iCommons/canvas_account_admin_tools/issues/events{/number}","events_url":"https://api.github.com/repos/Harvard-University-iCommons/canvas_account_admin_tools/events","assignees_url":"https://api.github.com/repos/Harvard-University-iCommons/canvas_account_admin_tools/assignees{/user}","branches_url":"https://api.github.com/repos/Harvard-University-iCommons/canvas_account_admin_tools/branches{/branch}","tags_url":"https://api.github.com/repos/Harvard-University-iCommons/canvas_account_admin_tools/tags","blobs_url":"https://api.github.com/repos/Harvard-University-iCommons/canvas_account_admin_tools/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Harvard-University-iCommons/canvas_account_admin_tools/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Harvard-University-iCommons/canvas_account_admin_tools/git/refs{/sha}","trees_url":"https://api.github.com/repos/Harvard-University-iCommons/canvas_account_admin_tools/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Harvard-University-iCommons/canvas_account_admin_tools/statuses/{sha}","languages_url":"https://api.github.com/repos/Harvard-University-iCommons/canvas_account_admin_tools/languages","stargazers_url":"https://api.github.com/repos/Harvard-University-iCommons/canvas_account_admin_tools/stargazers","contributors_url":"https://api.github.com/repos/Harvard-University-iCommons/canvas_account_admin_tools/contributors","subscribers_url":"https://api.github.com/repos/Harvard-University-iCommons/canvas_account_admin_tools/subscribers","subscription_url":"https://api.github.com/repos/Harvard-University-iCommons/canvas_account_admin_tools/subscription","commits_url":"https://api.github.com/repos/Harvard-University-iCommons/canvas_account_admin_tools/commits{/sha}","git_commits_url":"https://api.github.com/repos/Harvard-University-iCommons/canvas_account_admin_tools/git/commits{/sha}","comments_url":"https://api.github.com/repos/Harvard-University-iCommons/canvas_account_admin_tools/comments{/number}","issue_comment_url":"https://api.github.com/repos/Harvard-University-iCommons/canvas_account_admin_tools/issues/comments{/number}","contents_url":"https://api.github.com/repos/Harvard-University-iCommons/canvas_account_admin_tools/contents/{+path}","compare_url":"https://api.github.com/repos/Harvard-University-iCommons/canvas_account_admin_tools/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Harvard-University-iCommons/canvas_account_admin_tools/merges","archive_url":"https://api.github.com/repos/Harvard-University-iCommons/canvas_account_admin_tools/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Harvard-University-iCommons/canvas_account_admin_tools/downloads","issues_url":"https://api.github.com/repos/Harvard-University-iCommons/canvas_account_admin_tools/issues{/number}","pulls_url":"https://api.github.com/repos/Harvard-University-iCommons/canvas_account_admin_tools/pulls{/number}","milestones_url":"https://api.github.com/repos/Harvard-University-iCommons/canvas_account_admin_tools/milestones{/number}","notifications_url":"https://api.github.com/repos/Harvard-University-iCommons/canvas_account_admin_tools/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Harvard-University-iCommons/canvas_account_admin_tools/labels{/name}","releases_url":"https://api.github.com/repos/Harvard-University-iCommons/canvas_account_admin_tools/releases{/id}","created_at":"2015-09-28T19:25:52Z","updated_at":"2016-01-11T20:30:35Z","pushed_at":"2016-01-13T14:01:01Z","git_url":"git://github.com/Harvard-University-iCommons/canvas_account_admin_tools.git","ssh_url":"git@github.com:Harvard-University-iCommons/canvas_account_admin_tools.git","clone_url":"https://github.com/Harvard-University-iCommons/canvas_account_admin_tools.git","svn_url":"https://github.com/Harvard-University-iCommons/canvas_account_admin_tools","homepage":null,"size":331,"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":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"develop"}},"_links":{"self":{"href":"https://api.github.com/repos/Harvard-University-iCommons/canvas_account_admin_tools/pulls/47"},"html":{"href":"https://github.com/Harvard-University-iCommons/canvas_account_admin_tools/pull/47"},"issue":{"href":"https://api.github.com/repos/Harvard-University-iCommons/canvas_account_admin_tools/issues/47"},"comments":{"href":"https://api.github.com/repos/Harvard-University-iCommons/canvas_account_admin_tools/issues/47/comments"},"review_comments":{"href":"https://api.github.com/repos/Harvard-University-iCommons/canvas_account_admin_tools/pulls/47/comments"},"review_comment":{"href":"https://api.github.com/repos/Harvard-University-iCommons/canvas_account_admin_tools/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/Harvard-University-iCommons/canvas_account_admin_tools/pulls/47/commits"},"statuses":{"href":"https://api.github.com/repos/Harvard-University-iCommons/canvas_account_admin_tools/statuses/37d064a2c8712ff877db40a19dfe5b7da564806c"}}}}