{"action":"created","comment":{"url":"https://api.github.com/repos/CenterForOpenScience/osf.io/pulls/comments/41179547","id":41179547,"diff_hunk":"@@ -228,12 +294,62 @@ def get_default_odm_query(self):\n         query = base_query & permission_query\n         return query\n \n-    # overrides ListCreateAPIView\n+    # overrides ListBulkCreateUpdateDestroyAPIView\n     def get_queryset(self):\n-        query = self.get_query_from_request()\n-        return Node.find(query)\n+        # For bulk requests, queryset is formed from request body.\n+        if isinstance(self.request.data, list):\n+            query = Q('_id', 'in', [node['id'] for node in self.request.data])\n+\n+            user = self.request.user\n+            if user.is_anonymous():\n+                auth = Auth(None)\n+            else:\n+                auth = Auth(user)\n \n-    # overrides ListCreateAPIView\n+            nodes = Node.find(query)\n+            for node in nodes:\n+                if not node.can_edit(auth):","path":"api/nodes/views.py","position":151,"original_position":151,"commit_id":"72b758942fefff3250451fce0a28f7085cc1e824","original_commit_id":"72b758942fefff3250451fce0a28f7085cc1e824","user":{"login":"pattisdr","id":9755598,"avatar_url":"https://avatars.githubusercontent.com/u/9755598?v=3","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":" > \"Also note that the generic views will only check the object-level permissions for views that retrieve a single model instance. If you require object-level filtering of list views, you'll need to filter the queryset separately. See the filtering documentation for more details.\"","created_at":"2015-10-05T18:29:40Z","updated_at":"2015-10-05T18:29:40Z","html_url":"https://github.com/CenterForOpenScience/osf.io/pull/4353#discussion_r41179547","pull_request_url":"https://api.github.com/repos/CenterForOpenScience/osf.io/pulls/4353","_links":{"self":{"href":"https://api.github.com/repos/CenterForOpenScience/osf.io/pulls/comments/41179547"},"html":{"href":"https://github.com/CenterForOpenScience/osf.io/pull/4353#discussion_r41179547"},"pull_request":{"href":"https://api.github.com/repos/CenterForOpenScience/osf.io/pulls/4353"}}},"pull_request":{"url":"https://api.github.com/repos/CenterForOpenScience/osf.io/pulls/4353","id":45944067,"html_url":"https://github.com/CenterForOpenScience/osf.io/pull/4353","diff_url":"https://github.com/CenterForOpenScience/osf.io/pull/4353.diff","patch_url":"https://github.com/CenterForOpenScience/osf.io/pull/4353.patch","issue_url":"https://api.github.com/repos/CenterForOpenScience/osf.io/issues/4353","number":4353,"state":"open","locked":false,"title":"[Ready to Review] API Bulk Modification","user":{"login":"pattisdr","id":9755598,"avatar_url":"https://avatars.githubusercontent.com/u/9755598?v=3","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\nAllows bulk modifications of nodes, contributors, children, and node-links.  You can:\r\n- Create/update/delete multiple nodes /v2/nodes/\r\n- Create/update/delete multiple contributors /v2/nodes/{node_id}/contributors/\r\n- Create multiple children /v2/nodes/{node_id}/children/\r\n- Create/delete multiple node-links /v2/nodes/{node_id}/node_links/\r\n\r\nIssue: https://openscience.atlassian.net/browse/OSF-4234\r\n\r\nComplies with json-api bulk extension: \r\nhttp://jsonapi.org/extensions/bulk/\r\n\r\n**Note:** `application/vnd.api+json; supported-ext=\"bulk\"` is **not** in Content-Type header.  The negotiation mechanism is very likely to change http://discuss.jsonapi.org/t/bulk-extension-how-much-is-expected-to-change-prior-to-v1-1/121\r\n\r\n# Changes\r\n1) To **create** multiple nodes, send POST request to /v2/nodes/ with array of resource objects.  Each object needs a `type` and `attributes` field.\r\n```\r\nPOST /v2/nodes/\r\n        {\r\n            \"data\": [{\r\n                \"type\": \"nodes\",\r\n                \"attributes\": {\r\n                    \"title\": \"New title\", \r\n                    \"category\": \"project\"\r\n                }\r\n            },\r\n                {\r\n                \"type\": \"nodes\",\r\n                \"attributes\": {\r\n                    \"title\": \"Better title\", \r\n                    \"category\": \"project\"\r\n                }\r\n            }]\r\n        }\r\n\r\n```\r\n2) To **update** multiple nodes, sent PUT or PATCH request to /v2/nodes/ with array of resource objects. Each object must have `type` and `id`.\r\n```\r\nPATCH /v2/nodes/\r\n        {\r\n            \"data\": [{\r\n                \"id\": \"fdxfr\",\r\n                \"type\": \"nodes\",\r\n                \"attributes\": {\r\n                    \"title\": \"New title\", \r\n                    \"category\": \"instrumentation\"\r\n                }\r\n            },\r\n                {\r\n                \"id\": \"dsfsa\",\r\n                \"type\": \"nodes\",\r\n                \"attributes\": {\r\n                    \"title\": \"Better title\", \r\n                    \"category\": \"hypothesis\"\r\n                }\r\n            }]\r\n        }\r\n```\r\n3) To **delete** multiple nodes, send DELETE request to /v2/nodes/ with array of resource objects. Each object must have `type` and `id`.\r\n```\r\nDELETE /v2/nodes/\r\n\r\n        {\r\n            \"data\": [{\r\n                \"id\": \"fdxfr\",\r\n                \"type\": \"nodes\",\r\n            },\r\n                {\r\n                \"id\": \"dsfsa\",\r\n                \"type\": \"nodes\",\r\n            }]\r\n        }\r\n```","created_at":"2015-09-24T20:14:44Z","updated_at":"2015-10-05T18:29:40Z","closed_at":null,"merged_at":null,"merge_commit_sha":"c53b691de20cca1670d34c62ee4d5cf22aee2481","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/CenterForOpenScience/osf.io/pulls/4353/commits","review_comments_url":"https://api.github.com/repos/CenterForOpenScience/osf.io/pulls/4353/comments","review_comment_url":"https://api.github.com/repos/CenterForOpenScience/osf.io/pulls/comments{/number}","comments_url":"https://api.github.com/repos/CenterForOpenScience/osf.io/issues/4353/comments","statuses_url":"https://api.github.com/repos/CenterForOpenScience/osf.io/statuses/72b758942fefff3250451fce0a28f7085cc1e824","head":{"label":"pattisdr:feature/API_bulk_operations_nodes","ref":"feature/API_bulk_operations_nodes","sha":"72b758942fefff3250451fce0a28f7085cc1e824","user":{"login":"pattisdr","id":9755598,"avatar_url":"https://avatars.githubusercontent.com/u/9755598?v=3","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,"name":"osf.io","full_name":"pattisdr/osf.io","owner":{"login":"pattisdr","id":9755598,"avatar_url":"https://avatars.githubusercontent.com/u/9755598?v=3","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}","created_at":"2015-05-19T18:33:09Z","updated_at":"2015-05-19T18:33:13Z","pushed_at":"2015-10-05T14:13:09Z","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":103544,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":0,"forks":1,"open_issues":0,"watchers":0,"default_branch":"develop"}},"base":{"label":"CenterForOpenScience:develop","ref":"develop","sha":"fb59044377e3428d7a34ec3265423e4e5442343e","user":{"login":"CenterForOpenScience","id":3344584,"avatar_url":"https://avatars.githubusercontent.com/u/3344584?v=3","gravatar_id":"","url":"https://api.github.com/users/CenterForOpenScience","html_url":"https://github.com/CenterForOpenScience","followers_url":"https://api.github.com/users/CenterForOpenScience/followers","following_url":"https://api.github.com/users/CenterForOpenScience/following{/other_user}","gists_url":"https://api.github.com/users/CenterForOpenScience/gists{/gist_id}","starred_url":"https://api.github.com/users/CenterForOpenScience/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/CenterForOpenScience/subscriptions","organizations_url":"https://api.github.com/users/CenterForOpenScience/orgs","repos_url":"https://api.github.com/users/CenterForOpenScience/repos","events_url":"https://api.github.com/users/CenterForOpenScience/events{/privacy}","received_events_url":"https://api.github.com/users/CenterForOpenScience/received_events","type":"Organization","site_admin":false},"repo":{"id":10199599,"name":"osf.io","full_name":"CenterForOpenScience/osf.io","owner":{"login":"CenterForOpenScience","id":3344584,"avatar_url":"https://avatars.githubusercontent.com/u/3344584?v=3","gravatar_id":"","url":"https://api.github.com/users/CenterForOpenScience","html_url":"https://github.com/CenterForOpenScience","followers_url":"https://api.github.com/users/CenterForOpenScience/followers","following_url":"https://api.github.com/users/CenterForOpenScience/following{/other_user}","gists_url":"https://api.github.com/users/CenterForOpenScience/gists{/gist_id}","starred_url":"https://api.github.com/users/CenterForOpenScience/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/CenterForOpenScience/subscriptions","organizations_url":"https://api.github.com/users/CenterForOpenScience/orgs","repos_url":"https://api.github.com/users/CenterForOpenScience/repos","events_url":"https://api.github.com/users/CenterForOpenScience/events{/privacy}","received_events_url":"https://api.github.com/users/CenterForOpenScience/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/CenterForOpenScience/osf.io","description":"Facilitating Open Science","fork":false,"url":"https://api.github.com/repos/CenterForOpenScience/osf.io","forks_url":"https://api.github.com/repos/CenterForOpenScience/osf.io/forks","keys_url":"https://api.github.com/repos/CenterForOpenScience/osf.io/keys{/key_id}","collaborators_url":"https://api.github.com/repos/CenterForOpenScience/osf.io/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/CenterForOpenScience/osf.io/teams","hooks_url":"https://api.github.com/repos/CenterForOpenScience/osf.io/hooks","issue_events_url":"https://api.github.com/repos/CenterForOpenScience/osf.io/issues/events{/number}","events_url":"https://api.github.com/repos/CenterForOpenScience/osf.io/events","assignees_url":"https://api.github.com/repos/CenterForOpenScience/osf.io/assignees{/user}","branches_url":"https://api.github.com/repos/CenterForOpenScience/osf.io/branches{/branch}","tags_url":"https://api.github.com/repos/CenterForOpenScience/osf.io/tags","blobs_url":"https://api.github.com/repos/CenterForOpenScience/osf.io/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/CenterForOpenScience/osf.io/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/CenterForOpenScience/osf.io/git/refs{/sha}","trees_url":"https://api.github.com/repos/CenterForOpenScience/osf.io/git/trees{/sha}","statuses_url":"https://api.github.com/repos/CenterForOpenScience/osf.io/statuses/{sha}","languages_url":"https://api.github.com/repos/CenterForOpenScience/osf.io/languages","stargazers_url":"https://api.github.com/repos/CenterForOpenScience/osf.io/stargazers","contributors_url":"https://api.github.com/repos/CenterForOpenScience/osf.io/contributors","subscribers_url":"https://api.github.com/repos/CenterForOpenScience/osf.io/subscribers","subscription_url":"https://api.github.com/repos/CenterForOpenScience/osf.io/subscription","commits_url":"https://api.github.com/repos/CenterForOpenScience/osf.io/commits{/sha}","git_commits_url":"https://api.github.com/repos/CenterForOpenScience/osf.io/git/commits{/sha}","comments_url":"https://api.github.com/repos/CenterForOpenScience/osf.io/comments{/number}","issue_comment_url":"https://api.github.com/repos/CenterForOpenScience/osf.io/issues/comments{/number}","contents_url":"https://api.github.com/repos/CenterForOpenScience/osf.io/contents/{+path}","compare_url":"https://api.github.com/repos/CenterForOpenScience/osf.io/compare/{base}...{head}","merges_url":"https://api.github.com/repos/CenterForOpenScience/osf.io/merges","archive_url":"https://api.github.com/repos/CenterForOpenScience/osf.io/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/CenterForOpenScience/osf.io/downloads","issues_url":"https://api.github.com/repos/CenterForOpenScience/osf.io/issues{/number}","pulls_url":"https://api.github.com/repos/CenterForOpenScience/osf.io/pulls{/number}","milestones_url":"https://api.github.com/repos/CenterForOpenScience/osf.io/milestones{/number}","notifications_url":"https://api.github.com/repos/CenterForOpenScience/osf.io/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/CenterForOpenScience/osf.io/labels{/name}","releases_url":"https://api.github.com/repos/CenterForOpenScience/osf.io/releases{/id}","created_at":"2013-05-21T15:53:37Z","updated_at":"2015-09-28T06:19:31Z","pushed_at":"2015-10-05T18:18:55Z","git_url":"git://github.com/CenterForOpenScience/osf.io.git","ssh_url":"git@github.com:CenterForOpenScience/osf.io.git","clone_url":"https://github.com/CenterForOpenScience/osf.io.git","svn_url":"https://github.com/CenterForOpenScience/osf.io","homepage":"http://osf.io","size":233751,"stargazers_count":140,"watchers_count":140,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":120,"mirror_url":null,"open_issues_count":410,"forks":120,"open_issues":410,"watchers":140,"default_branch":"develop"}},"_links":{"self":{"href":"https://api.github.com/repos/CenterForOpenScience/osf.io/pulls/4353"},"html":{"href":"https://github.com/CenterForOpenScience/osf.io/pull/4353"},"issue":{"href":"https://api.github.com/repos/CenterForOpenScience/osf.io/issues/4353"},"comments":{"href":"https://api.github.com/repos/CenterForOpenScience/osf.io/issues/4353/comments"},"review_comments":{"href":"https://api.github.com/repos/CenterForOpenScience/osf.io/pulls/4353/comments"},"review_comment":{"href":"https://api.github.com/repos/CenterForOpenScience/osf.io/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/CenterForOpenScience/osf.io/pulls/4353/commits"},"statuses":{"href":"https://api.github.com/repos/CenterForOpenScience/osf.io/statuses/72b758942fefff3250451fce0a28f7085cc1e824"}}}}