{"action":"created","comment":{"url":"https://api.github.com/repos/pattisdr/osf.io/pulls/comments/213377139","pull_request_review_id":150193864,"id":213377139,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIxMzM3NzEzOQ==","diff_hunk":"@@ -2343,13 +2339,6 @@ def is_bookmark_collection(self):\n         \"\"\"For v1 compat\"\"\"\n         return False\n \n-    class Meta:","path":"osf/models/node.py","position":200,"original_position":200,"commit_id":"29aa937b004689ea2a667c70f28eb2f7505ea8f8","original_commit_id":"29aa937b004689ea2a667c70f28eb2f7505ea8f8","user":{"login":"pattisdr","id":9755598,"node_id":"MDQ6VXNlcjk3NTU1OTg=","avatar_url":"https://avatars2.githubusercontent.com/u/9755598?v=4","gravatar_id":"","url":"https://api.github.com/users/pattisdr","html_url":"https://github.com/pattisdr","followers_url":"https://api.github.com/users/pattisdr/followers","following_url":"https://api.github.com/users/pattisdr/following{/other_user}","gists_url":"https://api.github.com/users/pattisdr/gists{/gist_id}","starred_url":"https://api.github.com/users/pattisdr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pattisdr/subscriptions","organizations_url":"https://api.github.com/users/pattisdr/orgs","repos_url":"https://api.github.com/users/pattisdr/repos","events_url":"https://api.github.com/users/pattisdr/events{/privacy}","received_events_url":"https://api.github.com/users/pattisdr/received_events","type":"User","site_admin":false},"body":"Moved this AbstractNode meta, should probs move back.\r\n\r\nI can't have `read_node` defined in Meta, for example on both the AbstractNode model and the Node model since they're the same table.  Assume these guardian permissions need to go on the AbstractNode model.","created_at":"2018-08-28T16:08:09Z","updated_at":"2018-08-28T16:15:02Z","html_url":"https://github.com/pattisdr/osf.io/pull/11#discussion_r213377139","pull_request_url":"https://api.github.com/repos/pattisdr/osf.io/pulls/11","author_association":"OWNER","_links":{"self":{"href":"https://api.github.com/repos/pattisdr/osf.io/pulls/comments/213377139"},"html":{"href":"https://github.com/pattisdr/osf.io/pull/11#discussion_r213377139"},"pull_request":{"href":"https://api.github.com/repos/pattisdr/osf.io/pulls/11"}}},"pull_request":{"url":"https://api.github.com/repos/pattisdr/osf.io/pulls/11","id":211412301,"node_id":"MDExOlB1bGxSZXF1ZXN0MjExNDEyMzAx","html_url":"https://github.com/pattisdr/osf.io/pull/11","diff_url":"https://github.com/pattisdr/osf.io/pull/11.diff","patch_url":"https://github.com/pattisdr/osf.io/pull/11.patch","issue_url":"https://api.github.com/repos/pattisdr/osf.io/issues/11","number":11,"state":"open","locked":false,"title":"Evaluate/Django-Guardian on Nodes [PLAT-1040]","user":{"login":"pattisdr","id":9755598,"node_id":"MDQ6VXNlcjk3NTU1OTg=","avatar_url":"https://avatars2.githubusercontent.com/u/9755598?v=4","gravatar_id":"","url":"https://api.github.com/users/pattisdr","html_url":"https://github.com/pattisdr","followers_url":"https://api.github.com/users/pattisdr/followers","following_url":"https://api.github.com/users/pattisdr/following{/other_user}","gists_url":"https://api.github.com/users/pattisdr/gists{/gist_id}","starred_url":"https://api.github.com/users/pattisdr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pattisdr/subscriptions","organizations_url":"https://api.github.com/users/pattisdr/orgs","repos_url":"https://api.github.com/users/pattisdr/repos","events_url":"https://api.github.com/users/pattisdr/events{/privacy}","received_events_url":"https://api.github.com/users/pattisdr/received_events","type":"User","site_admin":false},"body":"## Purpose\r\n\r\nAdds Django-Guardian to nodes for permissions.\r\n\r\n## Changes\r\n- Adds GuardianMixin to AbstractNode model\r\n- On node creation, creates an admin group, write group, and read group for the node.  Admin group gets admin-write-read perms, write group gets write-read, and read group gets read perms. Creator automatically added to node group.\r\n- Consolidates contributor methods in ContributorMixin to now work for both nodes and preprints since they both use guardian\r\n- Adds data migration to create django groups for existing nodes and add contributors to them.\r\n- Schema migration removes admin/write/read fields from Contributor table\r\n- Changes to permission-related queries to use guardian\r\n- Does NOT explicitly add admin contributors as read contributors to other groups.  I think this gets too messy, and adds way too much code clutter.  When you add contributors, add components, remove contributors, update contributors, remove projects, you have to do all this extra checking for who needs to be added/removed as an admin contributor.  Also, once OSF Groups was added, we'd have to have another table to keep track of who was added where, were you explicitly added or implicitly added? With those extra lookups, I think it makes sense to just query parents to see if any admins are in the tree and optimize as much as possible.\r\n\r\n## TODO\r\nThis is almost there, one failing test, main thing to add would be query optimizations\r\n- [ ] Add reverse data migration\r\n- [ ] Optimize new queries, especially implicit admin-related ones\r\n- [ ] Get rid of 'distinct'\r\n- [ ] `get_node_count` query on NodeSerializer is incorrect, just have a first stab up, there should be a test for this\r\n- [ ] Double check Node and Preprint models, make sure there's no more contributor-related code overrides that should be moved to the ContributorMixin\r\n- [ ] Fix failing elastic search test\r\n- [ ] Bring divorce up-to-date and then bring this PR up-to-date. Recently merged https://github.com/CenterForOpenScience/osf.io/pull/8631 will conflict\r\n\r\n## Side effects\r\n\r\n<!--Any possible side effects? -->\r\n\r\n\r\n## Ticket\r\n\r\nhttps://openscience.atlassian.net/browse/PLAT-1040","created_at":"2018-08-28T12:54:42Z","updated_at":"2018-08-28T16:15:02Z","closed_at":null,"merged_at":null,"merge_commit_sha":"980b64153a7b38c933cf949afb25e7ca10d2e2b6","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/pattisdr/osf.io/pulls/11/commits","review_comments_url":"https://api.github.com/repos/pattisdr/osf.io/pulls/11/comments","review_comment_url":"https://api.github.com/repos/pattisdr/osf.io/pulls/comments{/number}","comments_url":"https://api.github.com/repos/pattisdr/osf.io/issues/11/comments","statuses_url":"https://api.github.com/repos/pattisdr/osf.io/statuses/29aa937b004689ea2a667c70f28eb2f7505ea8f8","head":{"label":"pattisdr:evaluate/guardian-on-nodes","ref":"evaluate/guardian-on-nodes","sha":"29aa937b004689ea2a667c70f28eb2f7505ea8f8","user":{"login":"pattisdr","id":9755598,"node_id":"MDQ6VXNlcjk3NTU1OTg=","avatar_url":"https://avatars2.githubusercontent.com/u/9755598?v=4","gravatar_id":"","url":"https://api.github.com/users/pattisdr","html_url":"https://github.com/pattisdr","followers_url":"https://api.github.com/users/pattisdr/followers","following_url":"https://api.github.com/users/pattisdr/following{/other_user}","gists_url":"https://api.github.com/users/pattisdr/gists{/gist_id}","starred_url":"https://api.github.com/users/pattisdr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pattisdr/subscriptions","organizations_url":"https://api.github.com/users/pattisdr/orgs","repos_url":"https://api.github.com/users/pattisdr/repos","events_url":"https://api.github.com/users/pattisdr/events{/privacy}","received_events_url":"https://api.github.com/users/pattisdr/received_events","type":"User","site_admin":false},"repo":{"id":35900874,"node_id":"MDEwOlJlcG9zaXRvcnkzNTkwMDg3NA==","name":"osf.io","full_name":"pattisdr/osf.io","owner":{"login":"pattisdr","id":9755598,"node_id":"MDQ6VXNlcjk3NTU1OTg=","avatar_url":"https://avatars2.githubusercontent.com/u/9755598?v=4","gravatar_id":"","url":"https://api.github.com/users/pattisdr","html_url":"https://github.com/pattisdr","followers_url":"https://api.github.com/users/pattisdr/followers","following_url":"https://api.github.com/users/pattisdr/following{/other_user}","gists_url":"https://api.github.com/users/pattisdr/gists{/gist_id}","starred_url":"https://api.github.com/users/pattisdr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pattisdr/subscriptions","organizations_url":"https://api.github.com/users/pattisdr/orgs","repos_url":"https://api.github.com/users/pattisdr/repos","events_url":"https://api.github.com/users/pattisdr/events{/privacy}","received_events_url":"https://api.github.com/users/pattisdr/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/pattisdr/osf.io","description":"Facilitating Open Science","fork":true,"url":"https://api.github.com/repos/pattisdr/osf.io","forks_url":"https://api.github.com/repos/pattisdr/osf.io/forks","keys_url":"https://api.github.com/repos/pattisdr/osf.io/keys{/key_id}","collaborators_url":"https://api.github.com/repos/pattisdr/osf.io/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/pattisdr/osf.io/teams","hooks_url":"https://api.github.com/repos/pattisdr/osf.io/hooks","issue_events_url":"https://api.github.com/repos/pattisdr/osf.io/issues/events{/number}","events_url":"https://api.github.com/repos/pattisdr/osf.io/events","assignees_url":"https://api.github.com/repos/pattisdr/osf.io/assignees{/user}","branches_url":"https://api.github.com/repos/pattisdr/osf.io/branches{/branch}","tags_url":"https://api.github.com/repos/pattisdr/osf.io/tags","blobs_url":"https://api.github.com/repos/pattisdr/osf.io/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/pattisdr/osf.io/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/pattisdr/osf.io/git/refs{/sha}","trees_url":"https://api.github.com/repos/pattisdr/osf.io/git/trees{/sha}","statuses_url":"https://api.github.com/repos/pattisdr/osf.io/statuses/{sha}","languages_url":"https://api.github.com/repos/pattisdr/osf.io/languages","stargazers_url":"https://api.github.com/repos/pattisdr/osf.io/stargazers","contributors_url":"https://api.github.com/repos/pattisdr/osf.io/contributors","subscribers_url":"https://api.github.com/repos/pattisdr/osf.io/subscribers","subscription_url":"https://api.github.com/repos/pattisdr/osf.io/subscription","commits_url":"https://api.github.com/repos/pattisdr/osf.io/commits{/sha}","git_commits_url":"https://api.github.com/repos/pattisdr/osf.io/git/commits{/sha}","comments_url":"https://api.github.com/repos/pattisdr/osf.io/comments{/number}","issue_comment_url":"https://api.github.com/repos/pattisdr/osf.io/issues/comments{/number}","contents_url":"https://api.github.com/repos/pattisdr/osf.io/contents/{+path}","compare_url":"https://api.github.com/repos/pattisdr/osf.io/compare/{base}...{head}","merges_url":"https://api.github.com/repos/pattisdr/osf.io/merges","archive_url":"https://api.github.com/repos/pattisdr/osf.io/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/pattisdr/osf.io/downloads","issues_url":"https://api.github.com/repos/pattisdr/osf.io/issues{/number}","pulls_url":"https://api.github.com/repos/pattisdr/osf.io/pulls{/number}","milestones_url":"https://api.github.com/repos/pattisdr/osf.io/milestones{/number}","notifications_url":"https://api.github.com/repos/pattisdr/osf.io/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/pattisdr/osf.io/labels{/name}","releases_url":"https://api.github.com/repos/pattisdr/osf.io/releases{/id}","deployments_url":"https://api.github.com/repos/pattisdr/osf.io/deployments","created_at":"2015-05-19T18:33:09Z","updated_at":"2016-01-11T21:17:43Z","pushed_at":"2018-08-28T13:04:59Z","git_url":"git://github.com/pattisdr/osf.io.git","ssh_url":"git@github.com:pattisdr/osf.io.git","clone_url":"https://github.com/pattisdr/osf.io.git","svn_url":"https://github.com/pattisdr/osf.io","homepage":"http://osf.io","size":176911,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"archived":false,"open_issues_count":1,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0","node_id":"MDc6TGljZW5zZTI="},"forks":1,"open_issues":1,"watchers":0,"default_branch":"develop"}},"base":{"label":"pattisdr:feature/node-preprint","ref":"feature/node-preprint","sha":"0d7f23742bb010dd65cdbd9e22064afdbf7f463f","user":{"login":"pattisdr","id":9755598,"node_id":"MDQ6VXNlcjk3NTU1OTg=","avatar_url":"https://avatars2.githubusercontent.com/u/9755598?v=4","gravatar_id":"","url":"https://api.github.com/users/pattisdr","html_url":"https://github.com/pattisdr","followers_url":"https://api.github.com/users/pattisdr/followers","following_url":"https://api.github.com/users/pattisdr/following{/other_user}","gists_url":"https://api.github.com/users/pattisdr/gists{/gist_id}","starred_url":"https://api.github.com/users/pattisdr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pattisdr/subscriptions","organizations_url":"https://api.github.com/users/pattisdr/orgs","repos_url":"https://api.github.com/users/pattisdr/repos","events_url":"https://api.github.com/users/pattisdr/events{/privacy}","received_events_url":"https://api.github.com/users/pattisdr/received_events","type":"User","site_admin":false},"repo":{"id":35900874,"node_id":"MDEwOlJlcG9zaXRvcnkzNTkwMDg3NA==","name":"osf.io","full_name":"pattisdr/osf.io","owner":{"login":"pattisdr","id":9755598,"node_id":"MDQ6VXNlcjk3NTU1OTg=","avatar_url":"https://avatars2.githubusercontent.com/u/9755598?v=4","gravatar_id":"","url":"https://api.github.com/users/pattisdr","html_url":"https://github.com/pattisdr","followers_url":"https://api.github.com/users/pattisdr/followers","following_url":"https://api.github.com/users/pattisdr/following{/other_user}","gists_url":"https://api.github.com/users/pattisdr/gists{/gist_id}","starred_url":"https://api.github.com/users/pattisdr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pattisdr/subscriptions","organizations_url":"https://api.github.com/users/pattisdr/orgs","repos_url":"https://api.github.com/users/pattisdr/repos","events_url":"https://api.github.com/users/pattisdr/events{/privacy}","received_events_url":"https://api.github.com/users/pattisdr/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/pattisdr/osf.io","description":"Facilitating Open Science","fork":true,"url":"https://api.github.com/repos/pattisdr/osf.io","forks_url":"https://api.github.com/repos/pattisdr/osf.io/forks","keys_url":"https://api.github.com/repos/pattisdr/osf.io/keys{/key_id}","collaborators_url":"https://api.github.com/repos/pattisdr/osf.io/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/pattisdr/osf.io/teams","hooks_url":"https://api.github.com/repos/pattisdr/osf.io/hooks","issue_events_url":"https://api.github.com/repos/pattisdr/osf.io/issues/events{/number}","events_url":"https://api.github.com/repos/pattisdr/osf.io/events","assignees_url":"https://api.github.com/repos/pattisdr/osf.io/assignees{/user}","branches_url":"https://api.github.com/repos/pattisdr/osf.io/branches{/branch}","tags_url":"https://api.github.com/repos/pattisdr/osf.io/tags","blobs_url":"https://api.github.com/repos/pattisdr/osf.io/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/pattisdr/osf.io/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/pattisdr/osf.io/git/refs{/sha}","trees_url":"https://api.github.com/repos/pattisdr/osf.io/git/trees{/sha}","statuses_url":"https://api.github.com/repos/pattisdr/osf.io/statuses/{sha}","languages_url":"https://api.github.com/repos/pattisdr/osf.io/languages","stargazers_url":"https://api.github.com/repos/pattisdr/osf.io/stargazers","contributors_url":"https://api.github.com/repos/pattisdr/osf.io/contributors","subscribers_url":"https://api.github.com/repos/pattisdr/osf.io/subscribers","subscription_url":"https://api.github.com/repos/pattisdr/osf.io/subscription","commits_url":"https://api.github.com/repos/pattisdr/osf.io/commits{/sha}","git_commits_url":"https://api.github.com/repos/pattisdr/osf.io/git/commits{/sha}","comments_url":"https://api.github.com/repos/pattisdr/osf.io/comments{/number}","issue_comment_url":"https://api.github.com/repos/pattisdr/osf.io/issues/comments{/number}","contents_url":"https://api.github.com/repos/pattisdr/osf.io/contents/{+path}","compare_url":"https://api.github.com/repos/pattisdr/osf.io/compare/{base}...{head}","merges_url":"https://api.github.com/repos/pattisdr/osf.io/merges","archive_url":"https://api.github.com/repos/pattisdr/osf.io/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/pattisdr/osf.io/downloads","issues_url":"https://api.github.com/repos/pattisdr/osf.io/issues{/number}","pulls_url":"https://api.github.com/repos/pattisdr/osf.io/pulls{/number}","milestones_url":"https://api.github.com/repos/pattisdr/osf.io/milestones{/number}","notifications_url":"https://api.github.com/repos/pattisdr/osf.io/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/pattisdr/osf.io/labels{/name}","releases_url":"https://api.github.com/repos/pattisdr/osf.io/releases{/id}","deployments_url":"https://api.github.com/repos/pattisdr/osf.io/deployments","created_at":"2015-05-19T18:33:09Z","updated_at":"2016-01-11T21:17:43Z","pushed_at":"2018-08-28T13:04:59Z","git_url":"git://github.com/pattisdr/osf.io.git","ssh_url":"git@github.com:pattisdr/osf.io.git","clone_url":"https://github.com/pattisdr/osf.io.git","svn_url":"https://github.com/pattisdr/osf.io","homepage":"http://osf.io","size":176911,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"archived":false,"open_issues_count":1,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0","node_id":"MDc6TGljZW5zZTI="},"forks":1,"open_issues":1,"watchers":0,"default_branch":"develop"}},"_links":{"self":{"href":"https://api.github.com/repos/pattisdr/osf.io/pulls/11"},"html":{"href":"https://github.com/pattisdr/osf.io/pull/11"},"issue":{"href":"https://api.github.com/repos/pattisdr/osf.io/issues/11"},"comments":{"href":"https://api.github.com/repos/pattisdr/osf.io/issues/11/comments"},"review_comments":{"href":"https://api.github.com/repos/pattisdr/osf.io/pulls/11/comments"},"review_comment":{"href":"https://api.github.com/repos/pattisdr/osf.io/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/pattisdr/osf.io/pulls/11/commits"},"statuses":{"href":"https://api.github.com/repos/pattisdr/osf.io/statuses/29aa937b004689ea2a667c70f28eb2f7505ea8f8"}},"author_association":"OWNER"}}
{"actor":{"display_login":"pattisdr"}}