)]}'
{"/COMMIT_MSG":[{"author":{"_account_id":748,"name":"Armando Migliaccio","email":"armamig@gmail.com","username":"armando-migliaccio"},"change_message_id":"8a326f710bded62600f4f419bbc891d24890048c","unresolved":false,"context_lines":[{"line_number":12,"context_line":"an admin, even if policy.json allows it."},{"line_number":13,"context_line":""},{"line_number":14,"context_line":"This patch adjusts the function to always use an elevated context"},{"line_number":15,"context_line":"so it\u0027s queries will use the ID. The policy engine will still prevent"},{"line_number":16,"context_line":"tenants from viewing/modifying each other\u0027s objects."},{"line_number":17,"context_line":""},{"line_number":18,"context_line":"This patch also adjusts the delete_port policy to add an allow for"}],"source_content_type":"text/x-gerrit-commit-message","patch_set":3,"id":"5a2ca52d_678f0d24","line":15,"updated":"2015-10-14 05:10:12.000000000","message":"the ID of what, the tenant\u0027s? Oh and by the way: it is ITS!","commit_id":"198faa66a2e4ac23edd52c4a00de11470991e70b"},{"author":{"_account_id":7787,"name":"Kevin Benton","email":"kevin@benton.pub","username":"blak111"},"change_message_id":"c5af97a848eb423bb2c2fc9f6084f1f9579e3581","unresolved":false,"context_lines":[{"line_number":12,"context_line":"an admin, even if policy.json allows it."},{"line_number":13,"context_line":""},{"line_number":14,"context_line":"This patch adjusts the function to always use an elevated context"},{"line_number":15,"context_line":"so it\u0027s queries will use the ID. The policy engine will still prevent"},{"line_number":16,"context_line":"tenants from viewing/modifying each other\u0027s objects."},{"line_number":17,"context_line":""},{"line_number":18,"context_line":"This patch also adjusts the delete_port policy to add an allow for"}],"source_content_type":"text/x-gerrit-commit-message","patch_set":3,"id":"5a2ca52d_60c58e8c","line":15,"in_reply_to":"5a2ca52d_678f0d24","updated":"2015-10-14 20:44:48.000000000","message":"sorry, this commit message is woefully out of date. ignore it!","commit_id":"198faa66a2e4ac23edd52c4a00de11470991e70b"},{"author":{"_account_id":748,"name":"Armando Migliaccio","email":"armamig@gmail.com","username":"armando-migliaccio"},"change_message_id":"8a326f710bded62600f4f419bbc891d24890048c","unresolved":false,"context_lines":[{"line_number":18,"context_line":"This patch also adjusts the delete_port policy to add an allow for"},{"line_number":19,"context_line":"each field with policy enforced so it actually lets the request goes"},{"line_number":20,"context_line":"through. Specifying this seems excessive so the enforcement of policy"},{"line_number":21,"context_line":"on fields for a delete request should be revisited."},{"line_number":22,"context_line":""},{"line_number":23,"context_line":"Finally, it enables the API test that was skipped because of this broken"},{"line_number":24,"context_line":"behavior."}],"source_content_type":"text/x-gerrit-commit-message","patch_set":3,"id":"5a2ca52d_07f6598f","line":21,"updated":"2015-10-14 05:10:12.000000000","message":"so basically you\u0027re having a policy redirect? How odd.","commit_id":"198faa66a2e4ac23edd52c4a00de11470991e70b"},{"author":{"_account_id":7787,"name":"Kevin Benton","email":"kevin@benton.pub","username":"blak111"},"change_message_id":"c5af97a848eb423bb2c2fc9f6084f1f9579e3581","unresolved":false,"context_lines":[{"line_number":18,"context_line":"This patch also adjusts the delete_port policy to add an allow for"},{"line_number":19,"context_line":"each field with policy enforced so it actually lets the request goes"},{"line_number":20,"context_line":"through. Specifying this seems excessive so the enforcement of policy"},{"line_number":21,"context_line":"on fields for a delete request should be revisited."},{"line_number":22,"context_line":""},{"line_number":23,"context_line":"Finally, it enables the API test that was skipped because of this broken"},{"line_number":24,"context_line":"behavior."}],"source_content_type":"text/x-gerrit-commit-message","patch_set":3,"id":"5a2ca52d_003b7a9d","line":21,"in_reply_to":"5a2ca52d_07f6598f","updated":"2015-10-14 20:44:48.000000000","message":"no redirect, just some weird inheritance. Salvatore suspects a bug.","commit_id":"198faa66a2e4ac23edd52c4a00de11470991e70b"}],"etc/policy.json":[{"author":{"_account_id":2874,"name":"yong sheng gong","email":"gong.yongsheng@99cloud.net","username":"gongysh"},"change_message_id":"58fd8f26d75e57182d91751baed52bca65469d49","unresolved":false,"context_lines":[{"line_number":83,"context_line":"    \"update_port:allowed_address_pairs\": \"rule:admin_or_network_owner\","},{"line_number":84,"context_line":""},{"line_number":85,"context_line":"    \"delete_port\": \"rule:admin_owner_or_network_owner or rule:context_is_advsvc\","},{"line_number":86,"context_line":"    \"delete_port:mac_address\": \"rule:delete_port\","},{"line_number":87,"context_line":"    \"delete_port:binding:host_id\": \"rule:delete_port\","},{"line_number":88,"context_line":"    \"delete_port:binding:profile\": \"rule:delete_port\","},{"line_number":89,"context_line":"    \"delete_port:binding:vif_details\": \"rule:delete_port\","}],"source_content_type":"application/json","patch_set":2,"id":"ba15a1d1_8a1ae9c4","line":86,"updated":"2015-09-24 02:15:02.000000000","message":"I thought subfield rule will inherit parent, was I wrong?","commit_id":"c9e7107d855e1d20984b8e07b0b0117a1670d0b7"},{"author":{"_account_id":7787,"name":"Kevin Benton","email":"kevin@benton.pub","username":"blak111"},"change_message_id":"6ba7822f784b35e2639a7d8b627578f34a0d5719","unresolved":false,"context_lines":[{"line_number":83,"context_line":"    \"update_port:allowed_address_pairs\": \"rule:admin_or_network_owner\","},{"line_number":84,"context_line":""},{"line_number":85,"context_line":"    \"delete_port\": \"rule:admin_owner_or_network_owner or rule:context_is_advsvc\","},{"line_number":86,"context_line":"    \"delete_port:mac_address\": \"rule:delete_port\","},{"line_number":87,"context_line":"    \"delete_port:binding:host_id\": \"rule:delete_port\","},{"line_number":88,"context_line":"    \"delete_port:binding:profile\": \"rule:delete_port\","},{"line_number":89,"context_line":"    \"delete_port:binding:vif_details\": \"rule:delete_port\","}],"source_content_type":"application/json","patch_set":2,"id":"7a2fa921_35d07153","line":86,"in_reply_to":"9a1a9d01_8e5c82ee","updated":"2015-10-06 05:09:38.000000000","message":"thanks","commit_id":"c9e7107d855e1d20984b8e07b0b0117a1670d0b7"},{"author":{"_account_id":7787,"name":"Kevin Benton","email":"kevin@benton.pub","username":"blak111"},"change_message_id":"abe9fcb98b165fc1f9f8074a7a790c120cc74f24","unresolved":false,"context_lines":[{"line_number":83,"context_line":"    \"update_port:allowed_address_pairs\": \"rule:admin_or_network_owner\","},{"line_number":84,"context_line":""},{"line_number":85,"context_line":"    \"delete_port\": \"rule:admin_owner_or_network_owner or rule:context_is_advsvc\","},{"line_number":86,"context_line":"    \"delete_port:mac_address\": \"rule:delete_port\","},{"line_number":87,"context_line":"    \"delete_port:binding:host_id\": \"rule:delete_port\","},{"line_number":88,"context_line":"    \"delete_port:binding:profile\": \"rule:delete_port\","},{"line_number":89,"context_line":"    \"delete_port:binding:vif_details\": \"rule:delete_port\","}],"source_content_type":"application/json","patch_set":2,"id":"ba15a1d1_d0e5ee08","line":86,"in_reply_to":"ba15a1d1_8a1ae9c4","updated":"2015-09-24 03:00:05.000000000","message":"it doesn\u0027t appear to on delete operations.","commit_id":"c9e7107d855e1d20984b8e07b0b0117a1670d0b7"},{"author":{"_account_id":261,"name":"Salvatore Orlando","email":"salv.orlando@gmail.com","username":"salvatore-orlando"},"change_message_id":"703c8c1c7ae23d302c413bc666f0d89de2af51a5","unresolved":false,"context_lines":[{"line_number":83,"context_line":"    \"update_port:allowed_address_pairs\": \"rule:admin_or_network_owner\","},{"line_number":84,"context_line":""},{"line_number":85,"context_line":"    \"delete_port\": \"rule:admin_owner_or_network_owner or rule:context_is_advsvc\","},{"line_number":86,"context_line":"    \"delete_port:mac_address\": \"rule:delete_port\","},{"line_number":87,"context_line":"    \"delete_port:binding:host_id\": \"rule:delete_port\","},{"line_number":88,"context_line":"    \"delete_port:binding:profile\": \"rule:delete_port\","},{"line_number":89,"context_line":"    \"delete_port:binding:vif_details\": \"rule:delete_port\","}],"source_content_type":"application/json","patch_set":2,"id":"9a1a9d01_8e5c82ee","line":86,"in_reply_to":"ba15a1d1_bde5b209","updated":"2015-09-28 14:36:40.000000000","message":"you shouldn\u0027t need this rules at all.\nYou have probably uncovered or introduced a bug. I\u0027ll check your patch in a bit and let you know","commit_id":"c9e7107d855e1d20984b8e07b0b0117a1670d0b7"},{"author":{"_account_id":2874,"name":"yong sheng gong","email":"gong.yongsheng@99cloud.net","username":"gongysh"},"change_message_id":"7ffc03efc7e51577d2ee7133bb81a9e1adf1faf5","unresolved":false,"context_lines":[{"line_number":83,"context_line":"    \"update_port:allowed_address_pairs\": \"rule:admin_or_network_owner\","},{"line_number":84,"context_line":""},{"line_number":85,"context_line":"    \"delete_port\": \"rule:admin_owner_or_network_owner or rule:context_is_advsvc\","},{"line_number":86,"context_line":"    \"delete_port:mac_address\": \"rule:delete_port\","},{"line_number":87,"context_line":"    \"delete_port:binding:host_id\": \"rule:delete_port\","},{"line_number":88,"context_line":"    \"delete_port:binding:profile\": \"rule:delete_port\","},{"line_number":89,"context_line":"    \"delete_port:binding:vif_details\": \"rule:delete_port\","}],"source_content_type":"application/json","patch_set":2,"id":"ba15a1d1_bde5b209","line":86,"in_reply_to":"ba15a1d1_d0e5ee08","updated":"2015-09-24 04:35:20.000000000","message":"weird.","commit_id":"c9e7107d855e1d20984b8e07b0b0117a1670d0b7"},{"author":{"_account_id":748,"name":"Armando Migliaccio","email":"armamig@gmail.com","username":"armando-migliaccio"},"change_message_id":"8a326f710bded62600f4f419bbc891d24890048c","unresolved":false,"context_lines":[{"line_number":88,"context_line":"    \"delete_port:binding:profile\": \"rule:delete_port\","},{"line_number":89,"context_line":"    \"delete_port:binding:vif_details\": \"rule:delete_port\","},{"line_number":90,"context_line":"    \"delete_port:binding:vif_type\": \"rule:delete_port\","},{"line_number":91,"context_line":"    \"delete_port:binding:mac_learning_enabled\": \"rule:delete_port\","},{"line_number":92,"context_line":"    \"delete_port:port_security_enabled\": \"rule:delete_port\","},{"line_number":93,"context_line":"    \"delete_port:allowed_address_pairs\": \"rule:delete_port\","},{"line_number":94,"context_line":"    \"delete_port:fixed_ips\": \"rule:delete_port\","}],"source_content_type":"application/json","patch_set":3,"id":"5a2ca52d_87090998","line":91,"updated":"2015-10-14 05:10:12.000000000","message":"mac learning is a legacy of the nsx plugin. There\u0027s no such an attribute extension anymore. I think that the NSX plugin installs its own policy rules so this should be cleaned up.","commit_id":"198faa66a2e4ac23edd52c4a00de11470991e70b"},{"author":{"_account_id":7787,"name":"Kevin Benton","email":"kevin@benton.pub","username":"blak111"},"change_message_id":"c5af97a848eb423bb2c2fc9f6084f1f9579e3581","unresolved":false,"context_lines":[{"line_number":88,"context_line":"    \"delete_port:binding:profile\": \"rule:delete_port\","},{"line_number":89,"context_line":"    \"delete_port:binding:vif_details\": \"rule:delete_port\","},{"line_number":90,"context_line":"    \"delete_port:binding:vif_type\": \"rule:delete_port\","},{"line_number":91,"context_line":"    \"delete_port:binding:mac_learning_enabled\": \"rule:delete_port\","},{"line_number":92,"context_line":"    \"delete_port:port_security_enabled\": \"rule:delete_port\","},{"line_number":93,"context_line":"    \"delete_port:allowed_address_pairs\": \"rule:delete_port\","},{"line_number":94,"context_line":"    \"delete_port:fixed_ips\": \"rule:delete_port\","}],"source_content_type":"application/json","patch_set":3,"id":"5a2ca52d_458f44cc","line":91,"in_reply_to":"5a2ca52d_87090998","updated":"2015-10-14 20:44:48.000000000","message":"I think that needs to be done separately. Due to the funkiness of the policy engine I had to specify these for everything attr with policy required.","commit_id":"198faa66a2e4ac23edd52c4a00de11470991e70b"},{"author":{"_account_id":261,"name":"Salvatore Orlando","email":"salv.orlando@gmail.com","username":"salvatore-orlando"},"change_message_id":"5bfc6338d4e19f8761a9f549d7b7283172ce6151","unresolved":false,"context_lines":[{"line_number":91,"context_line":"    \"delete_port:binding:mac_learning_enabled\": \"rule:delete_port\","},{"line_number":92,"context_line":"    \"delete_port:port_security_enabled\": \"rule:delete_port\","},{"line_number":93,"context_line":"    \"delete_port:allowed_address_pairs\": \"rule:delete_port\","},{"line_number":94,"context_line":"    \"delete_port:fixed_ips\": \"rule:delete_port\","},{"line_number":95,"context_line":""},{"line_number":96,"context_line":"    \"get_router:ha\": \"rule:admin_only\","},{"line_number":97,"context_line":"    \"create_router\": \"rule:regular_user\","}],"source_content_type":"application/json","patch_set":4,"id":"ba8a016a_941b39ca","line":94,"updated":"2015-11-23 12:40:41.000000000","message":"I think the need for this exposes an underlying bug, but it\u0027s not your business fixing it (the change ipam_backend_mixin should be the trigger imho)\n\nI (or somebody else) will look into it separately.\nUntil then, this patch should probably bear an UpgradeImpact tag in the commit message (operators will need to update their policy.json files)","commit_id":"0d3493be53f5ec686ea5aed469bf87821497af79"}],"neutron/api/v2/base.py":[{"author":{"_account_id":2874,"name":"yong sheng gong","email":"gong.yongsheng@99cloud.net","username":"gongysh"},"change_message_id":"58fd8f26d75e57182d91751baed52bca65469d49","unresolved":false,"context_lines":[{"line_number":685,"context_line":"        # in the policy engine"},{"line_number":686,"context_line":"        if (request.context.is_admin or request.context.is_advsvc or"},{"line_number":687,"context_line":"                self._resource not in (\u0027port\u0027, \u0027subnet\u0027)):"},{"line_number":688,"context_line":"            return"},{"line_number":689,"context_line":"        network \u003d self._plugin.get_network("},{"line_number":690,"context_line":"            request.context,"},{"line_number":691,"context_line":"            resource_item[\u0027network_id\u0027])"}],"source_content_type":"text/x-python","patch_set":2,"id":"ba15a1d1_2abddd67","line":688,"updated":"2015-09-24 02:15:02.000000000","message":"In origin codes, I am wondering\nif context is not admin, or advsvc,  to get other tenant\u0027s  network, it should raise not found error, how can the flow continue?","commit_id":"c9e7107d855e1d20984b8e07b0b0117a1670d0b7"},{"author":{"_account_id":7787,"name":"Kevin Benton","email":"kevin@benton.pub","username":"blak111"},"change_message_id":"abe9fcb98b165fc1f9f8074a7a790c120cc74f24","unresolved":false,"context_lines":[{"line_number":685,"context_line":"        # in the policy engine"},{"line_number":686,"context_line":"        if (request.context.is_admin or request.context.is_advsvc or"},{"line_number":687,"context_line":"                self._resource not in (\u0027port\u0027, \u0027subnet\u0027)):"},{"line_number":688,"context_line":"            return"},{"line_number":689,"context_line":"        network \u003d self._plugin.get_network("},{"line_number":690,"context_line":"            request.context,"},{"line_number":691,"context_line":"            resource_item[\u0027network_id\u0027])"}],"source_content_type":"text/x-python","patch_set":2,"id":"ba15a1d1_b0cf1a7e","line":688,"in_reply_to":"ba15a1d1_2abddd67","updated":"2015-09-24 03:00:05.000000000","message":"the network will have \u0027shared\u0027 set from the perspective of the requesting tenant","commit_id":"c9e7107d855e1d20984b8e07b0b0117a1670d0b7"},{"author":{"_account_id":2874,"name":"yong sheng gong","email":"gong.yongsheng@99cloud.net","username":"gongysh"},"change_message_id":"7ffc03efc7e51577d2ee7133bb81a9e1adf1faf5","unresolved":false,"context_lines":[{"line_number":692,"context_line":"        # do not perform the check on shared networks"},{"line_number":693,"context_line":"        if network.get(\u0027shared\u0027):"},{"line_number":694,"context_line":"            return"},{"line_number":695,"context_line":""},{"line_number":696,"context_line":"        network_owner \u003d network[\u0027tenant_id\u0027]"},{"line_number":697,"context_line":""},{"line_number":698,"context_line":"        if network_owner !\u003d resource_item[\u0027tenant_id\u0027]:"}],"source_content_type":"text/x-python","patch_set":2,"id":"ba15a1d1_fddeca3c","line":695,"updated":"2015-09-24 04:35:20.000000000","message":"maybe we should add a comment here, in reference implementation, the codes after 696 seems cannot be reached at all.","commit_id":"c9e7107d855e1d20984b8e07b0b0117a1670d0b7"},{"author":{"_account_id":7787,"name":"Kevin Benton","email":"kevin@benton.pub","username":"blak111"},"change_message_id":"693752ee0f4d508d469f5b61875542167506b2a1","unresolved":false,"context_lines":[{"line_number":692,"context_line":"        # do not perform the check on shared networks"},{"line_number":693,"context_line":"        if network.get(\u0027shared\u0027):"},{"line_number":694,"context_line":"            return"},{"line_number":695,"context_line":""},{"line_number":696,"context_line":"        network_owner \u003d network[\u0027tenant_id\u0027]"},{"line_number":697,"context_line":""},{"line_number":698,"context_line":"        if network_owner !\u003d resource_item[\u0027tenant_id\u0027]:"}],"source_content_type":"text/x-python","patch_set":2,"id":"ba15a1d1_738ae965","line":695,"in_reply_to":"ba15a1d1_fddeca3c","updated":"2015-09-24 05:57:49.000000000","message":"they will be after this patch.","commit_id":"c9e7107d855e1d20984b8e07b0b0117a1670d0b7"},{"author":{"_account_id":261,"name":"Salvatore Orlando","email":"salv.orlando@gmail.com","username":"salvatore-orlando"},"change_message_id":"703c8c1c7ae23d302c413bc666f0d89de2af51a5","unresolved":false,"context_lines":[{"line_number":698,"context_line":"        if network_owner !\u003d resource_item[\u0027tenant_id\u0027]:"},{"line_number":699,"context_line":"            msg \u003d _(\"Tenant %(tenant_id)s not allowed to \""},{"line_number":700,"context_line":"                    \"create %(resource)s on this network\")"},{"line_number":701,"context_line":"            # NOTE(kevinbenton): should this be a 404 instead?"},{"line_number":702,"context_line":"            raise webob.exc.HTTPForbidden(msg % {"},{"line_number":703,"context_line":"                \"tenant_id\": resource_item[\u0027tenant_id\u0027],"},{"line_number":704,"context_line":"                \"resource\": self._resource,"}],"source_content_type":"text/x-python","patch_set":2,"id":"9a1a9d01_6e27ae64","line":701,"updated":"2015-09-28 14:36:40.000000000","message":"probably","commit_id":"c9e7107d855e1d20984b8e07b0b0117a1670d0b7"},{"author":{"_account_id":7787,"name":"Kevin Benton","email":"kevin@benton.pub","username":"blak111"},"change_message_id":"7a80a5b7bd57e9536d6dd9fac99bc8f3edde3735","unresolved":false,"context_lines":[{"line_number":698,"context_line":"        if network_owner !\u003d resource_item[\u0027tenant_id\u0027]:"},{"line_number":699,"context_line":"            msg \u003d _(\"Tenant %(tenant_id)s not allowed to \""},{"line_number":700,"context_line":"                    \"create %(resource)s on this network\")"},{"line_number":701,"context_line":"            # NOTE(kevinbenton): should this be a 404 instead?"},{"line_number":702,"context_line":"            raise webob.exc.HTTPForbidden(msg % {"},{"line_number":703,"context_line":"                \"tenant_id\": resource_item[\u0027tenant_id\u0027],"},{"line_number":704,"context_line":"                \"resource\": self._resource,"}],"source_content_type":"text/x-python","patch_set":2,"id":"5a2ca52d_e8c5375b","line":701,"in_reply_to":"9a1a9d01_6e27ae64","updated":"2015-10-13 22:22:25.000000000","message":"Done","commit_id":"c9e7107d855e1d20984b8e07b0b0117a1670d0b7"},{"author":{"_account_id":748,"name":"Armando Migliaccio","email":"armamig@gmail.com","username":"armando-migliaccio"},"change_message_id":"8a326f710bded62600f4f419bbc891d24890048c","unresolved":false,"context_lines":[{"line_number":699,"context_line":"            # NOTE(kevinbenton): we raise a 404 to hide the existence of the"},{"line_number":700,"context_line":"            # network from the tenant since they don\u0027t have access to it."},{"line_number":701,"context_line":"            msg \u003d _(\u0027The resource could not be found.\u0027)"},{"line_number":702,"context_line":"            raise webob.exc.HTTPNotFound(msg)"},{"line_number":703,"context_line":""},{"line_number":704,"context_line":""},{"line_number":705,"context_line":"def create_resource(collection, resource, plugin, params, allow_bulk\u003dFalse,"}],"source_content_type":"text/x-python","patch_set":3,"id":"5a2ca52d_473a1138","line":702,"updated":"2015-10-14 05:10:12.000000000","message":"this looks like a non-backward compatible change of the API return value. We can\u0027t do this willy-nilly, especially if this has been in place for a long, long time.","commit_id":"198faa66a2e4ac23edd52c4a00de11470991e70b"},{"author":{"_account_id":7787,"name":"Kevin Benton","email":"kevin@benton.pub","username":"blak111"},"change_message_id":"c5af97a848eb423bb2c2fc9f6084f1f9579e3581","unresolved":false,"context_lines":[{"line_number":699,"context_line":"            # NOTE(kevinbenton): we raise a 404 to hide the existence of the"},{"line_number":700,"context_line":"            # network from the tenant since they don\u0027t have access to it."},{"line_number":701,"context_line":"            msg \u003d _(\u0027The resource could not be found.\u0027)"},{"line_number":702,"context_line":"            raise webob.exc.HTTPNotFound(msg)"},{"line_number":703,"context_line":""},{"line_number":704,"context_line":""},{"line_number":705,"context_line":"def create_resource(collection, resource, plugin, params, allow_bulk\u003dFalse,"}],"source_content_type":"text/x-python","patch_set":3,"id":"5a2ca52d_2559e85a","line":702,"in_reply_to":"5a2ca52d_473a1138","updated":"2015-10-14 20:44:48.000000000","message":"This was unreachable code before in db based implementations because the get_network call would fail with a 404.\n\nIt\u0027s actually still unreachable now that Salvatore had me update get_by_id to conditionally be scoped for port queries only. I can probably undo this change with that there now.","commit_id":"198faa66a2e4ac23edd52c4a00de11470991e70b"},{"author":{"_account_id":7787,"name":"Kevin Benton","email":"kevin@benton.pub","username":"blak111"},"change_message_id":"f5c7e2b508c3407b8c74ce26c410cfcf0b90c22f","unresolved":false,"context_lines":[{"line_number":696,"context_line":"        network_owner \u003d network[\u0027tenant_id\u0027]"},{"line_number":697,"context_line":""},{"line_number":698,"context_line":"        if network_owner !\u003d resource_item[\u0027tenant_id\u0027]:"},{"line_number":699,"context_line":"            # NOTE(kevinbenton): we raise a 404 to hide the existence of the"},{"line_number":700,"context_line":"            # network from the tenant since they don\u0027t have access to it."},{"line_number":701,"context_line":"            msg \u003d _(\u0027The resource could not be found.\u0027)"},{"line_number":702,"context_line":"            raise webob.exc.HTTPNotFound(msg)"}],"source_content_type":"text/x-python","patch_set":4,"id":"ba8a016a_8c75aa33","line":699,"updated":"2015-11-20 17:47:02.000000000","message":"note to reviewers. This was dead code before. Now this patch has made it reachable so this change is to actually preserve the previous error code even though it looks like it\u0027s changing.","commit_id":"0d3493be53f5ec686ea5aed469bf87821497af79"}],"neutron/context.py":[{"author":{"_account_id":261,"name":"Salvatore Orlando","email":"salv.orlando@gmail.com","username":"salvatore-orlando"},"change_message_id":"703c8c1c7ae23d302c413bc666f0d89de2af51a5","unresolved":false,"context_lines":[{"line_number":66,"context_line":"            self.is_advsvc \u003d self.is_admin or policy.check_is_advsvc(self)"},{"line_number":67,"context_line":"        if self.is_admin is None:"},{"line_number":68,"context_line":"            self.is_admin \u003d policy.check_is_admin(self)"},{"line_number":69,"context_line":"        self.un_scoped \u003d False"},{"line_number":70,"context_line":""},{"line_number":71,"context_line":"    @property"},{"line_number":72,"context_line":"    def project_id(self):"}],"source_content_type":"text/x-python","patch_set":2,"id":"9a1a9d01_2ed3f605","line":69,"updated":"2015-09-28 14:36:40.000000000","message":"I\u0027d rather had:\n\nself.scoped \u003d True\n\nI don\u0027t know, it just sounds more... human","commit_id":"c9e7107d855e1d20984b8e07b0b0117a1670d0b7"},{"author":{"_account_id":7787,"name":"Kevin Benton","email":"kevin@benton.pub","username":"blak111"},"change_message_id":"83561859075af125315ddf36810f2e766ba01391","unresolved":false,"context_lines":[{"line_number":66,"context_line":"            self.is_advsvc \u003d self.is_admin or policy.check_is_advsvc(self)"},{"line_number":67,"context_line":"        if self.is_admin is None:"},{"line_number":68,"context_line":"            self.is_admin \u003d policy.check_is_admin(self)"},{"line_number":69,"context_line":"        self.un_scoped \u003d False"},{"line_number":70,"context_line":""},{"line_number":71,"context_line":"    @property"},{"line_number":72,"context_line":"    def project_id(self):"}],"source_content_type":"text/x-python","patch_set":2,"id":"7a2fa921_d5ac9def","line":69,"in_reply_to":"9a1a9d01_2ed3f605","updated":"2015-10-06 05:09:25.000000000","message":"sounds good","commit_id":"c9e7107d855e1d20984b8e07b0b0117a1670d0b7"},{"author":{"_account_id":748,"name":"Armando Migliaccio","email":"armamig@gmail.com","username":"armando-migliaccio"},"change_message_id":"8a326f710bded62600f4f419bbc891d24890048c","unresolved":false,"context_lines":[{"line_number":66,"context_line":"            self.is_advsvc \u003d self.is_admin or policy.check_is_advsvc(self)"},{"line_number":67,"context_line":"        if self.is_admin is None:"},{"line_number":68,"context_line":"            self.is_admin \u003d policy.check_is_admin(self)"},{"line_number":69,"context_line":"        self.scoped \u003d True"},{"line_number":70,"context_line":""},{"line_number":71,"context_line":"    @property"},{"line_number":72,"context_line":"    def project_id(self):"}],"source_content_type":"text/x-python","patch_set":3,"id":"5a2ca52d_0724190b","line":69,"updated":"2015-10-14 05:10:12.000000000","message":"can you be kind and tell us what this is?","commit_id":"198faa66a2e4ac23edd52c4a00de11470991e70b"},{"author":{"_account_id":7787,"name":"Kevin Benton","email":"kevin@benton.pub","username":"blak111"},"change_message_id":"c5af97a848eb423bb2c2fc9f6084f1f9579e3581","unresolved":false,"context_lines":[{"line_number":66,"context_line":"            self.is_advsvc \u003d self.is_admin or policy.check_is_advsvc(self)"},{"line_number":67,"context_line":"        if self.is_admin is None:"},{"line_number":68,"context_line":"            self.is_admin \u003d policy.check_is_admin(self)"},{"line_number":69,"context_line":"        self.scoped \u003d True"},{"line_number":70,"context_line":""},{"line_number":71,"context_line":"    @property"},{"line_number":72,"context_line":"    def project_id(self):"}],"source_content_type":"text/x-python","patch_set":3,"id":"5a2ca52d_8521dcb6","line":69,"in_reply_to":"5a2ca52d_0724190b","updated":"2015-10-14 20:44:48.000000000","message":"The opposite of un_scoped! ;)\n\nI will add a comment on next respin.","commit_id":"198faa66a2e4ac23edd52c4a00de11470991e70b"},{"author":{"_account_id":261,"name":"Salvatore Orlando","email":"salv.orlando@gmail.com","username":"salvatore-orlando"},"change_message_id":"5bfc6338d4e19f8761a9f549d7b7283172ce6151","unresolved":false,"context_lines":[{"line_number":69,"context_line":"        # The \u0027scoped\u0027 variable may be set to False to indicate that a DB"},{"line_number":70,"context_line":"        # operation should not be scoped to to the context tenant ID even"},{"line_number":71,"context_line":"        # if it isn\u0027t an admin or an advanced service."},{"line_number":72,"context_line":"        self.scoped \u003d True"},{"line_number":73,"context_line":""},{"line_number":74,"context_line":"    @property"},{"line_number":75,"context_line":"    def project_id(self):"}],"source_content_type":"text/x-python","patch_set":4,"id":"ba8a016a_94a57948","line":72,"updated":"2015-11-23 12:40:41.000000000","message":"I need to be super ultra pedant here ;)\n\nSince scope only applies to DB operations it should be an attribute of Context, not ContextBase, as the class Context does not have a session...","commit_id":"0d3493be53f5ec686ea5aed469bf87821497af79"},{"author":{"_account_id":7787,"name":"Kevin Benton","email":"kevin@benton.pub","username":"blak111"},"change_message_id":"fbc0187f2e2302cb7cf173a2a3f27a7ec4b77727","unresolved":false,"context_lines":[{"line_number":69,"context_line":"        # The \u0027scoped\u0027 variable may be set to False to indicate that a DB"},{"line_number":70,"context_line":"        # operation should not be scoped to to the context tenant ID even"},{"line_number":71,"context_line":"        # if it isn\u0027t an admin or an advanced service."},{"line_number":72,"context_line":"        self.scoped \u003d True"},{"line_number":73,"context_line":""},{"line_number":74,"context_line":"    @property"},{"line_number":75,"context_line":"    def project_id(self):"}],"source_content_type":"text/x-python","patch_set":4,"id":"9a8ffd7b_3b59105b","line":72,"in_reply_to":"ba8a016a_94a57948","updated":"2015-11-25 17:28:35.000000000","message":"I have brought shame to me and my family!","commit_id":"0d3493be53f5ec686ea5aed469bf87821497af79"}],"neutron/db/common_db_mixin.py":[{"author":{"_account_id":2874,"name":"yong sheng gong","email":"gong.yongsheng@99cloud.net","username":"gongysh"},"change_message_id":"58fd8f26d75e57182d91751baed52bca65469d49","unresolved":false,"context_lines":[{"line_number":181,"context_line":"            tenant_id \u003d context.tenant_id"},{"line_number":182,"context_line":"        return tenant_id"},{"line_number":183,"context_line":""},{"line_number":184,"context_line":"    def _get_by_id(self, context, model, id):"},{"line_number":185,"context_line":"        # NOTE(kevinbenton): we don\u0027t scope to tenant here since we are"},{"line_number":186,"context_line":"        # looking for a specific object by it\u0027s ID. We allow the policy"},{"line_number":187,"context_line":"        # layer to verify that the correct tenants are looking/modifying"}],"source_content_type":"text/x-python","patch_set":2,"id":"ba15a1d1_4a1e1171","line":184,"updated":"2015-09-24 02:15:02.000000000","message":"I think there are codes relying on original meaning to do tenant isolation. This change likely introduces security loop.","commit_id":"c9e7107d855e1d20984b8e07b0b0117a1670d0b7"},{"author":{"_account_id":7787,"name":"Kevin Benton","email":"kevin@benton.pub","username":"blak111"},"change_message_id":"abe9fcb98b165fc1f9f8074a7a790c120cc74f24","unresolved":false,"context_lines":[{"line_number":181,"context_line":"            tenant_id \u003d context.tenant_id"},{"line_number":182,"context_line":"        return tenant_id"},{"line_number":183,"context_line":""},{"line_number":184,"context_line":"    def _get_by_id(self, context, model, id):"},{"line_number":185,"context_line":"        # NOTE(kevinbenton): we don\u0027t scope to tenant here since we are"},{"line_number":186,"context_line":"        # looking for a specific object by it\u0027s ID. We allow the policy"},{"line_number":187,"context_line":"        # layer to verify that the correct tenants are looking/modifying"}],"source_content_type":"text/x-python","patch_set":2,"id":"ba15a1d1_70c5025a","line":184,"in_reply_to":"ba15a1d1_4a1e1171","updated":"2015-09-24 03:00:05.000000000","message":"we can\u0027t depend on this for security isolation. that\u0027s what the policy engine is for","commit_id":"c9e7107d855e1d20984b8e07b0b0117a1670d0b7"},{"author":{"_account_id":7787,"name":"Kevin Benton","email":"kevin@benton.pub","username":"blak111"},"change_message_id":"693752ee0f4d508d469f5b61875542167506b2a1","unresolved":false,"context_lines":[{"line_number":181,"context_line":"            tenant_id \u003d context.tenant_id"},{"line_number":182,"context_line":"        return tenant_id"},{"line_number":183,"context_line":""},{"line_number":184,"context_line":"    def _get_by_id(self, context, model, id):"},{"line_number":185,"context_line":"        # NOTE(kevinbenton): we don\u0027t scope to tenant here since we are"},{"line_number":186,"context_line":"        # looking for a specific object by it\u0027s ID. We allow the policy"},{"line_number":187,"context_line":"        # layer to verify that the correct tenants are looking/modifying"}],"source_content_type":"text/x-python","patch_set":2,"id":"ba15a1d1_f3f4b9f1","line":184,"in_reply_to":"ba15a1d1_6b4677c1","updated":"2015-09-24 05:57:49.000000000","message":"model_query_scope is still important for list requests to avoid retrieving the whole database and breaking pagination.","commit_id":"c9e7107d855e1d20984b8e07b0b0117a1670d0b7"},{"author":{"_account_id":2874,"name":"yong sheng gong","email":"gong.yongsheng@99cloud.net","username":"gongysh"},"change_message_id":"7ffc03efc7e51577d2ee7133bb81a9e1adf1faf5","unresolved":false,"context_lines":[{"line_number":181,"context_line":"            tenant_id \u003d context.tenant_id"},{"line_number":182,"context_line":"        return tenant_id"},{"line_number":183,"context_line":""},{"line_number":184,"context_line":"    def _get_by_id(self, context, model, id):"},{"line_number":185,"context_line":"        # NOTE(kevinbenton): we don\u0027t scope to tenant here since we are"},{"line_number":186,"context_line":"        # looking for a specific object by it\u0027s ID. We allow the policy"},{"line_number":187,"context_line":"        # layer to verify that the correct tenants are looking/modifying"}],"source_content_type":"text/x-python","patch_set":2,"id":"ba15a1d1_6b4677c1","line":184,"in_reply_to":"ba15a1d1_70c5025a","updated":"2015-09-24 04:35:20.000000000","message":"If we think it is, why not just remove model_query_scope? your context.un_scoped is always True","commit_id":"c9e7107d855e1d20984b8e07b0b0117a1670d0b7"},{"author":{"_account_id":261,"name":"Salvatore Orlando","email":"salv.orlando@gmail.com","username":"salvatore-orlando"},"change_message_id":"703c8c1c7ae23d302c413bc666f0d89de2af51a5","unresolved":false,"context_lines":[{"line_number":188,"context_line":"        # objects they are supposed to."},{"line_number":189,"context_line":"        context.un_scoped \u003d True"},{"line_number":190,"context_line":"        query \u003d self._model_query(context, model)"},{"line_number":191,"context_line":"        return query.filter(model.id \u003d\u003d id).one()"},{"line_number":192,"context_line":""},{"line_number":193,"context_line":"    @staticmethod"},{"line_number":194,"context_line":"    def _get_rbac_query_params(model):"}],"source_content_type":"text/x-python","patch_set":2,"id":"9a1a9d01_0e7e32ae","line":191,"updated":"2015-09-28 14:36:40.000000000","message":"The pedant scoping of queries by tenant_id is a way to ensure some additional layer of security even in the event that the policy engine was bypassed (however, the true story is that it got added before the policy engine, and then considered helpful).\n\nI am ok with relaxing this, but I wonder if it would be possible to add a keyword parameter to get_by_id to instruct it whether it should or shouldn\u0027t scope by tenant_id. If you think that it is unlikely for neutron authZ to become compromised, think again: I\u0027ve written good chunks of it. This should be enough to scare you.","commit_id":"c9e7107d855e1d20984b8e07b0b0117a1670d0b7"},{"author":{"_account_id":7787,"name":"Kevin Benton","email":"kevin@benton.pub","username":"blak111"},"change_message_id":"83561859075af125315ddf36810f2e766ba01391","unresolved":false,"context_lines":[{"line_number":188,"context_line":"        # objects they are supposed to."},{"line_number":189,"context_line":"        context.un_scoped \u003d True"},{"line_number":190,"context_line":"        query \u003d self._model_query(context, model)"},{"line_number":191,"context_line":"        return query.filter(model.id \u003d\u003d id).one()"},{"line_number":192,"context_line":""},{"line_number":193,"context_line":"    @staticmethod"},{"line_number":194,"context_line":"    def _get_rbac_query_params(model):"}],"source_content_type":"text/x-python","patch_set":2,"id":"7a2fa921_958dc57d","line":191,"in_reply_to":"9a1a9d01_0e7e32ae","updated":"2015-10-06 05:09:25.000000000","message":"ok","commit_id":"c9e7107d855e1d20984b8e07b0b0117a1670d0b7"},{"author":{"_account_id":748,"name":"Armando Migliaccio","email":"armamig@gmail.com","username":"armando-migliaccio"},"change_message_id":"8a326f710bded62600f4f419bbc891d24890048c","unresolved":false,"context_lines":[{"line_number":182,"context_line":"        return tenant_id"},{"line_number":183,"context_line":""},{"line_number":184,"context_line":"    def _get_by_id(self, context, model, id, scoped\u003dTrue):"},{"line_number":185,"context_line":"        # NOTE(kevinbenton): we have the option to not scope to tenant"},{"line_number":186,"context_line":"        # here since we are looking for a specific object by it\u0027s ID."},{"line_number":187,"context_line":"        # In this case we allow the policy layer to verify that the correct"},{"line_number":188,"context_line":"        # tenants are looking at/modifying objects they are supposed to."}],"source_content_type":"text/x-python","patch_set":3,"id":"5a2ca52d_278355ce","line":185,"updated":"2015-10-14 05:10:12.000000000","message":"to not scope -\u003e not to scope ?","commit_id":"198faa66a2e4ac23edd52c4a00de11470991e70b"},{"author":{"_account_id":7787,"name":"Kevin Benton","email":"kevin@benton.pub","username":"blak111"},"change_message_id":"c5af97a848eb423bb2c2fc9f6084f1f9579e3581","unresolved":false,"context_lines":[{"line_number":182,"context_line":"        return tenant_id"},{"line_number":183,"context_line":""},{"line_number":184,"context_line":"    def _get_by_id(self, context, model, id, scoped\u003dTrue):"},{"line_number":185,"context_line":"        # NOTE(kevinbenton): we have the option to not scope to tenant"},{"line_number":186,"context_line":"        # here since we are looking for a specific object by it\u0027s ID."},{"line_number":187,"context_line":"        # In this case we allow the policy layer to verify that the correct"},{"line_number":188,"context_line":"        # tenants are looking at/modifying objects they are supposed to."}],"source_content_type":"text/x-python","patch_set":3,"id":"5a2ca52d_452bc494","line":185,"in_reply_to":"5a2ca52d_278355ce","updated":"2015-10-14 20:44:48.000000000","message":"Done","commit_id":"198faa66a2e4ac23edd52c4a00de11470991e70b"},{"author":{"_account_id":748,"name":"Armando Migliaccio","email":"armamig@gmail.com","username":"armando-migliaccio"},"change_message_id":"8a326f710bded62600f4f419bbc891d24890048c","unresolved":false,"context_lines":[{"line_number":183,"context_line":""},{"line_number":184,"context_line":"    def _get_by_id(self, context, model, id, scoped\u003dTrue):"},{"line_number":185,"context_line":"        # NOTE(kevinbenton): we have the option to not scope to tenant"},{"line_number":186,"context_line":"        # here since we are looking for a specific object by it\u0027s ID."},{"line_number":187,"context_line":"        # In this case we allow the policy layer to verify that the correct"},{"line_number":188,"context_line":"        # tenants are looking at/modifying objects they are supposed to."},{"line_number":189,"context_line":"        context.scoped \u003d scoped"}],"source_content_type":"text/x-python","patch_set":3,"id":"5a2ca52d_e76d5d33","line":186,"updated":"2015-10-14 05:10:12.000000000","message":"its?","commit_id":"198faa66a2e4ac23edd52c4a00de11470991e70b"},{"author":{"_account_id":7787,"name":"Kevin Benton","email":"kevin@benton.pub","username":"blak111"},"change_message_id":"c5af97a848eb423bb2c2fc9f6084f1f9579e3581","unresolved":false,"context_lines":[{"line_number":183,"context_line":""},{"line_number":184,"context_line":"    def _get_by_id(self, context, model, id, scoped\u003dTrue):"},{"line_number":185,"context_line":"        # NOTE(kevinbenton): we have the option to not scope to tenant"},{"line_number":186,"context_line":"        # here since we are looking for a specific object by it\u0027s ID."},{"line_number":187,"context_line":"        # In this case we allow the policy layer to verify that the correct"},{"line_number":188,"context_line":"        # tenants are looking at/modifying objects they are supposed to."},{"line_number":189,"context_line":"        context.scoped \u003d scoped"}],"source_content_type":"text/x-python","patch_set":3,"id":"5a2ca52d_c5159449","line":186,"in_reply_to":"5a2ca52d_e76d5d33","updated":"2015-10-14 20:44:48.000000000","message":"ugh, two times in one patch i messed up!","commit_id":"198faa66a2e4ac23edd52c4a00de11470991e70b"}],"neutron/db/db_base_plugin_common.py":[{"author":{"_account_id":748,"name":"Armando Migliaccio","email":"armamig@gmail.com","username":"armando-migliaccio"},"change_message_id":"8a326f710bded62600f4f419bbc891d24890048c","unresolved":false,"context_lines":[{"line_number":213,"context_line":""},{"line_number":214,"context_line":"    def _get_port(self, context, id):"},{"line_number":215,"context_line":"        try:"},{"line_number":216,"context_line":"            # NOTE(kevinbenton): we don\u0027t scope port operations because"},{"line_number":217,"context_line":"            # non-admins can delete other tenants\u0027 ports if they are attached"},{"line_number":218,"context_line":"            # to their network."},{"line_number":219,"context_line":"            port \u003d self._get_by_id(context, models_v2.Port, id, scoped\u003dFalse)"}],"source_content_type":"text/x-python","patch_set":3,"id":"5a2ca52d_47d691c6","line":216,"updated":"2015-10-14 05:10:12.000000000","message":"At the 3rd NOTE, I am starting to have palpitations and I am getting increasingly nervous about the fact that this change has too many \u0027gotchas\u0027.","commit_id":"198faa66a2e4ac23edd52c4a00de11470991e70b"},{"author":{"_account_id":748,"name":"Armando Migliaccio","email":"armamig@gmail.com","username":"armando-migliaccio"},"change_message_id":"8a326f710bded62600f4f419bbc891d24890048c","unresolved":false,"context_lines":[{"line_number":215,"context_line":"        try:"},{"line_number":216,"context_line":"            # NOTE(kevinbenton): we don\u0027t scope port operations because"},{"line_number":217,"context_line":"            # non-admins can delete other tenants\u0027 ports if they are attached"},{"line_number":218,"context_line":"            # to their network."},{"line_number":219,"context_line":"            port \u003d self._get_by_id(context, models_v2.Port, id, scoped\u003dFalse)"},{"line_number":220,"context_line":"        except exc.NoResultFound:"},{"line_number":221,"context_line":"            raise n_exc.PortNotFound(port_id\u003did)"}],"source_content_type":"text/x-python","patch_set":3,"id":"5a2ca52d_27b6f58a","line":218,"updated":"2015-10-14 05:10:12.000000000","message":"I think doing this here is erroneous, besides we should not regress on the way this used to work. IMO we should go ahead and allow the deletion only if the port\u0027s owner is amongst a tenant which the network has been shared with. To this aim, wouldn\u0027t it be more effective modify the logic elsewhere?","commit_id":"198faa66a2e4ac23edd52c4a00de11470991e70b"},{"author":{"_account_id":7787,"name":"Kevin Benton","email":"kevin@benton.pub","username":"blak111"},"change_message_id":"c5af97a848eb423bb2c2fc9f6084f1f9579e3581","unresolved":false,"context_lines":[{"line_number":215,"context_line":"        try:"},{"line_number":216,"context_line":"            # NOTE(kevinbenton): we don\u0027t scope port operations because"},{"line_number":217,"context_line":"            # non-admins can delete other tenants\u0027 ports if they are attached"},{"line_number":218,"context_line":"            # to their network."},{"line_number":219,"context_line":"            port \u003d self._get_by_id(context, models_v2.Port, id, scoped\u003dFalse)"},{"line_number":220,"context_line":"        except exc.NoResultFound:"},{"line_number":221,"context_line":"            raise n_exc.PortNotFound(port_id\u003did)"}],"source_content_type":"text/x-python","patch_set":3,"id":"5a2ca52d_002a9a7e","line":218,"in_reply_to":"5a2ca52d_27b6f58a","updated":"2015-10-14 20:44:48.000000000","message":"No, we can\u0027t have it both ways. Either _get_by_id has to skip scoping all queries, or we need to bubble it up to the places that make the calls which can\u0027t be scoped.\n\nI would prefer that _get_by_id was just never scoped, but Salvatore has reservations about that.","commit_id":"198faa66a2e4ac23edd52c4a00de11470991e70b"}],"neutron/db/ipam_backend_mixin.py":[{"author":{"_account_id":2874,"name":"yong sheng gong","email":"gong.yongsheng@99cloud.net","username":"gongysh"},"change_message_id":"58fd8f26d75e57182d91751baed52bca65469d49","unresolved":false,"context_lines":[{"line_number":414,"context_line":"        query \u003d (context.session.query(models_v2.Port)."},{"line_number":415,"context_line":"                 enable_eagerloads(False).filter_by(id\u003dport_id))"},{"line_number":416,"context_line":"        if not context.is_admin:"},{"line_number":417,"context_line":"            query \u003d query.filter_by(tenant_id\u003dcontext.tenant_id)"},{"line_number":418,"context_line":"        # Use of the ORM mapper is needed for ensuring appropriate resource"},{"line_number":419,"context_line":"        # tracking; otherwise SQL Alchemy events won\u0027t be triggered."},{"line_number":420,"context_line":"        # For more info check \u0027caveats\u0027 in doc/source/devref/quota.rst"}],"source_content_type":"text/x-python","patch_set":2,"id":"ba15a1d1_45536217","side":"PARENT","line":417,"updated":"2015-09-24 02:15:02.000000000","message":"I am afraid if the code is called by RPC handler or something which by pass the policy engine,  this change is dangerous.","commit_id":"7707cfd86f47dfc66411e274f343fe8484f9e250"},{"author":{"_account_id":7787,"name":"Kevin Benton","email":"kevin@benton.pub","username":"blak111"},"change_message_id":"abe9fcb98b165fc1f9f8074a7a790c120cc74f24","unresolved":false,"context_lines":[{"line_number":414,"context_line":"        query \u003d (context.session.query(models_v2.Port)."},{"line_number":415,"context_line":"                 enable_eagerloads(False).filter_by(id\u003dport_id))"},{"line_number":416,"context_line":"        if not context.is_admin:"},{"line_number":417,"context_line":"            query \u003d query.filter_by(tenant_id\u003dcontext.tenant_id)"},{"line_number":418,"context_line":"        # Use of the ORM mapper is needed for ensuring appropriate resource"},{"line_number":419,"context_line":"        # tracking; otherwise SQL Alchemy events won\u0027t be triggered."},{"line_number":420,"context_line":"        # For more info check \u0027caveats\u0027 in doc/source/devref/quota.rst"}],"source_content_type":"text/x-python","patch_set":2,"id":"ba15a1d1_90c21652","side":"PARENT","line":417,"in_reply_to":"ba15a1d1_45536217","updated":"2015-09-24 03:00:05.000000000","message":"If it comes in via RPC, its an admin operation.","commit_id":"7707cfd86f47dfc66411e274f343fe8484f9e250"},{"author":{"_account_id":2874,"name":"yong sheng gong","email":"gong.yongsheng@99cloud.net","username":"gongysh"},"change_message_id":"7ffc03efc7e51577d2ee7133bb81a9e1adf1faf5","unresolved":false,"context_lines":[{"line_number":414,"context_line":"        query \u003d (context.session.query(models_v2.Port)."},{"line_number":415,"context_line":"                 enable_eagerloads(False).filter_by(id\u003dport_id))"},{"line_number":416,"context_line":"        if not context.is_admin:"},{"line_number":417,"context_line":"            query \u003d query.filter_by(tenant_id\u003dcontext.tenant_id)"},{"line_number":418,"context_line":"        # Use of the ORM mapper is needed for ensuring appropriate resource"},{"line_number":419,"context_line":"        # tracking; otherwise SQL Alchemy events won\u0027t be triggered."},{"line_number":420,"context_line":"        # For more info check \u0027caveats\u0027 in doc/source/devref/quota.rst"}],"source_content_type":"text/x-python","patch_set":2,"id":"ba15a1d1_7d14fae7","side":"PARENT","line":417,"in_reply_to":"ba15a1d1_90c21652","updated":"2015-09-24 04:35:20.000000000","message":"yes, make sense.","commit_id":"7707cfd86f47dfc66411e274f343fe8484f9e250"},{"author":{"_account_id":748,"name":"Armando Migliaccio","email":"armamig@gmail.com","username":"armando-migliaccio"},"change_message_id":"8a326f710bded62600f4f419bbc891d24890048c","unresolved":false,"context_lines":[{"line_number":413,"context_line":"    def delete_port(self, context, port_id):"},{"line_number":414,"context_line":"        query \u003d (context.session.query(models_v2.Port)."},{"line_number":415,"context_line":"                 enable_eagerloads(False).filter_by(id\u003dport_id))"},{"line_number":416,"context_line":"        if not context.is_admin:"},{"line_number":417,"context_line":"            query \u003d query.filter_by(tenant_id\u003dcontext.tenant_id)"},{"line_number":418,"context_line":"        # Use of the ORM mapper is needed for ensuring appropriate resource"},{"line_number":419,"context_line":"        # tracking; otherwise SQL Alchemy events won\u0027t be triggered."}],"source_content_type":"text/x-python","patch_set":3,"id":"5a2ca52d_a758c557","side":"PARENT","line":416,"updated":"2015-10-14 05:10:12.000000000","message":"wouldn\u0027t it be better if we verified that the port being delete belongs to a tenant the network has been shared with and if so elevate to allow for deletion?","commit_id":"7707cfd86f47dfc66411e274f343fe8484f9e250"},{"author":{"_account_id":7787,"name":"Kevin Benton","email":"kevin@benton.pub","username":"blak111"},"change_message_id":"c5af97a848eb423bb2c2fc9f6084f1f9579e3581","unresolved":false,"context_lines":[{"line_number":413,"context_line":"    def delete_port(self, context, port_id):"},{"line_number":414,"context_line":"        query \u003d (context.session.query(models_v2.Port)."},{"line_number":415,"context_line":"                 enable_eagerloads(False).filter_by(id\u003dport_id))"},{"line_number":416,"context_line":"        if not context.is_admin:"},{"line_number":417,"context_line":"            query \u003d query.filter_by(tenant_id\u003dcontext.tenant_id)"},{"line_number":418,"context_line":"        # Use of the ORM mapper is needed for ensuring appropriate resource"},{"line_number":419,"context_line":"        # tracking; otherwise SQL Alchemy events won\u0027t be triggered."}],"source_content_type":"text/x-python","patch_set":3,"id":"5a2ca52d_2091d699","side":"PARENT","line":416,"in_reply_to":"5a2ca52d_a758c557","updated":"2015-10-14 20:44:48.000000000","message":"I would prefer to leave that up to the policy engine because it sounds like policy to me. Otherwise if the deployer wants to make the policy more relaxed to have a specific \u0027wrecking tenant\u0027 that can delete everything, there is no way to do that.\n\n\nIf we want to enforce policy here, this will need to be turned into a join query on the network table to check the tenant ID.\n\nquery.filter_by(_or(Port.tenant_id\u003dcontext.tenant_id,\n                    Network.tenant_id\u003dcontext.tenant_id))\n\n\nThoughts?","commit_id":"7707cfd86f47dfc66411e274f343fe8484f9e250"},{"author":{"_account_id":261,"name":"Salvatore Orlando","email":"salv.orlando@gmail.com","username":"salvatore-orlando"},"change_message_id":"5bfc6338d4e19f8761a9f549d7b7283172ce6151","unresolved":false,"context_lines":[{"line_number":414,"context_line":"        query \u003d (context.session.query(models_v2.Port)."},{"line_number":415,"context_line":"                 enable_eagerloads(False).filter_by(id\u003dport_id))"},{"line_number":416,"context_line":"        if not context.is_admin:"},{"line_number":417,"context_line":"            query \u003d query.filter_by(tenant_id\u003dcontext.tenant_id)"},{"line_number":418,"context_line":"        # Use of the ORM mapper is needed for ensuring appropriate resource"},{"line_number":419,"context_line":"        # tracking; otherwise SQL Alchemy events won\u0027t be triggered."},{"line_number":420,"context_line":"        # For more info check \u0027caveats\u0027 in doc/source/devref/quota.rst"}],"source_content_type":"text/x-python","patch_set":4,"id":"ba8a016a_fa4f0f68","side":"PARENT","line":417,"updated":"2015-11-23 12:40:41.000000000","message":"This is ok as in the delete process at this stage the request has already been authorized.\n\nImho it is fine to always assume requests have been authorized when you get to the plugin interface.","commit_id":"7707cfd86f47dfc66411e274f343fe8484f9e250"}],"neutron/tests/api/admin/test_shared_network_extension.py":[{"author":{"_account_id":2874,"name":"yong sheng gong","email":"gong.yongsheng@99cloud.net","username":"gongysh"},"change_message_id":"58fd8f26d75e57182d91751baed52bca65469d49","unresolved":false,"context_lines":[{"line_number":277,"context_line":"        net \u003d self.create_network()  # owned by self.client"},{"line_number":278,"context_line":"        self.client.create_rbac_policy("},{"line_number":279,"context_line":"            object_type\u003d\u0027network\u0027, object_id\u003dnet[\u0027id\u0027],"},{"line_number":280,"context_line":"            action\u003d\u0027access_as_shared\u0027, target_tenant\u003dself.client2.tenant_id)"},{"line_number":281,"context_line":"        port \u003d self.client2.create_port(network_id\u003dnet[\u0027id\u0027])[\u0027port\u0027]"},{"line_number":282,"context_line":"        self.client.delete_port(port[\u0027id\u0027])"},{"line_number":283,"context_line":""}],"source_content_type":"text/x-python","patch_set":2,"id":"ba15a1d1_450b62d6","side":"PARENT","line":280,"updated":"2015-09-24 02:15:02.000000000","message":"In the original \u0027shared\u0027 network, this case should work, I think we should hook the network \u0027shared\u0027 meaning instead of changing the get_by_id","commit_id":"7707cfd86f47dfc66411e274f343fe8484f9e250"},{"author":{"_account_id":7787,"name":"Kevin Benton","email":"kevin@benton.pub","username":"blak111"},"change_message_id":"abe9fcb98b165fc1f9f8074a7a790c120cc74f24","unresolved":false,"context_lines":[{"line_number":277,"context_line":"        net \u003d self.create_network()  # owned by self.client"},{"line_number":278,"context_line":"        self.client.create_rbac_policy("},{"line_number":279,"context_line":"            object_type\u003d\u0027network\u0027, object_id\u003dnet[\u0027id\u0027],"},{"line_number":280,"context_line":"            action\u003d\u0027access_as_shared\u0027, target_tenant\u003dself.client2.tenant_id)"},{"line_number":281,"context_line":"        port \u003d self.client2.create_port(network_id\u003dnet[\u0027id\u0027])[\u0027port\u0027]"},{"line_number":282,"context_line":"        self.client.delete_port(port[\u0027id\u0027])"},{"line_number":283,"context_line":""}],"source_content_type":"text/x-python","patch_set":2,"id":"ba15a1d1_9099b67b","side":"PARENT","line":280,"in_reply_to":"ba15a1d1_450b62d6","updated":"2015-09-24 03:00:05.000000000","message":"You cannot delete a port that you don\u0027t own if you aren\u0027t the admin with the current restrictions imposed by get_by_id.","commit_id":"7707cfd86f47dfc66411e274f343fe8484f9e250"},{"author":{"_account_id":2874,"name":"yong sheng gong","email":"gong.yongsheng@99cloud.net","username":"gongysh"},"change_message_id":"7ffc03efc7e51577d2ee7133bb81a9e1adf1faf5","unresolved":false,"context_lines":[{"line_number":277,"context_line":"        net \u003d self.create_network()  # owned by self.client"},{"line_number":278,"context_line":"        self.client.create_rbac_policy("},{"line_number":279,"context_line":"            object_type\u003d\u0027network\u0027, object_id\u003dnet[\u0027id\u0027],"},{"line_number":280,"context_line":"            action\u003d\u0027access_as_shared\u0027, target_tenant\u003dself.client2.tenant_id)"},{"line_number":281,"context_line":"        port \u003d self.client2.create_port(network_id\u003dnet[\u0027id\u0027])[\u0027port\u0027]"},{"line_number":282,"context_line":"        self.client.delete_port(port[\u0027id\u0027])"},{"line_number":283,"context_line":""}],"source_content_type":"text/x-python","patch_set":2,"id":"ba15a1d1_bd1e120a","side":"PARENT","line":280,"in_reply_to":"ba15a1d1_9099b67b","updated":"2015-09-24 04:35:20.000000000","message":"now I got it:\nso in  original \u0027shared\u0027 network, the owner is admin which can delete the foreign ports.\nthis case means the rbac shared network\u0027s owner even it is not admin can delete the foreign ports.","commit_id":"7707cfd86f47dfc66411e274f343fe8484f9e250"},{"author":{"_account_id":7787,"name":"Kevin Benton","email":"kevin@benton.pub","username":"blak111"},"change_message_id":"693752ee0f4d508d469f5b61875542167506b2a1","unresolved":false,"context_lines":[{"line_number":277,"context_line":"        net \u003d self.create_network()  # owned by self.client"},{"line_number":278,"context_line":"        self.client.create_rbac_policy("},{"line_number":279,"context_line":"            object_type\u003d\u0027network\u0027, object_id\u003dnet[\u0027id\u0027],"},{"line_number":280,"context_line":"            action\u003d\u0027access_as_shared\u0027, target_tenant\u003dself.client2.tenant_id)"},{"line_number":281,"context_line":"        port \u003d self.client2.create_port(network_id\u003dnet[\u0027id\u0027])[\u0027port\u0027]"},{"line_number":282,"context_line":"        self.client.delete_port(port[\u0027id\u0027])"},{"line_number":283,"context_line":""}],"source_content_type":"text/x-python","patch_set":2,"id":"ba15a1d1_93de9d6b","side":"PARENT","line":280,"in_reply_to":"ba15a1d1_bd1e120a","updated":"2015-09-24 05:57:49.000000000","message":"yes","commit_id":"7707cfd86f47dfc66411e274f343fe8484f9e250"}],"neutron/tests/unit/db/test_db_base_plugin_v2.py":[{"author":{"_account_id":2874,"name":"yong sheng gong","email":"gong.yongsheng@99cloud.net","username":"gongysh"},"change_message_id":"7ffc03efc7e51577d2ee7133bb81a9e1adf1faf5","unresolved":false,"context_lines":[{"line_number":3170,"context_line":"            self._create_subnet(self.fmt,"},{"line_number":3171,"context_line":"                                network[\u0027network\u0027][\u0027id\u0027],"},{"line_number":3172,"context_line":"                                \u002710.0.2.0/24\u0027,"},{"line_number":3173,"context_line":"                                webob.exc.HTTPForbidden.code,"},{"line_number":3174,"context_line":"                                ip_version\u003d4,"},{"line_number":3175,"context_line":"                                tenant_id\u003d\u0027bad_tenant_id\u0027,"},{"line_number":3176,"context_line":"                                gateway_ip\u003d\u002710.0.2.1\u0027,"}],"source_content_type":"text/x-python","patch_set":2,"id":"ba15a1d1_bdccd289","line":3173,"updated":"2015-09-24 04:35:20.000000000","message":"It seems a not back compatible change.","commit_id":"c9e7107d855e1d20984b8e07b0b0117a1670d0b7"},{"author":{"_account_id":7787,"name":"Kevin Benton","email":"kevin@benton.pub","username":"blak111"},"change_message_id":"693752ee0f4d508d469f5b61875542167506b2a1","unresolved":false,"context_lines":[{"line_number":3170,"context_line":"            self._create_subnet(self.fmt,"},{"line_number":3171,"context_line":"                                network[\u0027network\u0027][\u0027id\u0027],"},{"line_number":3172,"context_line":"                                \u002710.0.2.0/24\u0027,"},{"line_number":3173,"context_line":"                                webob.exc.HTTPForbidden.code,"},{"line_number":3174,"context_line":"                                ip_version\u003d4,"},{"line_number":3175,"context_line":"                                tenant_id\u003d\u0027bad_tenant_id\u0027,"},{"line_number":3176,"context_line":"                                gateway_ip\u003d\u002710.0.2.1\u0027,"}],"source_content_type":"text/x-python","patch_set":2,"id":"ba15a1d1_b3dba17b","line":3173,"in_reply_to":"ba15a1d1_bdccd289","updated":"2015-09-24 05:57:49.000000000","message":"that\u0027s why i added the note on the other page. this is the exception that the code that used to be unreachable by the db plugins returns.","commit_id":"c9e7107d855e1d20984b8e07b0b0117a1670d0b7"}]}
