)]}'
{"ironic/api/controllers/v1/utils.py":[{"author":{"_account_id":4571,"name":"Steve Baker","email":"sbaker@redhat.com","username":"steve-stevebaker"},"change_message_id":"45350f4dbdd70f68e61354b240760d84f7136721","unresolved":true,"context_lines":[{"line_number":1596,"context_line":"    target_dict \u003d dict(cdict)"},{"line_number":1597,"context_line":"    target_dict[\u0027node.owner\u0027] \u003d node.owner"},{"line_number":1598,"context_line":"    target_dict[\u0027node.lessee\u0027] \u003d node.lessee"},{"line_number":1599,"context_line":"    policy.authorize(\u0027baremetal:%s:create\u0027 % object_type, target_dict, cdict)"},{"line_number":1600,"context_line":""},{"line_number":1601,"context_line":""},{"line_number":1602,"context_line":"def check_object_policy_and_retrieve(policy_name, object_uuid, object_type):"}],"source_content_type":"text/x-python","patch_set":3,"id":"739fd47c_b1763ec1","line":1599,"updated":"2020-12-20 22:38:19.000000000","message":"I wonder in the future if we could pass the actual node dict as the target argument, instead of a modified cdict. This seems closer to the intent of the authorize function. Not related to this change, but something I\u0027ve been thinking about as we get closer to doing secure-rbac","commit_id":"c4939993867d250297b678c0de8f4713134fb928"},{"author":{"_account_id":4571,"name":"Steve Baker","email":"sbaker@redhat.com","username":"steve-stevebaker"},"change_message_id":"45350f4dbdd70f68e61354b240760d84f7136721","unresolved":true,"context_lines":[{"line_number":1604,"context_line":""},{"line_number":1605,"context_line":"    :param: policy_name: Name of the policy to check."},{"line_number":1606,"context_line":"    :param: object_uuid: the UUID of an object."},{"line_number":1607,"context_line":"    :param: object_type: the type of an object."},{"line_number":1608,"context_line":""},{"line_number":1609,"context_line":"    :raises: HTTPForbidden if the policy forbids access."},{"line_number":1610,"context_line":"    :raises: NodeNotFound if the node is not found."}],"source_content_type":"text/x-python","patch_set":3,"id":"61e465a5_edc76c3b","line":1607,"updated":"2020-12-20 22:38:19.000000000","message":"Rather than a string, you could pass the actual type, like objects.VolumeConnector. Then below object_type.get_by_uuid is called. That would make this function completely general","commit_id":"c4939993867d250297b678c0de8f4713134fb928"},{"author":{"_account_id":7386,"name":"Tzu-Mainn Chen","email":"tzumainn@redhat.com","username":"tzumainn"},"change_message_id":"f8a1eeebd799a7806ad1a45c66ac073d31e9c224","unresolved":false,"context_lines":[{"line_number":1604,"context_line":""},{"line_number":1605,"context_line":"    :param: policy_name: Name of the policy to check."},{"line_number":1606,"context_line":"    :param: object_uuid: the UUID of an object."},{"line_number":1607,"context_line":"    :param: object_type: the type of an object."},{"line_number":1608,"context_line":""},{"line_number":1609,"context_line":"    :raises: HTTPForbidden if the policy forbids access."},{"line_number":1610,"context_line":"    :raises: NodeNotFound if the node is not found."}],"source_content_type":"text/x-python","patch_set":3,"id":"3fa097ee_2f80091a","line":1607,"in_reply_to":"61e465a5_edc76c3b","updated":"2021-01-04 18:37:37.000000000","message":"Oh, that makes a ton of sense - thanks for pointing it out! Fixed.","commit_id":"c4939993867d250297b678c0de8f4713134fb928"},{"author":{"_account_id":4571,"name":"Steve Baker","email":"sbaker@redhat.com","username":"steve-stevebaker"},"change_message_id":"45350f4dbdd70f68e61354b240760d84f7136721","unresolved":true,"context_lines":[{"line_number":1622,"context_line":"                                                          object_uuid)"},{"line_number":1623,"context_line":"        elif object_type \u003d\u003d \u0027port\u0027:"},{"line_number":1624,"context_line":"            rpc_object \u003d objects.Port.get_by_uuid(context, object_uuid)"},{"line_number":1625,"context_line":"    except (exception.VolumeConnectorNotFound,"},{"line_number":1626,"context_line":"            exception.VolumeTargetNotFound,"},{"line_number":1627,"context_line":"            exception.PortNotFound):"},{"line_number":1628,"context_line":"        # don\u0027t expose non-existence of target unless requester"},{"line_number":1629,"context_line":"        # has generic access to policy"},{"line_number":1630,"context_line":"        policy.authorize(policy_name, cdict, cdict)"}],"source_content_type":"text/x-python","patch_set":3,"id":"79e09b33_447b7313","line":1627,"range":{"start_line":1625,"start_character":12,"end_line":1627,"end_character":35},"updated":"2020-12-20 22:38:19.000000000","message":"These all extend NotFound, so you could just catch that.","commit_id":"c4939993867d250297b678c0de8f4713134fb928"},{"author":{"_account_id":7386,"name":"Tzu-Mainn Chen","email":"tzumainn@redhat.com","username":"tzumainn"},"change_message_id":"f8a1eeebd799a7806ad1a45c66ac073d31e9c224","unresolved":false,"context_lines":[{"line_number":1622,"context_line":"                                                          object_uuid)"},{"line_number":1623,"context_line":"        elif object_type \u003d\u003d \u0027port\u0027:"},{"line_number":1624,"context_line":"            rpc_object \u003d objects.Port.get_by_uuid(context, object_uuid)"},{"line_number":1625,"context_line":"    except (exception.VolumeConnectorNotFound,"},{"line_number":1626,"context_line":"            exception.VolumeTargetNotFound,"},{"line_number":1627,"context_line":"            exception.PortNotFound):"},{"line_number":1628,"context_line":"        # don\u0027t expose non-existence of target unless requester"},{"line_number":1629,"context_line":"        # has generic access to policy"},{"line_number":1630,"context_line":"        policy.authorize(policy_name, cdict, cdict)"}],"source_content_type":"text/x-python","patch_set":3,"id":"c0d6d470_8330518d","line":1627,"range":{"start_line":1625,"start_character":12,"end_line":1627,"end_character":35},"in_reply_to":"79e09b33_447b7313","updated":"2021-01-04 18:37:37.000000000","message":"Ah, of course - thanks, and fixed!","commit_id":"c4939993867d250297b678c0de8f4713134fb928"}],"ironic/api/controllers/v1/volume_connector.py":[{"author":{"_account_id":4571,"name":"Steve Baker","email":"sbaker@redhat.com","username":"steve-stevebaker"},"change_message_id":"45350f4dbdd70f68e61354b240760d84f7136721","unresolved":true,"context_lines":[{"line_number":181,"context_line":"        :raises: InvalidParameterValue if sort key is invalid for sorting."},{"line_number":182,"context_line":"        :raises: InvalidParameterValue if both fields and detail are specified."},{"line_number":183,"context_line":"        \"\"\""},{"line_number":184,"context_line":"        project \u003d api_utils.check_list_policy(\u0027volume\u0027)"},{"line_number":185,"context_line":""},{"line_number":186,"context_line":"        if fields is None and not detail:"},{"line_number":187,"context_line":"            fields \u003d _DEFAULT_RETURN_FIELDS"}],"source_content_type":"text/x-python","patch_set":3,"id":"2cc9a0bd_3b3390fa","line":184,"updated":"2020-12-20 22:38:19.000000000","message":"Can we stick with \u0027owner\u0027 semantics here instead of \u0027project\u0027? Just to remain consistent","commit_id":"c4939993867d250297b678c0de8f4713134fb928"},{"author":{"_account_id":7386,"name":"Tzu-Mainn Chen","email":"tzumainn@redhat.com","username":"tzumainn"},"change_message_id":"f8a1eeebd799a7806ad1a45c66ac073d31e9c224","unresolved":false,"context_lines":[{"line_number":181,"context_line":"        :raises: InvalidParameterValue if sort key is invalid for sorting."},{"line_number":182,"context_line":"        :raises: InvalidParameterValue if both fields and detail are specified."},{"line_number":183,"context_line":"        \"\"\""},{"line_number":184,"context_line":"        project \u003d api_utils.check_list_policy(\u0027volume\u0027)"},{"line_number":185,"context_line":""},{"line_number":186,"context_line":"        if fields is None and not detail:"},{"line_number":187,"context_line":"            fields \u003d _DEFAULT_RETURN_FIELDS"}],"source_content_type":"text/x-python","patch_set":3,"id":"cd6dd7f5_d7423125","line":184,"in_reply_to":"2cc9a0bd_3b3390fa","updated":"2021-01-04 18:37:37.000000000","message":"Oh, the reason I use \u0027project\u0027 is because we could potentially be checking against someone\u0027s lessee status. I\u0027ve updated the check_list_policy function in utils.py to use project semantics for consistency, if that works for you.","commit_id":"c4939993867d250297b678c0de8f4713134fb928"},{"author":{"_account_id":4571,"name":"Steve Baker","email":"sbaker@redhat.com","username":"steve-stevebaker"},"change_message_id":"45350f4dbdd70f68e61354b240760d84f7136721","unresolved":true,"context_lines":[{"line_number":248,"context_line":"        if not connector.get(\u0027uuid\u0027):"},{"line_number":249,"context_line":"            connector[\u0027uuid\u0027] \u003d uuidutils.generate_uuid()"},{"line_number":250,"context_line":""},{"line_number":251,"context_line":"        node \u003d api_utils.replace_node_uuid_with_id(connector)"},{"line_number":252,"context_line":"        api_utils.check_object_create_policy(\u0027volume\u0027, node)"},{"line_number":253,"context_line":""},{"line_number":254,"context_line":"        new_connector \u003d objects.VolumeConnector(context, **connector)"},{"line_number":255,"context_line":""}],"source_content_type":"text/x-python","patch_set":3,"id":"152f395f_11b712b0","line":252,"range":{"start_line":251,"start_character":0,"end_line":252,"end_character":60},"updated":"2020-12-20 22:38:19.000000000","message":"It would be good if the policy checks can continue to be done as early as possible in these methods, could these lines be moved to #243?","commit_id":"c4939993867d250297b678c0de8f4713134fb928"},{"author":{"_account_id":7386,"name":"Tzu-Mainn Chen","email":"tzumainn@redhat.com","username":"tzumainn"},"change_message_id":"f8a1eeebd799a7806ad1a45c66ac073d31e9c224","unresolved":false,"context_lines":[{"line_number":248,"context_line":"        if not connector.get(\u0027uuid\u0027):"},{"line_number":249,"context_line":"            connector[\u0027uuid\u0027] \u003d uuidutils.generate_uuid()"},{"line_number":250,"context_line":""},{"line_number":251,"context_line":"        node \u003d api_utils.replace_node_uuid_with_id(connector)"},{"line_number":252,"context_line":"        api_utils.check_object_create_policy(\u0027volume\u0027, node)"},{"line_number":253,"context_line":""},{"line_number":254,"context_line":"        new_connector \u003d objects.VolumeConnector(context, **connector)"},{"line_number":255,"context_line":""}],"source_content_type":"text/x-python","patch_set":3,"id":"2216dc61_0fbaa5f2","line":252,"range":{"start_line":251,"start_character":0,"end_line":252,"end_character":60},"in_reply_to":"152f395f_11b712b0","updated":"2021-01-04 18:37:37.000000000","message":"Done - I\u0027ve also moved the setting of the connector uuid, since it affects an argument to the function that sets `node`","commit_id":"c4939993867d250297b678c0de8f4713134fb928"},{"author":{"_account_id":4571,"name":"Steve Baker","email":"sbaker@redhat.com","username":"steve-stevebaker"},"change_message_id":"45350f4dbdd70f68e61354b240760d84f7136721","unresolved":true,"context_lines":[{"line_number":308,"context_line":""},{"line_number":309,"context_line":"        rpc_connector, rpc_node \u003d \\"},{"line_number":310,"context_line":"            api_utils.check_object_policy_and_retrieve("},{"line_number":311,"context_line":"                \u0027baremetal:volume:update\u0027, connector_uuid, \u0027volume_connector\u0027)"},{"line_number":312,"context_line":"        connector_dict \u003d rpc_connector.as_dict()"},{"line_number":313,"context_line":"        # NOTE(smoriya):"},{"line_number":314,"context_line":"        # 1) Remove node_id because it\u0027s an internal value and"}],"source_content_type":"text/x-python","patch_set":3,"id":"6df10ab5_bb523bc3","line":311,"updated":"2020-12-20 22:38:19.000000000","message":"I think this can remain at the start of the method","commit_id":"c4939993867d250297b678c0de8f4713134fb928"},{"author":{"_account_id":7386,"name":"Tzu-Mainn Chen","email":"tzumainn@redhat.com","username":"tzumainn"},"change_message_id":"f8a1eeebd799a7806ad1a45c66ac073d31e9c224","unresolved":false,"context_lines":[{"line_number":308,"context_line":""},{"line_number":309,"context_line":"        rpc_connector, rpc_node \u003d \\"},{"line_number":310,"context_line":"            api_utils.check_object_policy_and_retrieve("},{"line_number":311,"context_line":"                \u0027baremetal:volume:update\u0027, connector_uuid, \u0027volume_connector\u0027)"},{"line_number":312,"context_line":"        connector_dict \u003d rpc_connector.as_dict()"},{"line_number":313,"context_line":"        # NOTE(smoriya):"},{"line_number":314,"context_line":"        # 1) Remove node_id because it\u0027s an internal value and"}],"source_content_type":"text/x-python","patch_set":3,"id":"e3e81dd3_a3fb5f5d","line":311,"in_reply_to":"6df10ab5_bb523bc3","updated":"2021-01-04 18:37:37.000000000","message":"Done!","commit_id":"c4939993867d250297b678c0de8f4713134fb928"},{"author":{"_account_id":4571,"name":"Steve Baker","email":"sbaker@redhat.com","username":"steve-stevebaker"},"change_message_id":"45350f4dbdd70f68e61354b240760d84f7136721","unresolved":true,"context_lines":[{"line_number":376,"context_line":""},{"line_number":377,"context_line":"        rpc_connector, rpc_node \u003d \\"},{"line_number":378,"context_line":"            api_utils.check_object_policy_and_retrieve("},{"line_number":379,"context_line":"                \u0027baremetal:volume:delete\u0027, connector_uuid, \u0027volume_connector\u0027)"},{"line_number":380,"context_line":""},{"line_number":381,"context_line":"        context \u003d api.request.context"},{"line_number":382,"context_line":""}],"source_content_type":"text/x-python","patch_set":3,"id":"9cae1855_eb8c8798","line":379,"updated":"2020-12-20 22:38:19.000000000","message":"likewise","commit_id":"c4939993867d250297b678c0de8f4713134fb928"},{"author":{"_account_id":7386,"name":"Tzu-Mainn Chen","email":"tzumainn@redhat.com","username":"tzumainn"},"change_message_id":"f8a1eeebd799a7806ad1a45c66ac073d31e9c224","unresolved":false,"context_lines":[{"line_number":376,"context_line":""},{"line_number":377,"context_line":"        rpc_connector, rpc_node \u003d \\"},{"line_number":378,"context_line":"            api_utils.check_object_policy_and_retrieve("},{"line_number":379,"context_line":"                \u0027baremetal:volume:delete\u0027, connector_uuid, \u0027volume_connector\u0027)"},{"line_number":380,"context_line":""},{"line_number":381,"context_line":"        context \u003d api.request.context"},{"line_number":382,"context_line":""}],"source_content_type":"text/x-python","patch_set":3,"id":"4f8eed6b_a1b69543","line":379,"in_reply_to":"9cae1855_eb8c8798","updated":"2021-01-04 18:37:37.000000000","message":"Done!","commit_id":"c4939993867d250297b678c0de8f4713134fb928"}],"ironic/api/controllers/v1/volume_target.py":[{"author":{"_account_id":4571,"name":"Steve Baker","email":"sbaker@redhat.com","username":"steve-stevebaker"},"change_message_id":"45350f4dbdd70f68e61354b240760d84f7136721","unresolved":true,"context_lines":[{"line_number":1,"context_line":"# Copyright (c) 2017 Hitachi, Ltd."},{"line_number":2,"context_line":"#"},{"line_number":3,"context_line":"#    Licensed under the Apache License, Version 2.0 (the \"License\"); you may"},{"line_number":4,"context_line":"#    not use this file except in compliance with the License. You may obtain"}],"source_content_type":"text/x-python","patch_set":3,"id":"d44761bf_8a899c0a","line":1,"updated":"2020-12-20 22:38:19.000000000","message":"The comments in volume_connector.py apply to this file too","commit_id":"c4939993867d250297b678c0de8f4713134fb928"},{"author":{"_account_id":7386,"name":"Tzu-Mainn Chen","email":"tzumainn@redhat.com","username":"tzumainn"},"change_message_id":"f8a1eeebd799a7806ad1a45c66ac073d31e9c224","unresolved":false,"context_lines":[{"line_number":1,"context_line":"# Copyright (c) 2017 Hitachi, Ltd."},{"line_number":2,"context_line":"#"},{"line_number":3,"context_line":"#    Licensed under the Apache License, Version 2.0 (the \"License\"); you may"},{"line_number":4,"context_line":"#    not use this file except in compliance with the License. You may obtain"}],"source_content_type":"text/x-python","patch_set":3,"id":"1a57c296_2d4adefe","line":1,"in_reply_to":"d44761bf_8a899c0a","updated":"2021-01-04 18:37:37.000000000","message":"Done!","commit_id":"c4939993867d250297b678c0de8f4713134fb928"}]}
