{"action":"created","comment":{"url":"https://api.github.com/repos/learningequality/kolibri/pulls/comments/62070386","id":62070386,"diff_hunk":"@@ -145,6 +150,9 @@ def _user_is_admin_for_own_facility(self, user, obj=None):\n         # import here to avoid circular imports\n         from ..models import Facility\n \n+        if not hasattr(user, \"dataset\"):\n+            return False\n+","path":"kolibri/auth/permissions/general.py","position":27,"original_position":27,"commit_id":"df0b08ef205f4af8e81f5d53fdde8719d5f92767","original_commit_id":"df0b08ef205f4af8e81f5d53fdde8719d5f92767","user":{"login":"jamalex","id":618416,"avatar_url":"https://avatars.githubusercontent.com/u/618416?v=3","gravatar_id":"","url":"https://api.github.com/users/jamalex","html_url":"https://github.com/jamalex","followers_url":"https://api.github.com/users/jamalex/followers","following_url":"https://api.github.com/users/jamalex/following{/other_user}","gists_url":"https://api.github.com/users/jamalex/gists{/gist_id}","starred_url":"https://api.github.com/users/jamalex/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jamalex/subscriptions","organizations_url":"https://api.github.com/users/jamalex/orgs","repos_url":"https://api.github.com/users/jamalex/repos","events_url":"https://api.github.com/users/jamalex/events{/privacy}","received_events_url":"https://api.github.com/users/jamalex/received_events","type":"User","site_admin":false},"body":"These changes are to get them to play better with anon users.","created_at":"2016-05-04T16:27:26Z","updated_at":"2016-05-04T16:27:26Z","html_url":"https://github.com/learningequality/kolibri/pull/67#discussion_r62070386","pull_request_url":"https://api.github.com/repos/learningequality/kolibri/pulls/67","_links":{"self":{"href":"https://api.github.com/repos/learningequality/kolibri/pulls/comments/62070386"},"html":{"href":"https://github.com/learningequality/kolibri/pull/67#discussion_r62070386"},"pull_request":{"href":"https://api.github.com/repos/learningequality/kolibri/pulls/67"}}},"pull_request":{"url":"https://api.github.com/repos/learningequality/kolibri/pulls/67","id":68890582,"html_url":"https://github.com/learningequality/kolibri/pull/67","diff_url":"https://github.com/learningequality/kolibri/pull/67.diff","patch_url":"https://github.com/learningequality/kolibri/pull/67.patch","issue_url":"https://api.github.com/repos/learningequality/kolibri/issues/67","number":67,"state":"open","locked":false,"title":"Django REST framework API for auth app, including wrapper for permissions","user":{"login":"jamalex","id":618416,"avatar_url":"https://avatars.githubusercontent.com/u/618416?v=3","gravatar_id":"","url":"https://api.github.com/users/jamalex","html_url":"https://github.com/jamalex","followers_url":"https://api.github.com/users/jamalex/followers","following_url":"https://api.github.com/users/jamalex/following{/other_user}","gists_url":"https://api.github.com/users/jamalex/gists{/gist_id}","starred_url":"https://api.github.com/users/jamalex/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jamalex/subscriptions","organizations_url":"https://api.github.com/users/jamalex/orgs","repos_url":"https://api.github.com/users/jamalex/repos","events_url":"https://api.github.com/users/jamalex/events{/privacy}","received_events_url":"https://api.github.com/users/jamalex/received_events","type":"User","site_admin":false},"body":"## Summary\r\n\r\n- Added wrappers for the `kolibri.auth` permissions system to allow it to be easily used in Django REST Framework\r\n- Added the main Django REST Framework API endpoints for the `auth` app models\r\n- Added a `KolibriAnonymousUser` model that exposes our `KolibriAbstractBaseUser` interface, so we can check permissions on unauthenticated users\r\n\r\n## TODO\r\n\r\n- [ ] Have tests been written for the new code?\r\n- [ ] Has documentation been written/updated?\r\n- [x] New dependencies (if any) added to requirements file\r\n\r\n## Reviewer guidance\r\n\r\nI have followed a fairly standard approach to organizing the various DRF pieces (serializer classes in `serializers.py`, viewsets in `api.py`, and routers in `urls.py`), but we should think about how we want to do that in a consistent way across apps (might be different from what I did here).\r\n\r\nI also haven't done any customization or made any calls here about how we handle things like related models (e.g. hyperlinking foreign keys), as I think that will become clearer once we better understand how we'll be handling state in Vue.js.\r\n\r\n## Documentation\r\n\r\nComing soon.\r\n\r\n## Screenshots (if appropriate)\r\n\r\n![image](https://cloud.githubusercontent.com/assets/618416/15020863/c740aee0-11d8-11e6-9b07-78158e367ae5.png)\r\n\r\n![image](https://cloud.githubusercontent.com/assets/618416/15020987/4b165490-11d9-11e6-9f24-9e7330a5d164.png)\r\n","created_at":"2016-05-04T16:20:24Z","updated_at":"2016-05-04T16:27:26Z","closed_at":null,"merged_at":null,"merge_commit_sha":"116c00d0665d0b9965cdd1a0874c394e28d35372","assignee":{"login":"MCGallaspy","id":8888020,"avatar_url":"https://avatars.githubusercontent.com/u/8888020?v=3","gravatar_id":"","url":"https://api.github.com/users/MCGallaspy","html_url":"https://github.com/MCGallaspy","followers_url":"https://api.github.com/users/MCGallaspy/followers","following_url":"https://api.github.com/users/MCGallaspy/following{/other_user}","gists_url":"https://api.github.com/users/MCGallaspy/gists{/gist_id}","starred_url":"https://api.github.com/users/MCGallaspy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MCGallaspy/subscriptions","organizations_url":"https://api.github.com/users/MCGallaspy/orgs","repos_url":"https://api.github.com/users/MCGallaspy/repos","events_url":"https://api.github.com/users/MCGallaspy/events{/privacy}","received_events_url":"https://api.github.com/users/MCGallaspy/received_events","type":"User","site_admin":false},"milestone":null,"commits_url":"https://api.github.com/repos/learningequality/kolibri/pulls/67/commits","review_comments_url":"https://api.github.com/repos/learningequality/kolibri/pulls/67/comments","review_comment_url":"https://api.github.com/repos/learningequality/kolibri/pulls/comments{/number}","comments_url":"https://api.github.com/repos/learningequality/kolibri/issues/67/comments","statuses_url":"https://api.github.com/repos/learningequality/kolibri/statuses/df0b08ef205f4af8e81f5d53fdde8719d5f92767","head":{"label":"jamalex:uap_api","ref":"uap_api","sha":"df0b08ef205f4af8e81f5d53fdde8719d5f92767","user":{"login":"jamalex","id":618416,"avatar_url":"https://avatars.githubusercontent.com/u/618416?v=3","gravatar_id":"","url":"https://api.github.com/users/jamalex","html_url":"https://github.com/jamalex","followers_url":"https://api.github.com/users/jamalex/followers","following_url":"https://api.github.com/users/jamalex/following{/other_user}","gists_url":"https://api.github.com/users/jamalex/gists{/gist_id}","starred_url":"https://api.github.com/users/jamalex/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jamalex/subscriptions","organizations_url":"https://api.github.com/users/jamalex/orgs","repos_url":"https://api.github.com/users/jamalex/repos","events_url":"https://api.github.com/users/jamalex/events{/privacy}","received_events_url":"https://api.github.com/users/jamalex/received_events","type":"User","site_admin":false},"repo":{"id":51463055,"name":"kolibri","full_name":"jamalex/kolibri","owner":{"login":"jamalex","id":618416,"avatar_url":"https://avatars.githubusercontent.com/u/618416?v=3","gravatar_id":"","url":"https://api.github.com/users/jamalex","html_url":"https://github.com/jamalex","followers_url":"https://api.github.com/users/jamalex/followers","following_url":"https://api.github.com/users/jamalex/following{/other_user}","gists_url":"https://api.github.com/users/jamalex/gists{/gist_id}","starred_url":"https://api.github.com/users/jamalex/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jamalex/subscriptions","organizations_url":"https://api.github.com/users/jamalex/orgs","repos_url":"https://api.github.com/users/jamalex/repos","events_url":"https://api.github.com/users/jamalex/events{/privacy}","received_events_url":"https://api.github.com/users/jamalex/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/jamalex/kolibri","description":"This is where Kolibri shall be born, watch and participate!","fork":true,"url":"https://api.github.com/repos/jamalex/kolibri","forks_url":"https://api.github.com/repos/jamalex/kolibri/forks","keys_url":"https://api.github.com/repos/jamalex/kolibri/keys{/key_id}","collaborators_url":"https://api.github.com/repos/jamalex/kolibri/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/jamalex/kolibri/teams","hooks_url":"https://api.github.com/repos/jamalex/kolibri/hooks","issue_events_url":"https://api.github.com/repos/jamalex/kolibri/issues/events{/number}","events_url":"https://api.github.com/repos/jamalex/kolibri/events","assignees_url":"https://api.github.com/repos/jamalex/kolibri/assignees{/user}","branches_url":"https://api.github.com/repos/jamalex/kolibri/branches{/branch}","tags_url":"https://api.github.com/repos/jamalex/kolibri/tags","blobs_url":"https://api.github.com/repos/jamalex/kolibri/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/jamalex/kolibri/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/jamalex/kolibri/git/refs{/sha}","trees_url":"https://api.github.com/repos/jamalex/kolibri/git/trees{/sha}","statuses_url":"https://api.github.com/repos/jamalex/kolibri/statuses/{sha}","languages_url":"https://api.github.com/repos/jamalex/kolibri/languages","stargazers_url":"https://api.github.com/repos/jamalex/kolibri/stargazers","contributors_url":"https://api.github.com/repos/jamalex/kolibri/contributors","subscribers_url":"https://api.github.com/repos/jamalex/kolibri/subscribers","subscription_url":"https://api.github.com/repos/jamalex/kolibri/subscription","commits_url":"https://api.github.com/repos/jamalex/kolibri/commits{/sha}","git_commits_url":"https://api.github.com/repos/jamalex/kolibri/git/commits{/sha}","comments_url":"https://api.github.com/repos/jamalex/kolibri/comments{/number}","issue_comment_url":"https://api.github.com/repos/jamalex/kolibri/issues/comments{/number}","contents_url":"https://api.github.com/repos/jamalex/kolibri/contents/{+path}","compare_url":"https://api.github.com/repos/jamalex/kolibri/compare/{base}...{head}","merges_url":"https://api.github.com/repos/jamalex/kolibri/merges","archive_url":"https://api.github.com/repos/jamalex/kolibri/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/jamalex/kolibri/downloads","issues_url":"https://api.github.com/repos/jamalex/kolibri/issues{/number}","pulls_url":"https://api.github.com/repos/jamalex/kolibri/pulls{/number}","milestones_url":"https://api.github.com/repos/jamalex/kolibri/milestones{/number}","notifications_url":"https://api.github.com/repos/jamalex/kolibri/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/jamalex/kolibri/labels{/name}","releases_url":"https://api.github.com/repos/jamalex/kolibri/releases{/id}","deployments_url":"https://api.github.com/repos/jamalex/kolibri/deployments","created_at":"2016-02-10T18:44:39Z","updated_at":"2016-02-10T18:44:40Z","pushed_at":"2016-05-04T15:59:56Z","git_url":"git://github.com/jamalex/kolibri.git","ssh_url":"git@github.com:jamalex/kolibri.git","clone_url":"https://github.com/jamalex/kolibri.git","svn_url":"https://github.com/jamalex/kolibri","homepage":"http://learningequality.org/kolibri/","size":4724,"stargazers_count":0,"watchers_count":0,"language":"Python","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":"learningequality:master","ref":"master","sha":"560b0250fc14703459840155ac2a1b269a28cbc2","user":{"login":"learningequality","id":3926525,"avatar_url":"https://avatars.githubusercontent.com/u/3926525?v=3","gravatar_id":"","url":"https://api.github.com/users/learningequality","html_url":"https://github.com/learningequality","followers_url":"https://api.github.com/users/learningequality/followers","following_url":"https://api.github.com/users/learningequality/following{/other_user}","gists_url":"https://api.github.com/users/learningequality/gists{/gist_id}","starred_url":"https://api.github.com/users/learningequality/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/learningequality/subscriptions","organizations_url":"https://api.github.com/users/learningequality/orgs","repos_url":"https://api.github.com/users/learningequality/repos","events_url":"https://api.github.com/users/learningequality/events{/privacy}","received_events_url":"https://api.github.com/users/learningequality/received_events","type":"Organization","site_admin":false},"repo":{"id":49976939,"name":"kolibri","full_name":"learningequality/kolibri","owner":{"login":"learningequality","id":3926525,"avatar_url":"https://avatars.githubusercontent.com/u/3926525?v=3","gravatar_id":"","url":"https://api.github.com/users/learningequality","html_url":"https://github.com/learningequality","followers_url":"https://api.github.com/users/learningequality/followers","following_url":"https://api.github.com/users/learningequality/following{/other_user}","gists_url":"https://api.github.com/users/learningequality/gists{/gist_id}","starred_url":"https://api.github.com/users/learningequality/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/learningequality/subscriptions","organizations_url":"https://api.github.com/users/learningequality/orgs","repos_url":"https://api.github.com/users/learningequality/repos","events_url":"https://api.github.com/users/learningequality/events{/privacy}","received_events_url":"https://api.github.com/users/learningequality/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/learningequality/kolibri","description":"This is where Kolibri shall be born, watch and participate!","fork":false,"url":"https://api.github.com/repos/learningequality/kolibri","forks_url":"https://api.github.com/repos/learningequality/kolibri/forks","keys_url":"https://api.github.com/repos/learningequality/kolibri/keys{/key_id}","collaborators_url":"https://api.github.com/repos/learningequality/kolibri/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/learningequality/kolibri/teams","hooks_url":"https://api.github.com/repos/learningequality/kolibri/hooks","issue_events_url":"https://api.github.com/repos/learningequality/kolibri/issues/events{/number}","events_url":"https://api.github.com/repos/learningequality/kolibri/events","assignees_url":"https://api.github.com/repos/learningequality/kolibri/assignees{/user}","branches_url":"https://api.github.com/repos/learningequality/kolibri/branches{/branch}","tags_url":"https://api.github.com/repos/learningequality/kolibri/tags","blobs_url":"https://api.github.com/repos/learningequality/kolibri/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/learningequality/kolibri/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/learningequality/kolibri/git/refs{/sha}","trees_url":"https://api.github.com/repos/learningequality/kolibri/git/trees{/sha}","statuses_url":"https://api.github.com/repos/learningequality/kolibri/statuses/{sha}","languages_url":"https://api.github.com/repos/learningequality/kolibri/languages","stargazers_url":"https://api.github.com/repos/learningequality/kolibri/stargazers","contributors_url":"https://api.github.com/repos/learningequality/kolibri/contributors","subscribers_url":"https://api.github.com/repos/learningequality/kolibri/subscribers","subscription_url":"https://api.github.com/repos/learningequality/kolibri/subscription","commits_url":"https://api.github.com/repos/learningequality/kolibri/commits{/sha}","git_commits_url":"https://api.github.com/repos/learningequality/kolibri/git/commits{/sha}","comments_url":"https://api.github.com/repos/learningequality/kolibri/comments{/number}","issue_comment_url":"https://api.github.com/repos/learningequality/kolibri/issues/comments{/number}","contents_url":"https://api.github.com/repos/learningequality/kolibri/contents/{+path}","compare_url":"https://api.github.com/repos/learningequality/kolibri/compare/{base}...{head}","merges_url":"https://api.github.com/repos/learningequality/kolibri/merges","archive_url":"https://api.github.com/repos/learningequality/kolibri/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/learningequality/kolibri/downloads","issues_url":"https://api.github.com/repos/learningequality/kolibri/issues{/number}","pulls_url":"https://api.github.com/repos/learningequality/kolibri/pulls{/number}","milestones_url":"https://api.github.com/repos/learningequality/kolibri/milestones{/number}","notifications_url":"https://api.github.com/repos/learningequality/kolibri/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/learningequality/kolibri/labels{/name}","releases_url":"https://api.github.com/repos/learningequality/kolibri/releases{/id}","deployments_url":"https://api.github.com/repos/learningequality/kolibri/deployments","created_at":"2016-01-19T19:22:07Z","updated_at":"2016-04-13T06:45:10Z","pushed_at":"2016-05-04T16:20:25Z","git_url":"git://github.com/learningequality/kolibri.git","ssh_url":"git@github.com:learningequality/kolibri.git","clone_url":"https://github.com/learningequality/kolibri.git","svn_url":"https://github.com/learningequality/kolibri","homepage":"http://learningequality.org/kolibri/","size":4922,"stargazers_count":17,"watchers_count":17,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":20,"mirror_url":null,"open_issues_count":25,"forks":20,"open_issues":25,"watchers":17,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/learningequality/kolibri/pulls/67"},"html":{"href":"https://github.com/learningequality/kolibri/pull/67"},"issue":{"href":"https://api.github.com/repos/learningequality/kolibri/issues/67"},"comments":{"href":"https://api.github.com/repos/learningequality/kolibri/issues/67/comments"},"review_comments":{"href":"https://api.github.com/repos/learningequality/kolibri/pulls/67/comments"},"review_comment":{"href":"https://api.github.com/repos/learningequality/kolibri/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/learningequality/kolibri/pulls/67/commits"},"statuses":{"href":"https://api.github.com/repos/learningequality/kolibri/statuses/df0b08ef205f4af8e81f5d53fdde8719d5f92767"}}}}