{"action":"created","issue":{"url":"https://api.github.com/repos/learningequality/kolibri/issues/51","repository_url":"https://api.github.com/repos/learningequality/kolibri","labels_url":"https://api.github.com/repos/learningequality/kolibri/issues/51/labels{/name}","comments_url":"https://api.github.com/repos/learningequality/kolibri/issues/51/comments","events_url":"https://api.github.com/repos/learningequality/kolibri/issues/51/events","html_url":"https://github.com/learningequality/kolibri/pull/51","id":142263243,"number":51,"title":"Role-checking and class-based permissions tests","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},"labels":[],"state":"open","locked":false,"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,"comments":11,"created_at":"2016-03-21T05:35:14Z","updated_at":"2016-04-19T23:02:23Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/learningequality/kolibri/pulls/51","html_url":"https://github.com/learningequality/kolibri/pull/51","diff_url":"https://github.com/learningequality/kolibri/pull/51.diff","patch_url":"https://github.com/learningequality/kolibri/pull/51.patch"},"body":"## Summary\r\n\r\nInitial role and class-based permissions tests, covering the main API components. While I have ideas (and for some pieces, code, e.g. from https://github.com/learningequality/kolibri/pull/36) for implementing these, I was a good little TDD'er and focused on writing the tests and refining the dev-facing interfaces, for this PR.\r\n\r\n## Reviewer guidance\r\n\r\nThis PR builds upon https://github.com/learningequality/kolibri/pull/50, so it would likely be best to merge that first.\r\n\r\nI will continue to write more tests, testing specific permissions on the UAP models, but this can be reviewed in the meantime.\r\n\r\nThe main interfaces introduced/used here are (in pseudocode):\r\n\r\n```\r\nuser.get_roles_for(user/collection)\r\nuser.has_role_for(kind/kinds, user/collection)\r\n\r\ncollection.get_members()\r\ncollection.is_member(user)\r\n\r\n\r\n@apply_permissions(MyPermissionClass() | OtherPermissionClass())\r\nclass LogFile(models.Model):\r\n    ...\r\n    \r\nlogfile.user_can_create(user)\r\nlogfile.user_can_read(user)\r\nlogfile.user_can_update(user)\r\nlogfile.user_can_delete(user)\r\n\r\nlogfile.objects.readable_by_user(user)\r\n```"},"comment":{"url":"https://api.github.com/repos/learningequality/kolibri/issues/comments/212161286","html_url":"https://github.com/learningequality/kolibri/pull/51#issuecomment-212161286","issue_url":"https://api.github.com/repos/learningequality/kolibri/issues/51","id":212161286,"user":{"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},"created_at":"2016-04-19T23:02:23Z","updated_at":"2016-04-19T23:02:23Z","body":"I'd feel very confident about merging this. I only have a few small comments. Let me know if you plan to address them, or alternatively if you agree to it then I can merge this now and address them in a separate PR."}}