)]}'
{"/COMMIT_MSG":[{"author":{"_account_id":9303,"name":"Abhishek Kekane","email":"akekane@redhat.com","username":"abhishekkekane"},"change_message_id":"7f2aab7d4a22d07194bfccf475f9c5a19963c357","unresolved":true,"context_lines":[{"line_number":9,"context_line":"This commit updates the policies for metadef resource types and"},{"line_number":10,"context_line":"metadef objects to use default roles available from keystone."},{"line_number":11,"context_line":""},{"line_number":12,"context_line":"NOTE: Passing \u0027reader\u0027 \u0026 \u0027member\u0027 roles both in the units tests"},{"line_number":13,"context_line":"      as the policy enforcement fails if only \u0027member\u0027 role is"},{"line_number":14,"context_line":"      passed."},{"line_number":15,"context_line":""},{"line_number":16,"context_line":"Implements: blueprint secure-rbac"},{"line_number":17,"context_line":"Change-Id: Ia0809b2b27ac8cf9325e264b3298149feea07eb4"}],"source_content_type":"text/x-gerrit-commit-message","patch_set":1,"id":"4b6e837d_7c3b1dad","line":14,"range":{"start_line":12,"start_character":0,"end_line":14,"end_character":13},"updated":"2021-07-06 13:46:55.000000000","message":"This needs some investigation why it was passing earlier and not now.","commit_id":"c9db03b4a2f3fea925a4ad71dc00d23edea1828c"}],"glance/api/policy.py":[{"author":{"_account_id":9303,"name":"Abhishek Kekane","email":"akekane@redhat.com","username":"abhishekkekane"},"change_message_id":"3f0390e4f6388a4d6e4e255b2fb61c5812647867","unresolved":true,"context_lines":[{"line_number":651,"context_line":""},{"line_number":652,"context_line":"    def get(self, namespace, object_name):"},{"line_number":653,"context_line":"        target \u003d {\u0027project_id\u0027: self.context.project_id}"},{"line_number":654,"context_line":"        self.policy.enforce(self.context, \u0027get_metadef_object\u0027, target)"},{"line_number":655,"context_line":"        return super(MetadefObjectRepoProxy, self).get(namespace, object_name)"},{"line_number":656,"context_line":""},{"line_number":657,"context_line":"    def list(self, *args, **kwargs):"}],"source_content_type":"text/x-python","patch_set":2,"id":"4a714c9c_cd9b8065","line":654,"range":{"start_line":654,"start_character":8,"end_line":654,"end_character":71},"updated":"2021-07-08 07:13:09.000000000","message":"Same goes to here as well.","commit_id":"7c03533a06e961be6119ffeea60cca060aa5dc3b"},{"author":{"_account_id":9303,"name":"Abhishek Kekane","email":"akekane@redhat.com","username":"abhishekkekane"},"change_message_id":"3f0390e4f6388a4d6e4e255b2fb61c5812647867","unresolved":true,"context_lines":[{"line_number":656,"context_line":""},{"line_number":657,"context_line":"    def list(self, *args, **kwargs):"},{"line_number":658,"context_line":"        target \u003d {\u0027project_id\u0027: self.context.project_id}"},{"line_number":659,"context_line":"        self.policy.enforce(self.context, \u0027get_metadef_objects\u0027, target)"},{"line_number":660,"context_line":"        return super(MetadefObjectRepoProxy, self).list(*args, **kwargs)"},{"line_number":661,"context_line":""},{"line_number":662,"context_line":"    def save(self, meta_object):"}],"source_content_type":"text/x-python","patch_set":2,"id":"008d83cc_bcb3f488","line":659,"range":{"start_line":659,"start_character":8,"end_line":659,"end_character":72},"updated":"2021-07-08 07:13:09.000000000","message":"Basically this policy check \u0027base.ADMIN_OR_PROJECT_READER\u0027 here is giving wrong impression to us. Because we are passing the project id from the context which will be matched against project id from the context only. In short this policy check will never fail.\n\nSo at the moment what is happening is when I try to list metadef objects for namespace of Tenant A with credentials of Tenant B this policy is not restricting me here itself. Then at line 660 it then further down at db layer [1] it checks for namespace visibility and returns 404 NotFound if I am not owner or the namespace I am trying to access is not public.\n\n[1] https://github.com/openstack/glance/blob/master/glance/db/sqlalchemy/metadef_api/namespace.py#L94\n\nThis could be appropriate for default policies where get call were open to all but with migrating to project scope this should raise Forbidden at this line only.","commit_id":"7c03533a06e961be6119ffeea60cca060aa5dc3b"},{"author":{"_account_id":9303,"name":"Abhishek Kekane","email":"akekane@redhat.com","username":"abhishekkekane"},"change_message_id":"3f0390e4f6388a4d6e4e255b2fb61c5812647867","unresolved":true,"context_lines":[{"line_number":715,"context_line":""},{"line_number":716,"context_line":"    def list(self, *args, **kwargs):"},{"line_number":717,"context_line":"        target \u003d {\u0027project_id\u0027: self.context.project_id}"},{"line_number":718,"context_line":"        self.policy.enforce("},{"line_number":719,"context_line":"            self.context, \u0027list_metadef_resource_types\u0027, target)"},{"line_number":720,"context_line":"        return super(MetadefResourceTypeRepoProxy, self).list(*args, **kwargs)"},{"line_number":721,"context_line":""},{"line_number":722,"context_line":"    def get(self, *args, **kwargs):"}],"source_content_type":"text/x-python","patch_set":2,"id":"1a98884b_9f7f3e6c","line":719,"range":{"start_line":718,"start_character":8,"end_line":719,"end_character":64},"updated":"2021-07-08 07:13:09.000000000","message":"ditto","commit_id":"7c03533a06e961be6119ffeea60cca060aa5dc3b"},{"author":{"_account_id":9303,"name":"Abhishek Kekane","email":"akekane@redhat.com","username":"abhishekkekane"},"change_message_id":"3f0390e4f6388a4d6e4e255b2fb61c5812647867","unresolved":true,"context_lines":[{"line_number":721,"context_line":""},{"line_number":722,"context_line":"    def get(self, *args, **kwargs):"},{"line_number":723,"context_line":"        target \u003d {\u0027project_id\u0027: self.context.project_id}"},{"line_number":724,"context_line":"        self.policy.enforce(self.context, \u0027get_metadef_resource_type\u0027, target)"},{"line_number":725,"context_line":"        return super(MetadefResourceTypeRepoProxy, self).get(*args, **kwargs)"},{"line_number":726,"context_line":""},{"line_number":727,"context_line":"    def add(self, resource_type):"}],"source_content_type":"text/x-python","patch_set":2,"id":"83ddd62e_aa56453d","line":724,"range":{"start_line":724,"start_character":8,"end_line":724,"end_character":78},"updated":"2021-07-08 07:13:09.000000000","message":"ditto","commit_id":"7c03533a06e961be6119ffeea60cca060aa5dc3b"},{"author":{"_account_id":9303,"name":"Abhishek Kekane","email":"akekane@redhat.com","username":"abhishekkekane"},"change_message_id":"9599de8b8d71bce860a2627b30098e7b11c86455","unresolved":true,"context_lines":[{"line_number":725,"context_line":"            resource_type_proxy_kwargs\u003dproxy_kwargs)"},{"line_number":726,"context_line":""},{"line_number":727,"context_line":"    def list(self, *args, **kwargs):"},{"line_number":728,"context_line":"        namespace \u003d kwargs.pop(\u0027namespace\u0027, None)"},{"line_number":729,"context_line":"        if namespace:"},{"line_number":730,"context_line":"            target \u003d _build_namespace_target(namespace)"},{"line_number":731,"context_line":"        else:"}],"source_content_type":"text/x-python","patch_set":21,"id":"02e54440_127affbb","line":728,"range":{"start_line":728,"start_character":8,"end_line":728,"end_character":49},"updated":"2021-07-29 17:29:29.000000000","message":"As pointed out by dan, since this API is open to all this change is not required at all.\nThere is no point of passing anything to target while policy enforcement.","commit_id":"5e1c13ed2ed8b25a0bd3d6f6097bbc97afd2be95"},{"author":{"_account_id":4393,"name":"Dan Smith","email":"dms@danplanet.com","username":"danms"},"change_message_id":"a067951d08b29cca2084160fd032a1132c72ee8d","unresolved":true,"context_lines":[{"line_number":725,"context_line":"            resource_type_proxy_kwargs\u003dproxy_kwargs)"},{"line_number":726,"context_line":""},{"line_number":727,"context_line":"    def list(self, *args, **kwargs):"},{"line_number":728,"context_line":"        namespace \u003d kwargs.pop(\u0027namespace\u0027, None)"},{"line_number":729,"context_line":"        if namespace:"},{"line_number":730,"context_line":"            target \u003d _build_namespace_target(namespace)"},{"line_number":731,"context_line":"        else:"}],"source_content_type":"text/x-python","patch_set":21,"id":"ecf99048_0f00ff6b","line":728,"updated":"2021-07-29 16:33:35.000000000","message":"If you\u0027re going to pop it out anyway, why not just make this a defaulted kwarg in the signature?\n\n def list(self, *args, namespace\u003dNone, **kwargs):\n\nThen you don\u0027t have to pop it and it\u0027s more clear that this takes a namespace arg.\n\nThat said, when does this need to be optional? It\u0027s always better (IMHO) to make things explicit when we can. Won\u0027t this just be called from a known location where we can always pass namespace? Will we ever not actually have a namespace to pass?","commit_id":"5e1c13ed2ed8b25a0bd3d6f6097bbc97afd2be95"},{"author":{"_account_id":19138,"name":"Pranali Deore","email":"pdeore@redhat.com","username":"PranaliD"},"change_message_id":"1f82e1bbe45ae968592ed66a1cf41e7d12b3c871","unresolved":false,"context_lines":[{"line_number":725,"context_line":"            resource_type_proxy_kwargs\u003dproxy_kwargs)"},{"line_number":726,"context_line":""},{"line_number":727,"context_line":"    def list(self, *args, **kwargs):"},{"line_number":728,"context_line":"        namespace \u003d kwargs.pop(\u0027namespace\u0027, None)"},{"line_number":729,"context_line":"        if namespace:"},{"line_number":730,"context_line":"            target \u003d _build_namespace_target(namespace)"},{"line_number":731,"context_line":"        else:"}],"source_content_type":"text/x-python","patch_set":21,"id":"7472e8e5_1fa97ac1","line":728,"range":{"start_line":728,"start_character":8,"end_line":728,"end_character":49},"in_reply_to":"02e54440_127affbb","updated":"2021-07-30 09:05:21.000000000","message":"Done","commit_id":"5e1c13ed2ed8b25a0bd3d6f6097bbc97afd2be95"},{"author":{"_account_id":4393,"name":"Dan Smith","email":"dms@danplanet.com","username":"danms"},"change_message_id":"a067951d08b29cca2084160fd032a1132c72ee8d","unresolved":true,"context_lines":[{"line_number":730,"context_line":"            target \u003d _build_namespace_target(namespace)"},{"line_number":731,"context_line":"        else:"},{"line_number":732,"context_line":"            # noop the tenancy check and filter the response instead"},{"line_number":733,"context_line":"            target \u003d {\u0027project_id\u0027: self.context.project_id}"},{"line_number":734,"context_line":""},{"line_number":735,"context_line":"        self.policy.enforce("},{"line_number":736,"context_line":"            self.context, \u0027list_metadef_resource_types\u0027, target)"}],"source_content_type":"text/x-python","patch_set":21,"id":"b573025e_211b372e","line":733,"updated":"2021-07-29 16:33:35.000000000","message":"It\u0027s a bit unfortunate to have the target differ in some circumstances. I\u0027m not sure how the policy engine handles that, but could we default the visibility thing to either None or \"private\" or something?","commit_id":"5e1c13ed2ed8b25a0bd3d6f6097bbc97afd2be95"},{"author":{"_account_id":4393,"name":"Dan Smith","email":"dms@danplanet.com","username":"danms"},"change_message_id":"6700d0671834726494672e1d40ed57bedbbf787e","unresolved":true,"context_lines":[{"line_number":736,"context_line":"            # noop the tenancy check and filter the response instead"},{"line_number":737,"context_line":"            target \u003d {\u0027project_id\u0027: self.context.project_id}"},{"line_number":738,"context_line":""},{"line_number":739,"context_line":"        self.policy.enforce(self.context, \u0027get_metadef_resource_type\u0027, target)"},{"line_number":740,"context_line":"        return super(MetadefResourceTypeRepoProxy, self).get(*args, **kwargs)"},{"line_number":741,"context_line":""},{"line_number":742,"context_line":"    def add(self, resource_type):"}],"source_content_type":"text/x-python","patch_set":22,"id":"0aef1d25_f5bcafda","line":739,"updated":"2021-07-30 14:06:21.000000000","message":"Sorry I should have mentioned this before, but this should be:\n\n try:\n     self.policy.enforce(...)\n except Forbidden:\n     raise NotFound()\n\nI think. Part of the previous problem with this API was that it was too easy to discover things that weren\u0027t yours, even if just the name or existence of those. In general, it\u0027s best to \"play dumb\" and not reveal to an unauthorized user that something exists if they do not have permission to see it.","commit_id":"716b4d058e4a2fc790ec762e6eca6ae085318c5e"},{"author":{"_account_id":19138,"name":"Pranali Deore","email":"pdeore@redhat.com","username":"PranaliD"},"change_message_id":"61d1a16aace35c2c120c723dc1fd3eff5c599c7e","unresolved":true,"context_lines":[{"line_number":736,"context_line":"            # noop the tenancy check and filter the response instead"},{"line_number":737,"context_line":"            target \u003d {\u0027project_id\u0027: self.context.project_id}"},{"line_number":738,"context_line":""},{"line_number":739,"context_line":"        self.policy.enforce(self.context, \u0027get_metadef_resource_type\u0027, target)"},{"line_number":740,"context_line":"        return super(MetadefResourceTypeRepoProxy, self).get(*args, **kwargs)"},{"line_number":741,"context_line":""},{"line_number":742,"context_line":"    def add(self, resource_type):"}],"source_content_type":"text/x-python","patch_set":22,"id":"8c7059de_d6bdf9e6","line":739,"in_reply_to":"0aef1d25_f5bcafda","updated":"2021-07-30 18:23:47.000000000","message":"Yeah, that makes sense :)","commit_id":"716b4d058e4a2fc790ec762e6eca6ae085318c5e"},{"author":{"_account_id":9303,"name":"Abhishek Kekane","email":"akekane@redhat.com","username":"abhishekkekane"},"change_message_id":"d396904c10e5778d2c47ba91b9bafa5b5fc33644","unresolved":true,"context_lines":[{"line_number":730,"context_line":"        if namespace:"},{"line_number":731,"context_line":"            target.update(_build_namespace_target(namespace))"},{"line_number":732,"context_line":"        else:"},{"line_number":733,"context_line":"            # noop the tenancy check and filter the response instead"},{"line_number":734,"context_line":"            target \u003d {\u0027project_id\u0027: self.context.project_id}"},{"line_number":735,"context_line":""},{"line_number":736,"context_line":"        try:"},{"line_number":737,"context_line":"            self.policy.enforce("}],"source_content_type":"text/x-python","patch_set":26,"id":"ac41d8fc_26c63e43","line":734,"range":{"start_line":733,"start_character":12,"end_line":734,"end_character":60},"updated":"2021-08-02 15:10:59.000000000","message":"As per last comment if it is noop check then there is no need to pass it to the target.","commit_id":"0ce86c5159533bb8a52408e4db9af86ff7cc3dd0"},{"author":{"_account_id":19138,"name":"Pranali Deore","email":"pdeore@redhat.com","username":"PranaliD"},"change_message_id":"cee9cf3cd77a8d704de27d25a282c29902a96210","unresolved":false,"context_lines":[{"line_number":730,"context_line":"        if namespace:"},{"line_number":731,"context_line":"            target.update(_build_namespace_target(namespace))"},{"line_number":732,"context_line":"        else:"},{"line_number":733,"context_line":"            # noop the tenancy check and filter the response instead"},{"line_number":734,"context_line":"            target \u003d {\u0027project_id\u0027: self.context.project_id}"},{"line_number":735,"context_line":""},{"line_number":736,"context_line":"        try:"},{"line_number":737,"context_line":"            self.policy.enforce("}],"source_content_type":"text/x-python","patch_set":26,"id":"330de8b4_3e8079dc","line":734,"range":{"start_line":733,"start_character":12,"end_line":734,"end_character":60},"in_reply_to":"ac41d8fc_26c63e43","updated":"2021-08-02 16:04:25.000000000","message":"Ack","commit_id":"0ce86c5159533bb8a52408e4db9af86ff7cc3dd0"},{"author":{"_account_id":9303,"name":"Abhishek Kekane","email":"akekane@redhat.com","username":"abhishekkekane"},"change_message_id":"d396904c10e5778d2c47ba91b9bafa5b5fc33644","unresolved":true,"context_lines":[{"line_number":725,"context_line":"            resource_type_proxy_class\u003dMetadefResourceTypeProxy,"},{"line_number":726,"context_line":"            resource_type_proxy_kwargs\u003dproxy_kwargs)"},{"line_number":727,"context_line":""},{"line_number":728,"context_line":"    def _enforce_policy_if_namespace_available(self, namespace, action):"},{"line_number":729,"context_line":"        target \u003d {}"},{"line_number":730,"context_line":"        if namespace:"},{"line_number":731,"context_line":"            target.update(_build_namespace_target(namespace))"},{"line_number":732,"context_line":"        else:"},{"line_number":733,"context_line":"            # noop the tenancy check and filter the response instead"},{"line_number":734,"context_line":"            target \u003d {\u0027project_id\u0027: self.context.project_id}"},{"line_number":735,"context_line":""},{"line_number":736,"context_line":"        try:"},{"line_number":737,"context_line":"            self.policy.enforce("},{"line_number":738,"context_line":"                self.context, action, target)"},{"line_number":739,"context_line":"        except exception.Forbidden:"},{"line_number":740,"context_line":"            # NOTE (pdeore): Returning 404 Not Found as the"},{"line_number":741,"context_line":"            # namespace is outside of this user\u0027s project"},{"line_number":742,"context_line":"            msg \u003d _(\"Namespace %s not found\") % namespace"},{"line_number":743,"context_line":"            raise exception.NotFound(msg)"},{"line_number":744,"context_line":""},{"line_number":745,"context_line":"    def list(self, *args, namespace\u003dNone, **kwargs):"},{"line_number":746,"context_line":"        # NOTE (pdeore): If namespace is available, the policy needs"},{"line_number":747,"context_line":"        # to be enforce with the expected target. In show api of"},{"line_number":748,"context_line":"        # resource type, this list() of policy is called instead of"},{"line_number":749,"context_line":"        # get()."},{"line_number":750,"context_line":"        if namespace:"},{"line_number":751,"context_line":"            self._enforce_policy_if_namespace_available("},{"line_number":752,"context_line":"                namespace, \u0027list_metadef_resource_types\u0027)"},{"line_number":753,"context_line":"        else:"},{"line_number":754,"context_line":"            self.policy.enforce("},{"line_number":755,"context_line":"                self.context, \u0027list_metadef_resource_types\u0027, {})"},{"line_number":756,"context_line":"        return super(MetadefResourceTypeRepoProxy, self).list(*args, **kwargs)"},{"line_number":757,"context_line":""},{"line_number":758,"context_line":"    def get(self, *args, namespace\u003dNone, **kwargs):"},{"line_number":759,"context_line":"        # NOTE (pdeore): This method is called only from show property API"},{"line_number":760,"context_line":"        self._enforce_policy_if_namespace_available("},{"line_number":761,"context_line":"            namespace, \u0027get_metadef_resource_type\u0027)"},{"line_number":762,"context_line":"        return super(MetadefResourceTypeRepoProxy, self).get(*args, **kwargs)"},{"line_number":763,"context_line":""},{"line_number":764,"context_line":"    def add(self, resource_type):"},{"line_number":765,"context_line":"        self.policy.enforce(self.context,"}],"source_content_type":"text/x-python","patch_set":26,"id":"8376c286_d7461ec2","line":762,"range":{"start_line":728,"start_character":4,"end_line":762,"end_character":77},"updated":"2021-08-02 15:10:59.000000000","message":"You can simplify this with;\nhttps://paste.opendev.org/show/807849/","commit_id":"0ce86c5159533bb8a52408e4db9af86ff7cc3dd0"},{"author":{"_account_id":19138,"name":"Pranali Deore","email":"pdeore@redhat.com","username":"PranaliD"},"change_message_id":"cee9cf3cd77a8d704de27d25a282c29902a96210","unresolved":false,"context_lines":[{"line_number":725,"context_line":"            resource_type_proxy_class\u003dMetadefResourceTypeProxy,"},{"line_number":726,"context_line":"            resource_type_proxy_kwargs\u003dproxy_kwargs)"},{"line_number":727,"context_line":""},{"line_number":728,"context_line":"    def _enforce_policy_if_namespace_available(self, namespace, action):"},{"line_number":729,"context_line":"        target \u003d {}"},{"line_number":730,"context_line":"        if namespace:"},{"line_number":731,"context_line":"            target.update(_build_namespace_target(namespace))"},{"line_number":732,"context_line":"        else:"},{"line_number":733,"context_line":"            # noop the tenancy check and filter the response instead"},{"line_number":734,"context_line":"            target \u003d {\u0027project_id\u0027: self.context.project_id}"},{"line_number":735,"context_line":""},{"line_number":736,"context_line":"        try:"},{"line_number":737,"context_line":"            self.policy.enforce("},{"line_number":738,"context_line":"                self.context, action, target)"},{"line_number":739,"context_line":"        except exception.Forbidden:"},{"line_number":740,"context_line":"            # NOTE (pdeore): Returning 404 Not Found as the"},{"line_number":741,"context_line":"            # namespace is outside of this user\u0027s project"},{"line_number":742,"context_line":"            msg \u003d _(\"Namespace %s not found\") % namespace"},{"line_number":743,"context_line":"            raise exception.NotFound(msg)"},{"line_number":744,"context_line":""},{"line_number":745,"context_line":"    def list(self, *args, namespace\u003dNone, **kwargs):"},{"line_number":746,"context_line":"        # NOTE (pdeore): If namespace is available, the policy needs"},{"line_number":747,"context_line":"        # to be enforce with the expected target. In show api of"},{"line_number":748,"context_line":"        # resource type, this list() of policy is called instead of"},{"line_number":749,"context_line":"        # get()."},{"line_number":750,"context_line":"        if namespace:"},{"line_number":751,"context_line":"            self._enforce_policy_if_namespace_available("},{"line_number":752,"context_line":"                namespace, \u0027list_metadef_resource_types\u0027)"},{"line_number":753,"context_line":"        else:"},{"line_number":754,"context_line":"            self.policy.enforce("},{"line_number":755,"context_line":"                self.context, \u0027list_metadef_resource_types\u0027, {})"},{"line_number":756,"context_line":"        return super(MetadefResourceTypeRepoProxy, self).list(*args, **kwargs)"},{"line_number":757,"context_line":""},{"line_number":758,"context_line":"    def get(self, *args, namespace\u003dNone, **kwargs):"},{"line_number":759,"context_line":"        # NOTE (pdeore): This method is called only from show property API"},{"line_number":760,"context_line":"        self._enforce_policy_if_namespace_available("},{"line_number":761,"context_line":"            namespace, \u0027get_metadef_resource_type\u0027)"},{"line_number":762,"context_line":"        return super(MetadefResourceTypeRepoProxy, self).get(*args, **kwargs)"},{"line_number":763,"context_line":""},{"line_number":764,"context_line":"    def add(self, resource_type):"},{"line_number":765,"context_line":"        self.policy.enforce(self.context,"}],"source_content_type":"text/x-python","patch_set":26,"id":"af8cdf82_245c91c7","line":762,"range":{"start_line":728,"start_character":4,"end_line":762,"end_character":77},"in_reply_to":"8376c286_d7461ec2","updated":"2021-08-02 16:04:25.000000000","message":"Ack","commit_id":"0ce86c5159533bb8a52408e4db9af86ff7cc3dd0"}],"glance/api/v2/metadef_objects.py":[{"author":{"_account_id":9303,"name":"Abhishek Kekane","email":"akekane@redhat.com","username":"abhishekkekane"},"change_message_id":"b0707f6f6757bf708731e2cdef8ce3d558a488d0","unresolved":true,"context_lines":[{"line_number":50,"context_line":"    def create(self, req, metadata_object, namespace):"},{"line_number":51,"context_line":"        object_factory \u003d self.gateway.get_metadef_object_factory(req.context)"},{"line_number":52,"context_line":"        object_repo \u003d self.gateway.get_metadef_object_repo(req.context)"},{"line_number":53,"context_line":"        try:"},{"line_number":54,"context_line":"            new_meta_object \u003d object_factory.new_object("},{"line_number":55,"context_line":"                namespace\u003dnamespace,"},{"line_number":56,"context_line":"                **metadata_object.to_dict())"}],"source_content_type":"text/x-python","patch_set":5,"id":"8b8cd93a_8e972129","line":53,"updated":"2021-07-12 09:56:08.000000000","message":"Here also you can validate that if namespace is accessible or not like you are doing it for update and delete.","commit_id":"ef998b65a525cded91b6183f21a16fe6650ca2f7"},{"author":{"_account_id":19138,"name":"Pranali Deore","email":"pdeore@redhat.com","username":"PranaliD"},"change_message_id":"449d8471f970e140e1ae15325ae40a5b1cb688a0","unresolved":true,"context_lines":[{"line_number":50,"context_line":"    def create(self, req, metadata_object, namespace):"},{"line_number":51,"context_line":"        object_factory \u003d self.gateway.get_metadef_object_factory(req.context)"},{"line_number":52,"context_line":"        object_repo \u003d self.gateway.get_metadef_object_repo(req.context)"},{"line_number":53,"context_line":"        try:"},{"line_number":54,"context_line":"            new_meta_object \u003d object_factory.new_object("},{"line_number":55,"context_line":"                namespace\u003dnamespace,"},{"line_number":56,"context_line":"                **metadata_object.to_dict())"}],"source_content_type":"text/x-python","patch_set":5,"id":"7a59cdfe_6616acc0","line":53,"in_reply_to":"8b8cd93a_8e972129","updated":"2021-07-13 09:09:07.000000000","message":"It\u0027s done for update and delete because while fetching the existing object with specific namespace, at the policy layer it tries to look for owner \u0026 visibility of the ns while setting up the target.\n\nI thinks it\u0027s not required here for create bcz only admin can create the object where all the namespaces are accessible and as it\u0027s a new object there no get object with specific namespace call made here.","commit_id":"ef998b65a525cded91b6183f21a16fe6650ca2f7"},{"author":{"_account_id":9303,"name":"Abhishek Kekane","email":"akekane@redhat.com","username":"abhishekkekane"},"change_message_id":"b0707f6f6757bf708731e2cdef8ce3d558a488d0","unresolved":true,"context_lines":[{"line_number":80,"context_line":"              sort_key\u003d\u0027created_at\u0027, sort_dir\u003d\u0027desc\u0027, filters\u003dNone):"},{"line_number":81,"context_line":"        try:"},{"line_number":82,"context_line":"            ns_repo \u003d self.gateway.get_metadef_namespace_repo(req.context)"},{"line_number":83,"context_line":"            namespace_obj \u003d ns_repo.get(namespace)"},{"line_number":84,"context_line":""},{"line_number":85,"context_line":"            filters \u003d filters or dict()"},{"line_number":86,"context_line":"            filters[\u0027namespace\u0027] \u003d namespace"}],"source_content_type":"text/x-python","patch_set":5,"id":"7cee965d_055f5ec6","line":83,"range":{"start_line":83,"start_character":12,"end_line":83,"end_character":50},"updated":"2021-07-12 09:56:08.000000000","message":"I think here also you need to add fix me statement because at this line it will give you 404 error if you tried to access private namespace of another project.","commit_id":"ef998b65a525cded91b6183f21a16fe6650ca2f7"},{"author":{"_account_id":19138,"name":"Pranali Deore","email":"pdeore@redhat.com","username":"PranaliD"},"change_message_id":"449d8471f970e140e1ae15325ae40a5b1cb688a0","unresolved":false,"context_lines":[{"line_number":80,"context_line":"              sort_key\u003d\u0027created_at\u0027, sort_dir\u003d\u0027desc\u0027, filters\u003dNone):"},{"line_number":81,"context_line":"        try:"},{"line_number":82,"context_line":"            ns_repo \u003d self.gateway.get_metadef_namespace_repo(req.context)"},{"line_number":83,"context_line":"            namespace_obj \u003d ns_repo.get(namespace)"},{"line_number":84,"context_line":""},{"line_number":85,"context_line":"            filters \u003d filters or dict()"},{"line_number":86,"context_line":"            filters[\u0027namespace\u0027] \u003d namespace"}],"source_content_type":"text/x-python","patch_set":5,"id":"49b07857_a13003b3","line":83,"range":{"start_line":83,"start_character":12,"end_line":83,"end_character":50},"in_reply_to":"7cee965d_055f5ec6","updated":"2021-07-13 09:09:07.000000000","message":"Ack","commit_id":"ef998b65a525cded91b6183f21a16fe6650ca2f7"},{"author":{"_account_id":9303,"name":"Abhishek Kekane","email":"akekane@redhat.com","username":"abhishekkekane"},"change_message_id":"b0707f6f6757bf708731e2cdef8ce3d558a488d0","unresolved":true,"context_lines":[{"line_number":110,"context_line":"            req.context)"},{"line_number":111,"context_line":"        try:"},{"line_number":112,"context_line":"            ns_repo \u003d self.gateway.get_metadef_namespace_repo(req.context)"},{"line_number":113,"context_line":"            namespace_obj \u003d ns_repo.get(namespace)"},{"line_number":114,"context_line":""},{"line_number":115,"context_line":"            metadef_object \u003d meta_object_repo.get(namespace_obj, object_name)"},{"line_number":116,"context_line":"            return MetadefObject.to_wsme_model("}],"source_content_type":"text/x-python","patch_set":5,"id":"dd1690c6_e9c84556","line":113,"range":{"start_line":113,"start_character":12,"end_line":113,"end_character":50},"updated":"2021-07-12 09:56:08.000000000","message":"ditto","commit_id":"ef998b65a525cded91b6183f21a16fe6650ca2f7"},{"author":{"_account_id":19138,"name":"Pranali Deore","email":"pdeore@redhat.com","username":"PranaliD"},"change_message_id":"449d8471f970e140e1ae15325ae40a5b1cb688a0","unresolved":false,"context_lines":[{"line_number":110,"context_line":"            req.context)"},{"line_number":111,"context_line":"        try:"},{"line_number":112,"context_line":"            ns_repo \u003d self.gateway.get_metadef_namespace_repo(req.context)"},{"line_number":113,"context_line":"            namespace_obj \u003d ns_repo.get(namespace)"},{"line_number":114,"context_line":""},{"line_number":115,"context_line":"            metadef_object \u003d meta_object_repo.get(namespace_obj, object_name)"},{"line_number":116,"context_line":"            return MetadefObject.to_wsme_model("}],"source_content_type":"text/x-python","patch_set":5,"id":"10fbecb6_495c08d3","line":113,"range":{"start_line":113,"start_character":12,"end_line":113,"end_character":50},"in_reply_to":"dd1690c6_e9c84556","updated":"2021-07-13 09:09:07.000000000","message":"Ack","commit_id":"ef998b65a525cded91b6183f21a16fe6650ca2f7"},{"author":{"_account_id":9303,"name":"Abhishek Kekane","email":"akekane@redhat.com","username":"abhishekkekane"},"change_message_id":"b0707f6f6757bf708731e2cdef8ce3d558a488d0","unresolved":true,"context_lines":[{"line_number":131,"context_line":"        meta_repo \u003d self.gateway.get_metadef_object_repo(req.context)"},{"line_number":132,"context_line":"        try:"},{"line_number":133,"context_line":"            ns_repo \u003d self.gateway.get_metadef_namespace_repo(req.context)"},{"line_number":134,"context_line":"            namespace_obj \u003d ns_repo.get(namespace)"},{"line_number":135,"context_line":""},{"line_number":136,"context_line":"            metadef_object \u003d meta_repo.get(namespace_obj, object_name)"},{"line_number":137,"context_line":"            metadef_object._old_name \u003d metadef_object.name"}],"source_content_type":"text/x-python","patch_set":5,"id":"d782ca15_6817627b","line":134,"range":{"start_line":134,"start_character":12,"end_line":134,"end_character":50},"updated":"2021-07-12 09:56:08.000000000","message":"ditto","commit_id":"ef998b65a525cded91b6183f21a16fe6650ca2f7"},{"author":{"_account_id":19138,"name":"Pranali Deore","email":"pdeore@redhat.com","username":"PranaliD"},"change_message_id":"449d8471f970e140e1ae15325ae40a5b1cb688a0","unresolved":false,"context_lines":[{"line_number":131,"context_line":"        meta_repo \u003d self.gateway.get_metadef_object_repo(req.context)"},{"line_number":132,"context_line":"        try:"},{"line_number":133,"context_line":"            ns_repo \u003d self.gateway.get_metadef_namespace_repo(req.context)"},{"line_number":134,"context_line":"            namespace_obj \u003d ns_repo.get(namespace)"},{"line_number":135,"context_line":""},{"line_number":136,"context_line":"            metadef_object \u003d meta_repo.get(namespace_obj, object_name)"},{"line_number":137,"context_line":"            metadef_object._old_name \u003d metadef_object.name"}],"source_content_type":"text/x-python","patch_set":5,"id":"e018991e_528122b7","line":134,"range":{"start_line":134,"start_character":12,"end_line":134,"end_character":50},"in_reply_to":"d782ca15_6817627b","updated":"2021-07-13 09:09:07.000000000","message":"Ack","commit_id":"ef998b65a525cded91b6183f21a16fe6650ca2f7"},{"author":{"_account_id":9303,"name":"Abhishek Kekane","email":"akekane@redhat.com","username":"abhishekkekane"},"change_message_id":"b0707f6f6757bf708731e2cdef8ce3d558a488d0","unresolved":true,"context_lines":[{"line_number":168,"context_line":"        meta_repo \u003d self.gateway.get_metadef_object_repo(req.context)"},{"line_number":169,"context_line":"        try:"},{"line_number":170,"context_line":"            ns_repo \u003d self.gateway.get_metadef_namespace_repo(req.context)"},{"line_number":171,"context_line":"            namespace_obj \u003d ns_repo.get(namespace)"},{"line_number":172,"context_line":""},{"line_number":173,"context_line":"            metadef_object \u003d meta_repo.get(namespace_obj, object_name)"},{"line_number":174,"context_line":"            metadef_object.delete()"}],"source_content_type":"text/x-python","patch_set":5,"id":"d241ce8e_5b29fd7c","line":171,"range":{"start_line":171,"start_character":12,"end_line":171,"end_character":50},"updated":"2021-07-12 09:56:08.000000000","message":"ditto","commit_id":"ef998b65a525cded91b6183f21a16fe6650ca2f7"},{"author":{"_account_id":19138,"name":"Pranali Deore","email":"pdeore@redhat.com","username":"PranaliD"},"change_message_id":"449d8471f970e140e1ae15325ae40a5b1cb688a0","unresolved":false,"context_lines":[{"line_number":168,"context_line":"        meta_repo \u003d self.gateway.get_metadef_object_repo(req.context)"},{"line_number":169,"context_line":"        try:"},{"line_number":170,"context_line":"            ns_repo \u003d self.gateway.get_metadef_namespace_repo(req.context)"},{"line_number":171,"context_line":"            namespace_obj \u003d ns_repo.get(namespace)"},{"line_number":172,"context_line":""},{"line_number":173,"context_line":"            metadef_object \u003d meta_repo.get(namespace_obj, object_name)"},{"line_number":174,"context_line":"            metadef_object.delete()"}],"source_content_type":"text/x-python","patch_set":5,"id":"b54e7923_008bacb5","line":171,"range":{"start_line":171,"start_character":12,"end_line":171,"end_character":50},"in_reply_to":"d241ce8e_5b29fd7c","updated":"2021-07-13 09:09:07.000000000","message":"Ack","commit_id":"ef998b65a525cded91b6183f21a16fe6650ca2f7"}],"glance/api/v2/metadef_resource_types.py":[{"author":{"_account_id":9303,"name":"Abhishek Kekane","email":"akekane@redhat.com","username":"abhishekkekane"},"change_message_id":"b0707f6f6757bf708731e2cdef8ce3d558a488d0","unresolved":true,"context_lines":[{"line_number":70,"context_line":"    def show(self, req, namespace):"},{"line_number":71,"context_line":"        try:"},{"line_number":72,"context_line":"            ns_repo \u003d self.gateway.get_metadef_namespace_repo(req.context)"},{"line_number":73,"context_line":"            namespace_obj \u003d ns_repo.get(namespace)"},{"line_number":74,"context_line":""},{"line_number":75,"context_line":"            filters \u003d {\u0027namespace\u0027: namespace}"},{"line_number":76,"context_line":"            rs_type_repo \u003d self.gateway.get_metadef_resource_type_repo("}],"source_content_type":"text/x-python","patch_set":5,"id":"de17ca2d_5c3029fd","line":73,"range":{"start_line":73,"start_character":12,"end_line":73,"end_character":50},"updated":"2021-07-12 09:56:08.000000000","message":"ditto","commit_id":"ef998b65a525cded91b6183f21a16fe6650ca2f7"},{"author":{"_account_id":19138,"name":"Pranali Deore","email":"pdeore@redhat.com","username":"PranaliD"},"change_message_id":"449d8471f970e140e1ae15325ae40a5b1cb688a0","unresolved":false,"context_lines":[{"line_number":70,"context_line":"    def show(self, req, namespace):"},{"line_number":71,"context_line":"        try:"},{"line_number":72,"context_line":"            ns_repo \u003d self.gateway.get_metadef_namespace_repo(req.context)"},{"line_number":73,"context_line":"            namespace_obj \u003d ns_repo.get(namespace)"},{"line_number":74,"context_line":""},{"line_number":75,"context_line":"            filters \u003d {\u0027namespace\u0027: namespace}"},{"line_number":76,"context_line":"            rs_type_repo \u003d self.gateway.get_metadef_resource_type_repo("}],"source_content_type":"text/x-python","patch_set":5,"id":"da935def_7fa6d6a0","line":73,"range":{"start_line":73,"start_character":12,"end_line":73,"end_character":50},"in_reply_to":"de17ca2d_5c3029fd","updated":"2021-07-13 09:09:07.000000000","message":"Ack","commit_id":"ef998b65a525cded91b6183f21a16fe6650ca2f7"},{"author":{"_account_id":9303,"name":"Abhishek Kekane","email":"akekane@redhat.com","username":"abhishekkekane"},"change_message_id":"b0707f6f6757bf708731e2cdef8ce3d558a488d0","unresolved":true,"context_lines":[{"line_number":119,"context_line":"        try:"},{"line_number":120,"context_line":"            filters \u003d {}"},{"line_number":121,"context_line":"            found \u003d False"},{"line_number":122,"context_line":"            filters[\u0027namespace\u0027] \u003d namespace"},{"line_number":123,"context_line":"            db_resource_type_list \u003d rs_type_repo.list(filters\u003dfilters)"},{"line_number":124,"context_line":"            for db_resource_type in db_resource_type_list:"},{"line_number":125,"context_line":"                if db_resource_type.name \u003d\u003d resource_type:"}],"source_content_type":"text/x-python","patch_set":5,"id":"89385faf_fbc041d4","line":122,"range":{"start_line":122,"start_character":12,"end_line":122,"end_character":44},"updated":"2021-07-12 09:56:08.000000000","message":"you can check whether namespace is visible of not here only.","commit_id":"ef998b65a525cded91b6183f21a16fe6650ca2f7"},{"author":{"_account_id":9303,"name":"Abhishek Kekane","email":"akekane@redhat.com","username":"abhishekkekane"},"change_message_id":"daca2c5f0a9ef5292298c7c583fab73566451cc4","unresolved":true,"context_lines":[{"line_number":117,"context_line":"    def delete(self, req, namespace, resource_type):"},{"line_number":118,"context_line":"        rs_type_repo \u003d self.gateway.get_metadef_resource_type_repo(req.context)"},{"line_number":119,"context_line":"        try:"},{"line_number":120,"context_line":"            ns_repo \u003d self.gateway.get_metadef_namespace_repo(req.context)"},{"line_number":121,"context_line":"            namespace_obj \u003d ns_repo.get(namespace)"},{"line_number":122,"context_line":""},{"line_number":123,"context_line":"            filters \u003d {}"},{"line_number":124,"context_line":"            found \u003d False"},{"line_number":125,"context_line":"            filters[\u0027namespace\u0027] \u003d namespace"},{"line_number":126,"context_line":"            db_resource_type_list \u003d rs_type_repo.list("},{"line_number":127,"context_line":"                filters\u003dfilters, namespace\u003dnamespace_obj)"},{"line_number":128,"context_line":"            for db_resource_type in db_resource_type_list:"},{"line_number":129,"context_line":"                if db_resource_type.name \u003d\u003d resource_type:"},{"line_number":130,"context_line":"                    db_resource_type.delete()"}],"source_content_type":"text/x-python","patch_set":18,"id":"9a1c5e8d_c36f10dc","line":127,"range":{"start_line":120,"start_character":12,"end_line":127,"end_character":57},"updated":"2021-07-23 17:22:52.000000000","message":"I don\u0027t think you need any changes in this method as anyway this method is allowed to be called by admin only.","commit_id":"a8a1916f24327688546727b0f00bc452fa6147ac"}],"glance/policies/metadef.py":[{"author":{"_account_id":9303,"name":"Abhishek Kekane","email":"akekane@redhat.com","username":"abhishekkekane"},"change_message_id":"7f2aab7d4a22d07194bfccf475f9c5a19963c357","unresolved":true,"context_lines":[{"line_number":101,"context_line":"        deprecated_rule\u003dpolicy.DeprecatedRule("},{"line_number":102,"context_line":"            name\u003d\"get_metadef_object\", check_str\u003d\"rule:metadef_admin\""},{"line_number":103,"context_line":"        ),"},{"line_number":104,"context_line":"        deprecated_reason\u003dDEPRECATED_REASON,"},{"line_number":105,"context_line":"        deprecated_since\u003dversionutils.deprecated.WALLABY"},{"line_number":106,"context_line":"    ),"},{"line_number":107,"context_line":"    policy.DocumentedRuleDefault("},{"line_number":108,"context_line":"        name\u003d\"get_metadef_objects\","}],"source_content_type":"text/x-python","patch_set":1,"id":"76bb560c_b664fc50","line":105,"range":{"start_line":104,"start_character":9,"end_line":105,"end_character":56},"updated":"2021-07-06 13:46:55.000000000","message":"ditto","commit_id":"c9db03b4a2f3fea925a4ad71dc00d23edea1828c"},{"author":{"_account_id":9303,"name":"Abhishek Kekane","email":"akekane@redhat.com","username":"abhishekkekane"},"change_message_id":"daca2c5f0a9ef5292298c7c583fab73566451cc4","unresolved":true,"context_lines":[{"line_number":98,"context_line":""},{"line_number":99,"context_line":"    policy.DocumentedRuleDefault("},{"line_number":100,"context_line":"        name\u003d\"list_metadef_resource_types\","},{"line_number":101,"context_line":"        check_str\u003dbase.ADMIN_OR_PROJECT_READER_GET_NAMESPACE,"},{"line_number":102,"context_line":"        scope_types\u003d[\u0027system\u0027, \u0027project\u0027],"},{"line_number":103,"context_line":"        description\u003d\"List meta definition resource types.\","},{"line_number":104,"context_line":"        operations\u003d["}],"source_content_type":"text/x-python","patch_set":18,"id":"25536fa0_37af458e","line":101,"range":{"start_line":101,"start_character":18,"end_line":101,"end_character":60},"updated":"2021-07-23 17:22:52.000000000","message":"I think this api should not have any restrictions because its not related to namespace, neither do have any of its own visibility. So this should be open to all.","commit_id":"a8a1916f24327688546727b0f00bc452fa6147ac"},{"author":{"_account_id":9303,"name":"Abhishek Kekane","email":"akekane@redhat.com","username":"abhishekkekane"},"change_message_id":"365bdf742cd1802964b3e898190aae9d08a17c48","unresolved":true,"context_lines":[{"line_number":98,"context_line":""},{"line_number":99,"context_line":"    # Resource types list need not to have any restriction"},{"line_number":100,"context_line":"    # since its not related to namespace"},{"line_number":101,"context_line":"    policy.RuleDefault(name\u003d\"list_metadef_resource_types\","},{"line_number":102,"context_line":"                       check_str\u003d\"rule:metadef_default\"),"},{"line_number":103,"context_line":""},{"line_number":104,"context_line":"    policy.DocumentedRuleDefault("},{"line_number":105,"context_line":"        name\u003d\"get_metadef_resource_type\","}],"source_content_type":"text/x-python","patch_set":20,"id":"15f959bc_64c8b03f","line":102,"range":{"start_line":101,"start_character":4,"end_line":102,"end_character":57},"updated":"2021-07-27 08:13:50.000000000","message":"I am little doubtful about this. I guess even though this policy rule will remain same we do need to add scope_types here.\n\nMaybe you can cross check with RBAC guys, (Harry I guess as lance is on leave)","commit_id":"12207a9752781f4d8984e50b9f54d72d44801184"},{"author":{"_account_id":19138,"name":"Pranali Deore","email":"pdeore@redhat.com","username":"PranaliD"},"change_message_id":"679234a5c28660e0b637d68592397fcbe8064ccc","unresolved":true,"context_lines":[{"line_number":98,"context_line":""},{"line_number":99,"context_line":"    # Resource types list need not to have any restriction"},{"line_number":100,"context_line":"    # since its not related to namespace"},{"line_number":101,"context_line":"    policy.RuleDefault(name\u003d\"list_metadef_resource_types\","},{"line_number":102,"context_line":"                       check_str\u003d\"rule:metadef_default\"),"},{"line_number":103,"context_line":""},{"line_number":104,"context_line":"    policy.DocumentedRuleDefault("},{"line_number":105,"context_line":"        name\u003d\"get_metadef_resource_type\","}],"source_content_type":"text/x-python","patch_set":20,"id":"10e6e48f_3e7af3dd","line":102,"range":{"start_line":101,"start_character":4,"end_line":102,"end_character":57},"in_reply_to":"15f959bc_64c8b03f","updated":"2021-07-29 12:21:14.000000000","message":"Yeah, I also think scope_type will require here.","commit_id":"12207a9752781f4d8984e50b9f54d72d44801184"},{"author":{"_account_id":9303,"name":"Abhishek Kekane","email":"akekane@redhat.com","username":"abhishekkekane"},"change_message_id":"f3018a069be55cbd30c64e92c4871a8c6fd16679","unresolved":true,"context_lines":[{"line_number":98,"context_line":""},{"line_number":99,"context_line":"    # Resource types list need not to have any restriction"},{"line_number":100,"context_line":"    # since its not related to namespace"},{"line_number":101,"context_line":""},{"line_number":102,"context_line":"    policy.DocumentedRuleDefault("},{"line_number":103,"context_line":"        name\u003d\"list_metadef_resource_types\","},{"line_number":104,"context_line":"        check_str\u003d\"rule:metadef_default\","}],"source_content_type":"text/x-python","patch_set":21,"id":"c691b31c_a51620f8","line":101,"updated":"2021-07-29 15:57:07.000000000","message":"Unnecessary new line","commit_id":"5e1c13ed2ed8b25a0bd3d6f6097bbc97afd2be95"},{"author":{"_account_id":19138,"name":"Pranali Deore","email":"pdeore@redhat.com","username":"PranaliD"},"change_message_id":"1f82e1bbe45ae968592ed66a1cf41e7d12b3c871","unresolved":false,"context_lines":[{"line_number":98,"context_line":""},{"line_number":99,"context_line":"    # Resource types list need not to have any restriction"},{"line_number":100,"context_line":"    # since its not related to namespace"},{"line_number":101,"context_line":""},{"line_number":102,"context_line":"    policy.DocumentedRuleDefault("},{"line_number":103,"context_line":"        name\u003d\"list_metadef_resource_types\","},{"line_number":104,"context_line":"        check_str\u003d\"rule:metadef_default\","}],"source_content_type":"text/x-python","patch_set":21,"id":"0da61de4_ace210cc","line":101,"in_reply_to":"c691b31c_a51620f8","updated":"2021-07-30 09:05:21.000000000","message":"Done","commit_id":"5e1c13ed2ed8b25a0bd3d6f6097bbc97afd2be95"},{"author":{"_account_id":4393,"name":"Dan Smith","email":"dms@danplanet.com","username":"danms"},"change_message_id":"a067951d08b29cca2084160fd032a1132c72ee8d","unresolved":true,"context_lines":[{"line_number":101,"context_line":""},{"line_number":102,"context_line":"    policy.DocumentedRuleDefault("},{"line_number":103,"context_line":"        name\u003d\"list_metadef_resource_types\","},{"line_number":104,"context_line":"        check_str\u003d\"rule:metadef_default\","},{"line_number":105,"context_line":"        scope_types\u003d[\u0027system\u0027, \u0027project\u0027],"},{"line_number":106,"context_line":"        description\u003d\"List meta definition resource types.\","},{"line_number":107,"context_line":"        operations\u003d["}],"source_content_type":"text/x-python","patch_set":21,"id":"cad15c4b_5bbe992e","line":104,"updated":"2021-07-29 16:33:35.000000000","message":"Why is this not changing to be like get_metadef_resource_type? You\u0027re passing a target now, can\u0027t we write a rule similar to the others now?","commit_id":"5e1c13ed2ed8b25a0bd3d6f6097bbc97afd2be95"},{"author":{"_account_id":4393,"name":"Dan Smith","email":"dms@danplanet.com","username":"danms"},"change_message_id":"007915ed6963805581213305767596b67f5a891f","unresolved":true,"context_lines":[{"line_number":101,"context_line":""},{"line_number":102,"context_line":"    policy.DocumentedRuleDefault("},{"line_number":103,"context_line":"        name\u003d\"list_metadef_resource_types\","},{"line_number":104,"context_line":"        check_str\u003d\"rule:metadef_default\","},{"line_number":105,"context_line":"        scope_types\u003d[\u0027system\u0027, \u0027project\u0027],"},{"line_number":106,"context_line":"        description\u003d\"List meta definition resource types.\","},{"line_number":107,"context_line":"        operations\u003d["}],"source_content_type":"text/x-python","patch_set":21,"id":"88379cea_76e7309c","line":104,"in_reply_to":"7ba715a3_cbf2c41d","updated":"2021-07-29 16:55:54.000000000","message":"Okay I\u0027m confused why we\u0027re popping a namespace from the kwargs and building a target from it to pass to the enforce check for this rule then...","commit_id":"5e1c13ed2ed8b25a0bd3d6f6097bbc97afd2be95"},{"author":{"_account_id":9303,"name":"Abhishek Kekane","email":"akekane@redhat.com","username":"abhishekkekane"},"change_message_id":"9599de8b8d71bce860a2627b30098e7b11c86455","unresolved":true,"context_lines":[{"line_number":101,"context_line":""},{"line_number":102,"context_line":"    policy.DocumentedRuleDefault("},{"line_number":103,"context_line":"        name\u003d\"list_metadef_resource_types\","},{"line_number":104,"context_line":"        check_str\u003d\"rule:metadef_default\","},{"line_number":105,"context_line":"        scope_types\u003d[\u0027system\u0027, \u0027project\u0027],"},{"line_number":106,"context_line":"        description\u003d\"List meta definition resource types.\","},{"line_number":107,"context_line":"        operations\u003d["}],"source_content_type":"text/x-python","patch_set":21,"id":"df69192a_9bba21ad","line":104,"in_reply_to":"88379cea_76e7309c","updated":"2021-07-29 17:29:29.000000000","message":"You are right, we don\u0027t need that as well.","commit_id":"5e1c13ed2ed8b25a0bd3d6f6097bbc97afd2be95"},{"author":{"_account_id":9303,"name":"Abhishek Kekane","email":"akekane@redhat.com","username":"abhishekkekane"},"change_message_id":"5e2fc69ebbdda4a5bd8624a1213dd6579d2e2f4c","unresolved":true,"context_lines":[{"line_number":101,"context_line":""},{"line_number":102,"context_line":"    policy.DocumentedRuleDefault("},{"line_number":103,"context_line":"        name\u003d\"list_metadef_resource_types\","},{"line_number":104,"context_line":"        check_str\u003d\"rule:metadef_default\","},{"line_number":105,"context_line":"        scope_types\u003d[\u0027system\u0027, \u0027project\u0027],"},{"line_number":106,"context_line":"        description\u003d\"List meta definition resource types.\","},{"line_number":107,"context_line":"        operations\u003d["}],"source_content_type":"text/x-python","patch_set":21,"id":"7ba715a3_cbf2c41d","line":104,"in_reply_to":"a975b7ee_e0b11bdf","updated":"2021-07-29 16:46:59.000000000","message":"Or may be GLOBAL_VISIBILITY \u003d \u0027@\u0027","commit_id":"5e1c13ed2ed8b25a0bd3d6f6097bbc97afd2be95"},{"author":{"_account_id":9303,"name":"Abhishek Kekane","email":"akekane@redhat.com","username":"abhishekkekane"},"change_message_id":"2fd82f99a6af7e22ffe1fca823ee42ea6106f6af","unresolved":true,"context_lines":[{"line_number":101,"context_line":""},{"line_number":102,"context_line":"    policy.DocumentedRuleDefault("},{"line_number":103,"context_line":"        name\u003d\"list_metadef_resource_types\","},{"line_number":104,"context_line":"        check_str\u003d\"rule:metadef_default\","},{"line_number":105,"context_line":"        scope_types\u003d[\u0027system\u0027, \u0027project\u0027],"},{"line_number":106,"context_line":"        description\u003d\"List meta definition resource types.\","},{"line_number":107,"context_line":"        operations\u003d["}],"source_content_type":"text/x-python","patch_set":21,"id":"a975b7ee_e0b11bdf","line":104,"in_reply_to":"cad15c4b_5bbe992e","updated":"2021-07-29 16:45:23.000000000","message":"this api call /v2/metadefs/resource_types is not associated with namespace which actually means it does not have any restrictions to be viewable across the projects and that is why we have kept it like this. If you prefer to have constant define for this then it can be like\nOPEN_TO_ALL \u003d \"@\" ?\n\nhttps://docs.openstack.org/api-ref/image/v2/metadefs-index.html?expanded\u003dcreate-tag-definition-detail,create-tags-detail,get-tag-definition-detail,delete-all-tag-definitions-detail#list-resource-types","commit_id":"5e1c13ed2ed8b25a0bd3d6f6097bbc97afd2be95"},{"author":{"_account_id":5046,"name":"Lance Bragstad","email":"lbragstad@redhat.com","username":"ldbragst"},"change_message_id":"79912f5fd5886d9927e6892396768531cd4306cc","unresolved":true,"context_lines":[{"line_number":169,"context_line":"    ),"},{"line_number":170,"context_line":"    policy.DocumentedRuleDefault("},{"line_number":171,"context_line":"        name\u003d\"add_metadef_resource_type_association\","},{"line_number":172,"context_line":"        check_str\u003d\"rule:metadef_admin\","},{"line_number":173,"context_line":"        scope_types\u003d[\u0027system\u0027, \u0027project\u0027],"},{"line_number":174,"context_line":"        description\u003d\"Create meta definition resource types association.\","},{"line_number":175,"context_line":"        operations\u003d["}],"source_content_type":"text/x-python","patch_set":28,"id":"56dca603_dcf05413","line":172,"range":{"start_line":172,"start_character":19,"end_line":172,"end_character":37},"updated":"2021-08-18 20:40:22.000000000","message":"Because this evaluates to role:admin this is going to open up the API to both project-admins and system-admins. Is that what we want? Or are we going to tighten the check to be system-specific once the other refactors land?","commit_id":"ec31b7d40cac0655de8ef255bbad9275286caae6"},{"author":{"_account_id":5046,"name":"Lance Bragstad","email":"lbragstad@redhat.com","username":"ldbragst"},"change_message_id":"fb5e9817edd5aeb1ee6e088d97259a14cb2b6071","unresolved":true,"context_lines":[{"line_number":169,"context_line":"    ),"},{"line_number":170,"context_line":"    policy.DocumentedRuleDefault("},{"line_number":171,"context_line":"        name\u003d\"add_metadef_resource_type_association\","},{"line_number":172,"context_line":"        check_str\u003d\"rule:metadef_admin\","},{"line_number":173,"context_line":"        scope_types\u003d[\u0027system\u0027, \u0027project\u0027],"},{"line_number":174,"context_line":"        description\u003d\"Create meta definition resource types association.\","},{"line_number":175,"context_line":"        operations\u003d["}],"source_content_type":"text/x-python","patch_set":28,"id":"8181301c_121b1546","line":172,"range":{"start_line":172,"start_character":19,"end_line":172,"end_character":37},"in_reply_to":"16bd32ad_81f06c31","updated":"2021-08-19 16:46:37.000000000","message":"Do we want to expose this to project users, though?\n\nAs of the Wallaby release [0] we restricted this to only the gods. Opening this up to project admins in the future will expose this API to anyone with the admin role on a project (even if that is a ways off). I was under the impression we would maintain the godliness of this API by converting:\n\n  rule:metadef_admin -\u003e role:admin and system_scope:all\n\nBut, maybe I\u0027m missing something?\n\nAlso, I don\u0027t think that\u0027s something we can do in this patch, but the scope_types attribute made me think of it.\n\n[0] https://review.opendev.org/c/openstack/glance/+/780104","commit_id":"ec31b7d40cac0655de8ef255bbad9275286caae6"},{"author":{"_account_id":9303,"name":"Abhishek Kekane","email":"akekane@redhat.com","username":"abhishekkekane"},"change_message_id":"51b404269683cbd55d5cbd3ad78af6b15b71f4ef","unresolved":true,"context_lines":[{"line_number":169,"context_line":"    ),"},{"line_number":170,"context_line":"    policy.DocumentedRuleDefault("},{"line_number":171,"context_line":"        name\u003d\"add_metadef_resource_type_association\","},{"line_number":172,"context_line":"        check_str\u003d\"rule:metadef_admin\","},{"line_number":173,"context_line":"        scope_types\u003d[\u0027system\u0027, \u0027project\u0027],"},{"line_number":174,"context_line":"        description\u003d\"Create meta definition resource types association.\","},{"line_number":175,"context_line":"        operations\u003d["}],"source_content_type":"text/x-python","patch_set":28,"id":"16bd32ad_81f06c31","line":172,"range":{"start_line":172,"start_character":19,"end_line":172,"end_character":37},"in_reply_to":"56dca603_dcf05413","updated":"2021-08-19 14:50:25.000000000","message":"As you are aware, ATM glance doesn\u0027t recognize current admin as either project admin or system admin (as we haven\u0027t yet implemented project scope admin in glance yet). But once this is done we want it limited to project specific, means this will change to (role:admin and project_id:project_id)","commit_id":"ec31b7d40cac0655de8ef255bbad9275286caae6"}],"glance/tests/functional/v2/test_metadef_objects.py":[{"author":{"_account_id":9303,"name":"Abhishek Kekane","email":"akekane@redhat.com","username":"abhishekkekane"},"change_message_id":"6b335c90cb0377dd0ba4637cdae83af80efa0764","unresolved":true,"context_lines":[{"line_number":280,"context_line":""},{"line_number":281,"context_line":"        return jsonutils.loads(response.text)"},{"line_number":282,"context_line":""},{"line_number":283,"context_line":"    def _create_object(self, namespaces, tenant):"},{"line_number":284,"context_line":"        objects \u003d []"},{"line_number":285,"context_line":"        for namespace in namespaces:"},{"line_number":286,"context_line":"            headers \u003d self._headers({\u0027X-Tenant-Id\u0027: tenant})"}],"source_content_type":"text/x-python","patch_set":13,"id":"9eeb38e4_b9a279ce","line":283,"range":{"start_line":283,"start_character":41,"end_line":283,"end_character":47},"updated":"2021-07-22 13:55:47.000000000","message":"you namespace already has tenant, so no need to pass it here, you can use that wherever required.","commit_id":"1f62acdda47c94c1984d9c647b5767ea84b7b012"},{"author":{"_account_id":19138,"name":"Pranali Deore","email":"pdeore@redhat.com","username":"PranaliD"},"change_message_id":"8bff5bb61291bb0bfd1a1ef999f86d532add6888","unresolved":false,"context_lines":[{"line_number":280,"context_line":""},{"line_number":281,"context_line":"        return jsonutils.loads(response.text)"},{"line_number":282,"context_line":""},{"line_number":283,"context_line":"    def _create_object(self, namespaces, tenant):"},{"line_number":284,"context_line":"        objects \u003d []"},{"line_number":285,"context_line":"        for namespace in namespaces:"},{"line_number":286,"context_line":"            headers \u003d self._headers({\u0027X-Tenant-Id\u0027: tenant})"}],"source_content_type":"text/x-python","patch_set":13,"id":"2c8c6f6c_44517b5a","line":283,"range":{"start_line":283,"start_character":41,"end_line":283,"end_character":47},"in_reply_to":"9eeb38e4_b9a279ce","updated":"2021-07-23 06:44:22.000000000","message":"Ack","commit_id":"1f62acdda47c94c1984d9c647b5767ea84b7b012"},{"author":{"_account_id":9303,"name":"Abhishek Kekane","email":"akekane@redhat.com","username":"abhishekkekane"},"change_message_id":"6b335c90cb0377dd0ba4637cdae83af80efa0764","unresolved":true,"context_lines":[{"line_number":291,"context_line":"                    \"required\": ["},{"line_number":292,"context_line":"                        \"property1\""},{"line_number":293,"context_line":"                    ],"},{"line_number":294,"context_line":"                    \"properties\": {"},{"line_number":295,"context_line":"                        \"property1\": {"},{"line_number":296,"context_line":"                            \"type\": \"integer\","},{"line_number":297,"context_line":"                            \"title\": \"property1\","},{"line_number":298,"context_line":"                            \"description\": \"property1 description\","},{"line_number":299,"context_line":"                            \"operators\": [\"\u003call-in\u003e\"],"},{"line_number":300,"context_line":"                            \"default\": 100,"},{"line_number":301,"context_line":"                            \"minimum\": 100,"},{"line_number":302,"context_line":"                            \"maximum\": 30000369"},{"line_number":303,"context_line":"                        },"},{"line_number":304,"context_line":"                        \"property2\": {"},{"line_number":305,"context_line":"                            \"type\": \"string\","},{"line_number":306,"context_line":"                            \"title\": \"property2\","},{"line_number":307,"context_line":"                            \"description\": \"property2 description \","},{"line_number":308,"context_line":"                            \"default\": \"value2\","},{"line_number":309,"context_line":"                            \"minLength\": 2,"},{"line_number":310,"context_line":"                            \"maxLength\": 50"},{"line_number":311,"context_line":"                        }"},{"line_number":312,"context_line":"                    }"},{"line_number":313,"context_line":"                })"},{"line_number":314,"context_line":"            path \u003d self._url(\u0027/v2/metadefs/namespaces/%s/objects\u0027 %"},{"line_number":315,"context_line":"                             namespace[\u0027namespace\u0027])"}],"source_content_type":"text/x-python","patch_set":13,"id":"495b146e_22dd194f","line":312,"range":{"start_line":294,"start_character":20,"end_line":312,"end_character":21},"updated":"2021-07-22 13:55:47.000000000","message":"Any specific reason for creating two properties per object?\nIf not then you can keep only one.\n\nAlso avoid setting all values to properties, keep only name, title and description if you are not using other values as well. (This will reduce lots of lines as well as checks in update/get as well.)","commit_id":"1f62acdda47c94c1984d9c647b5767ea84b7b012"},{"author":{"_account_id":19138,"name":"Pranali Deore","email":"pdeore@redhat.com","username":"PranaliD"},"change_message_id":"8bff5bb61291bb0bfd1a1ef999f86d532add6888","unresolved":true,"context_lines":[{"line_number":291,"context_line":"                    \"required\": ["},{"line_number":292,"context_line":"                        \"property1\""},{"line_number":293,"context_line":"                    ],"},{"line_number":294,"context_line":"                    \"properties\": {"},{"line_number":295,"context_line":"                        \"property1\": {"},{"line_number":296,"context_line":"                            \"type\": \"integer\","},{"line_number":297,"context_line":"                            \"title\": \"property1\","},{"line_number":298,"context_line":"                            \"description\": \"property1 description\","},{"line_number":299,"context_line":"                            \"operators\": [\"\u003call-in\u003e\"],"},{"line_number":300,"context_line":"                            \"default\": 100,"},{"line_number":301,"context_line":"                            \"minimum\": 100,"},{"line_number":302,"context_line":"                            \"maximum\": 30000369"},{"line_number":303,"context_line":"                        },"},{"line_number":304,"context_line":"                        \"property2\": {"},{"line_number":305,"context_line":"                            \"type\": \"string\","},{"line_number":306,"context_line":"                            \"title\": \"property2\","},{"line_number":307,"context_line":"                            \"description\": \"property2 description \","},{"line_number":308,"context_line":"                            \"default\": \"value2\","},{"line_number":309,"context_line":"                            \"minLength\": 2,"},{"line_number":310,"context_line":"                            \"maxLength\": 50"},{"line_number":311,"context_line":"                        }"},{"line_number":312,"context_line":"                    }"},{"line_number":313,"context_line":"                })"},{"line_number":314,"context_line":"            path \u003d self._url(\u0027/v2/metadefs/namespaces/%s/objects\u0027 %"},{"line_number":315,"context_line":"                             namespace[\u0027namespace\u0027])"}],"source_content_type":"text/x-python","patch_set":13,"id":"6a80ffe9_39e6d405","line":312,"range":{"start_line":294,"start_character":20,"end_line":312,"end_character":21},"in_reply_to":"495b146e_22dd194f","updated":"2021-07-23 06:44:22.000000000","message":"Not really, will keep only one property then.","commit_id":"1f62acdda47c94c1984d9c647b5767ea84b7b012"},{"author":{"_account_id":9303,"name":"Abhishek Kekane","email":"akekane@redhat.com","username":"abhishekkekane"},"change_message_id":"6b335c90cb0377dd0ba4637cdae83af80efa0764","unresolved":true,"context_lines":[{"line_number":323,"context_line":""},{"line_number":324,"context_line":"        return objects"},{"line_number":325,"context_line":""},{"line_number":326,"context_line":"    def _update_object(self, path, headers, data, namespace):"},{"line_number":327,"context_line":"        # The object should be mutable"},{"line_number":328,"context_line":"        json_data \u003d jsonutils.dumps(data)"},{"line_number":329,"context_line":"        response \u003d requests.put(path, headers\u003dheaders, data\u003djson_data)"}],"source_content_type":"text/x-python","patch_set":13,"id":"467248c0_02c979e2","line":326,"range":{"start_line":326,"start_character":50,"end_line":326,"end_character":59},"updated":"2021-07-22 13:55:47.000000000","message":"No need of this here, you can use path variable at line 354 as it is.","commit_id":"1f62acdda47c94c1984d9c647b5767ea84b7b012"},{"author":{"_account_id":19138,"name":"Pranali Deore","email":"pdeore@redhat.com","username":"PranaliD"},"change_message_id":"8bff5bb61291bb0bfd1a1ef999f86d532add6888","unresolved":false,"context_lines":[{"line_number":323,"context_line":""},{"line_number":324,"context_line":"        return objects"},{"line_number":325,"context_line":""},{"line_number":326,"context_line":"    def _update_object(self, path, headers, data, namespace):"},{"line_number":327,"context_line":"        # The object should be mutable"},{"line_number":328,"context_line":"        json_data \u003d jsonutils.dumps(data)"},{"line_number":329,"context_line":"        response \u003d requests.put(path, headers\u003dheaders, data\u003djson_data)"}],"source_content_type":"text/x-python","patch_set":13,"id":"60eed885_ab180711","line":326,"range":{"start_line":326,"start_character":50,"end_line":326,"end_character":59},"in_reply_to":"467248c0_02c979e2","updated":"2021-07-23 06:44:22.000000000","message":"Ack","commit_id":"1f62acdda47c94c1984d9c647b5767ea84b7b012"},{"author":{"_account_id":9303,"name":"Abhishek Kekane","email":"akekane@redhat.com","username":"abhishekkekane"},"change_message_id":"6b335c90cb0377dd0ba4637cdae83af80efa0764","unresolved":true,"context_lines":[{"line_number":430,"context_line":"                \"required\": ["},{"line_number":431,"context_line":"                    \"property2\""},{"line_number":432,"context_line":"                ],"},{"line_number":433,"context_line":"                \"properties\": {"},{"line_number":434,"context_line":"                    \u0027property1\u0027: {"},{"line_number":435,"context_line":"                        \u0027type\u0027: \u0027integer\u0027,"},{"line_number":436,"context_line":"                        \"title\": \"property1\","},{"line_number":437,"context_line":"                        \u0027description\u0027: \u0027p1 desc-UPDATED\u0027,"},{"line_number":438,"context_line":"                        \u0027default\u0027: 500,"},{"line_number":439,"context_line":"                        \u0027minimum\u0027: 500,"},{"line_number":440,"context_line":"                        \u0027maximum\u0027: 1369"},{"line_number":441,"context_line":"                    },"},{"line_number":442,"context_line":"                    \"property2\": {"},{"line_number":443,"context_line":"                        \"type\": \"string\","},{"line_number":444,"context_line":"                        \"title\": \"property2\","},{"line_number":445,"context_line":"                        \"description\": \"p2 desc-UPDATED\","},{"line_number":446,"context_line":"                        \u0027operators\u0027: [\u0027\u003cor\u003e\u0027],"},{"line_number":447,"context_line":"                        \"default\": \"value2-UPDATED\","},{"line_number":448,"context_line":"                        \"minLength\": 5,"},{"line_number":449,"context_line":"                        \"maxLength\": 150"},{"line_number":450,"context_line":"                    }"},{"line_number":451,"context_line":"                }"},{"line_number":452,"context_line":"            }"},{"line_number":453,"context_line":"            path \u003d self._url(\u0027/v2/metadefs/namespaces/%s/objects/%s\u0027 %"}],"source_content_type":"text/x-python","patch_set":13,"id":"87c9c3f1_35516755","line":450,"range":{"start_line":433,"start_character":16,"end_line":450,"end_character":21},"updated":"2021-07-22 13:55:47.000000000","message":"ditto, only keep 1 property if 2nd is not usable.","commit_id":"1f62acdda47c94c1984d9c647b5767ea84b7b012"},{"author":{"_account_id":19138,"name":"Pranali Deore","email":"pdeore@redhat.com","username":"PranaliD"},"change_message_id":"8bff5bb61291bb0bfd1a1ef999f86d532add6888","unresolved":false,"context_lines":[{"line_number":430,"context_line":"                \"required\": ["},{"line_number":431,"context_line":"                    \"property2\""},{"line_number":432,"context_line":"                ],"},{"line_number":433,"context_line":"                \"properties\": {"},{"line_number":434,"context_line":"                    \u0027property1\u0027: {"},{"line_number":435,"context_line":"                        \u0027type\u0027: \u0027integer\u0027,"},{"line_number":436,"context_line":"                        \"title\": \"property1\","},{"line_number":437,"context_line":"                        \u0027description\u0027: \u0027p1 desc-UPDATED\u0027,"},{"line_number":438,"context_line":"                        \u0027default\u0027: 500,"},{"line_number":439,"context_line":"                        \u0027minimum\u0027: 500,"},{"line_number":440,"context_line":"                        \u0027maximum\u0027: 1369"},{"line_number":441,"context_line":"                    },"},{"line_number":442,"context_line":"                    \"property2\": {"},{"line_number":443,"context_line":"                        \"type\": \"string\","},{"line_number":444,"context_line":"                        \"title\": \"property2\","},{"line_number":445,"context_line":"                        \"description\": \"p2 desc-UPDATED\","},{"line_number":446,"context_line":"                        \u0027operators\u0027: [\u0027\u003cor\u003e\u0027],"},{"line_number":447,"context_line":"                        \"default\": \"value2-UPDATED\","},{"line_number":448,"context_line":"                        \"minLength\": 5,"},{"line_number":449,"context_line":"                        \"maxLength\": 150"},{"line_number":450,"context_line":"                    }"},{"line_number":451,"context_line":"                }"},{"line_number":452,"context_line":"            }"},{"line_number":453,"context_line":"            path \u003d self._url(\u0027/v2/metadefs/namespaces/%s/objects/%s\u0027 %"}],"source_content_type":"text/x-python","patch_set":13,"id":"d5ef1162_e2e83bf1","line":450,"range":{"start_line":433,"start_character":16,"end_line":450,"end_character":21},"in_reply_to":"87c9c3f1_35516755","updated":"2021-07-23 06:44:22.000000000","message":"Ack","commit_id":"1f62acdda47c94c1984d9c647b5767ea84b7b012"},{"author":{"_account_id":9303,"name":"Abhishek Kekane","email":"akekane@redhat.com","username":"abhishekkekane"},"change_message_id":"6b335c90cb0377dd0ba4637cdae83af80efa0764","unresolved":true,"context_lines":[{"line_number":456,"context_line":"            headers \u003d self._headers({"},{"line_number":457,"context_line":"                \u0027X-Tenant-Id\u0027: obj[\u0027namespace\u0027][\u0027owner\u0027]})"},{"line_number":458,"context_line":"            # Should work with admin role"},{"line_number":459,"context_line":"            headers[\u0027X-Roles\u0027] \u003d \"admin\""},{"line_number":460,"context_line":"            self._update_object(path, headers, data,"},{"line_number":461,"context_line":"                                obj[\u0027namespace\u0027][\u0027namespace\u0027])"},{"line_number":462,"context_line":""}],"source_content_type":"text/x-python","patch_set":13,"id":"78be4c36_012a7f03","line":459,"range":{"start_line":459,"start_character":12,"end_line":459,"end_character":40},"updated":"2021-07-22 13:55:47.000000000","message":"at line 456 when you call _header then headers will have \"admin\" role only.\nremove this line and shift above comment before line #456","commit_id":"1f62acdda47c94c1984d9c647b5767ea84b7b012"},{"author":{"_account_id":19138,"name":"Pranali Deore","email":"pdeore@redhat.com","username":"PranaliD"},"change_message_id":"8bff5bb61291bb0bfd1a1ef999f86d532add6888","unresolved":false,"context_lines":[{"line_number":456,"context_line":"            headers \u003d self._headers({"},{"line_number":457,"context_line":"                \u0027X-Tenant-Id\u0027: obj[\u0027namespace\u0027][\u0027owner\u0027]})"},{"line_number":458,"context_line":"            # Should work with admin role"},{"line_number":459,"context_line":"            headers[\u0027X-Roles\u0027] \u003d \"admin\""},{"line_number":460,"context_line":"            self._update_object(path, headers, data,"},{"line_number":461,"context_line":"                                obj[\u0027namespace\u0027][\u0027namespace\u0027])"},{"line_number":462,"context_line":""}],"source_content_type":"text/x-python","patch_set":13,"id":"d1e08c6c_aaddf7c5","line":459,"range":{"start_line":459,"start_character":12,"end_line":459,"end_character":40},"in_reply_to":"78be4c36_012a7f03","updated":"2021-07-23 06:44:22.000000000","message":"Ack","commit_id":"1f62acdda47c94c1984d9c647b5767ea84b7b012"},{"author":{"_account_id":9303,"name":"Abhishek Kekane","email":"akekane@redhat.com","username":"abhishekkekane"},"change_message_id":"6b335c90cb0377dd0ba4637cdae83af80efa0764","unresolved":true,"context_lines":[{"line_number":493,"context_line":"            self.assertEqual(http.NO_CONTENT, response.status_code)"},{"line_number":494,"context_line":""},{"line_number":495,"context_line":"            # Deleted objects should not be exist"},{"line_number":496,"context_line":"            path \u003d self._url(\u0027/v2/metadefs/namespaces/%s/objects/%s\u0027 %"},{"line_number":497,"context_line":"                             (obj[\u0027namespace\u0027][\u0027namespace\u0027],"},{"line_number":498,"context_line":"                              obj[\u0027object\u0027][\u0027name\u0027]))"},{"line_number":499,"context_line":"            response \u003d requests.get(path, headers\u003dself._headers())"},{"line_number":500,"context_line":"            self.assertEqual(http.NOT_FOUND, response.status_code)"}],"source_content_type":"text/x-python","patch_set":13,"id":"c69f275c_ebff0eb1","line":498,"range":{"start_line":496,"start_character":12,"end_line":498,"end_character":53},"updated":"2021-07-22 13:55:47.000000000","message":"you can use path created at line 489","commit_id":"1f62acdda47c94c1984d9c647b5767ea84b7b012"}],"glance/tests/functional/v2/test_metadef_resourcetypes.py":[{"author":{"_account_id":9303,"name":"Abhishek Kekane","email":"akekane@redhat.com","username":"abhishekkekane"},"change_message_id":"95e590680922952930dc953fce2782fffce636e3","unresolved":true,"context_lines":[{"line_number":149,"context_line":"        self.assertEqual("},{"line_number":150,"context_line":"            0, len(metadef_resource_type[\u0027resource_type_associations\u0027]))"},{"line_number":151,"context_line":""},{"line_number":152,"context_line":"    def _create_namespace(self, path, headers, data):"},{"line_number":153,"context_line":"        json_data \u003d jsonutils.dumps(data)"},{"line_number":154,"context_line":"        response \u003d requests.post(path, headers\u003dheaders, data\u003djson_data)"},{"line_number":155,"context_line":"        self.assertEqual(http.CREATED, response.status_code)"},{"line_number":156,"context_line":""},{"line_number":157,"context_line":"        return jsonutils.loads(response.text)"},{"line_number":158,"context_line":""},{"line_number":159,"context_line":"    def _create_resource_type(self, namespaces, tenant):"},{"line_number":160,"context_line":"        resource_types \u003d []"}],"source_content_type":"text/x-python","patch_set":13,"id":"1544864f_2d3290a8","line":157,"range":{"start_line":152,"start_character":0,"end_line":157,"end_character":45},"updated":"2021-07-22 14:27:35.000000000","message":"I think you going to need this method in all namespace test cases, so how about moving _create_namespae from test_metadef_namespaces to tests/functional/v2/ft_utils.py and call it in other files?","commit_id":"1f62acdda47c94c1984d9c647b5767ea84b7b012"},{"author":{"_account_id":19138,"name":"Pranali Deore","email":"pdeore@redhat.com","username":"PranaliD"},"change_message_id":"8bff5bb61291bb0bfd1a1ef999f86d532add6888","unresolved":true,"context_lines":[{"line_number":149,"context_line":"        self.assertEqual("},{"line_number":150,"context_line":"            0, len(metadef_resource_type[\u0027resource_type_associations\u0027]))"},{"line_number":151,"context_line":""},{"line_number":152,"context_line":"    def _create_namespace(self, path, headers, data):"},{"line_number":153,"context_line":"        json_data \u003d jsonutils.dumps(data)"},{"line_number":154,"context_line":"        response \u003d requests.post(path, headers\u003dheaders, data\u003djson_data)"},{"line_number":155,"context_line":"        self.assertEqual(http.CREATED, response.status_code)"},{"line_number":156,"context_line":""},{"line_number":157,"context_line":"        return jsonutils.loads(response.text)"},{"line_number":158,"context_line":""},{"line_number":159,"context_line":"    def _create_resource_type(self, namespaces, tenant):"},{"line_number":160,"context_line":"        resource_types \u003d []"}],"source_content_type":"text/x-python","patch_set":13,"id":"1f1dbda3_dc9d6c59","line":157,"range":{"start_line":152,"start_character":0,"end_line":157,"end_character":45},"in_reply_to":"1544864f_2d3290a8","updated":"2021-07-23 06:44:22.000000000","message":"Yes  we should move this in ft_utils, how about having it in separate follow up patch?","commit_id":"1f62acdda47c94c1984d9c647b5767ea84b7b012"},{"author":{"_account_id":9303,"name":"Abhishek Kekane","email":"akekane@redhat.com","username":"abhishekkekane"},"change_message_id":"95e590680922952930dc953fce2782fffce636e3","unresolved":true,"context_lines":[{"line_number":156,"context_line":""},{"line_number":157,"context_line":"        return jsonutils.loads(response.text)"},{"line_number":158,"context_line":""},{"line_number":159,"context_line":"    def _create_resource_type(self, namespaces, tenant):"},{"line_number":160,"context_line":"        resource_types \u003d []"},{"line_number":161,"context_line":"        for namespace in namespaces:"},{"line_number":162,"context_line":"            headers \u003d self._headers({\u0027X-Tenant-Id\u0027: tenant})"}],"source_content_type":"text/x-python","patch_set":13,"id":"804fc29f_2904dbeb","line":159,"range":{"start_line":159,"start_character":48,"end_line":159,"end_character":54},"updated":"2021-07-22 14:27:35.000000000","message":"You have this in namespaces so can use it from there, no need to pass here explicitly.","commit_id":"1f62acdda47c94c1984d9c647b5767ea84b7b012"},{"author":{"_account_id":19138,"name":"Pranali Deore","email":"pdeore@redhat.com","username":"PranaliD"},"change_message_id":"8bff5bb61291bb0bfd1a1ef999f86d532add6888","unresolved":false,"context_lines":[{"line_number":156,"context_line":""},{"line_number":157,"context_line":"        return jsonutils.loads(response.text)"},{"line_number":158,"context_line":""},{"line_number":159,"context_line":"    def _create_resource_type(self, namespaces, tenant):"},{"line_number":160,"context_line":"        resource_types \u003d []"},{"line_number":161,"context_line":"        for namespace in namespaces:"},{"line_number":162,"context_line":"            headers \u003d self._headers({\u0027X-Tenant-Id\u0027: tenant})"}],"source_content_type":"text/x-python","patch_set":13,"id":"13a58ee7_18766c65","line":159,"range":{"start_line":159,"start_character":48,"end_line":159,"end_character":54},"in_reply_to":"804fc29f_2904dbeb","updated":"2021-07-23 06:44:22.000000000","message":"Ack","commit_id":"1f62acdda47c94c1984d9c647b5767ea84b7b012"},{"author":{"_account_id":9303,"name":"Abhishek Kekane","email":"akekane@redhat.com","username":"abhishekkekane"},"change_message_id":"95e590680922952930dc953fce2782fffce636e3","unresolved":true,"context_lines":[{"line_number":180,"context_line":""},{"line_number":181,"context_line":"    def test_role_base_metadef_resource_types_lifecycle(self):"},{"line_number":182,"context_line":"        # Create public and private namespaces for tenant1 and tenant2"},{"line_number":183,"context_line":"        path \u003d self._url(\u0027/v2/metadefs/namespaces\u0027)"},{"line_number":184,"context_line":"        headers \u003d self._headers({\u0027content-type\u0027: \u0027application/json\u0027})"},{"line_number":185,"context_line":"        tenant1_namespaces \u003d []"},{"line_number":186,"context_line":"        tenant2_namespaces \u003d []"},{"line_number":187,"context_line":"        for tenant in [TENANT1, TENANT2]:"},{"line_number":188,"context_line":"            headers[\u0027X-Tenant-Id\u0027] \u003d tenant"},{"line_number":189,"context_line":"            for visibility in [\u0027public\u0027, \u0027private\u0027]:"},{"line_number":190,"context_line":"                data \u003d {"},{"line_number":191,"context_line":"                    \"namespace\": \"%s_%s_namespace\" % (tenant, visibility),"},{"line_number":192,"context_line":"                    \"display_name\": \"My User Friendly Namespace\","},{"line_number":193,"context_line":"                    \"description\": \"My description\","},{"line_number":194,"context_line":"                    \"visibility\": visibility,"},{"line_number":195,"context_line":"                    \"owner\": tenant"},{"line_number":196,"context_line":"                }"},{"line_number":197,"context_line":"                namespace \u003d self._create_namespace(path, headers, data)"},{"line_number":198,"context_line":"                if tenant \u003d\u003d TENANT1:"},{"line_number":199,"context_line":"                    tenant1_namespaces.append(namespace)"},{"line_number":200,"context_line":"                else:"},{"line_number":201,"context_line":"                    tenant2_namespaces.append(namespace)"},{"line_number":202,"context_line":""},{"line_number":203,"context_line":"        # Create a resource type for each namespace created above"},{"line_number":204,"context_line":"        tenant1_resource_types \u003d self._create_resource_type("}],"source_content_type":"text/x-python","patch_set":13,"id":"5a6517e6_515c9727","line":201,"range":{"start_line":183,"start_character":8,"end_line":201,"end_character":56},"updated":"2021-07-22 14:27:35.000000000","message":"I think you can move this code in ft_utils.py as well (as a part of create_namespace it self).","commit_id":"1f62acdda47c94c1984d9c647b5767ea84b7b012"},{"author":{"_account_id":19138,"name":"Pranali Deore","email":"pdeore@redhat.com","username":"PranaliD"},"change_message_id":"8bff5bb61291bb0bfd1a1ef999f86d532add6888","unresolved":true,"context_lines":[{"line_number":180,"context_line":""},{"line_number":181,"context_line":"    def test_role_base_metadef_resource_types_lifecycle(self):"},{"line_number":182,"context_line":"        # Create public and private namespaces for tenant1 and tenant2"},{"line_number":183,"context_line":"        path \u003d self._url(\u0027/v2/metadefs/namespaces\u0027)"},{"line_number":184,"context_line":"        headers \u003d self._headers({\u0027content-type\u0027: \u0027application/json\u0027})"},{"line_number":185,"context_line":"        tenant1_namespaces \u003d []"},{"line_number":186,"context_line":"        tenant2_namespaces \u003d []"},{"line_number":187,"context_line":"        for tenant in [TENANT1, TENANT2]:"},{"line_number":188,"context_line":"            headers[\u0027X-Tenant-Id\u0027] \u003d tenant"},{"line_number":189,"context_line":"            for visibility in [\u0027public\u0027, \u0027private\u0027]:"},{"line_number":190,"context_line":"                data \u003d {"},{"line_number":191,"context_line":"                    \"namespace\": \"%s_%s_namespace\" % (tenant, visibility),"},{"line_number":192,"context_line":"                    \"display_name\": \"My User Friendly Namespace\","},{"line_number":193,"context_line":"                    \"description\": \"My description\","},{"line_number":194,"context_line":"                    \"visibility\": visibility,"},{"line_number":195,"context_line":"                    \"owner\": tenant"},{"line_number":196,"context_line":"                }"},{"line_number":197,"context_line":"                namespace \u003d self._create_namespace(path, headers, data)"},{"line_number":198,"context_line":"                if tenant \u003d\u003d TENANT1:"},{"line_number":199,"context_line":"                    tenant1_namespaces.append(namespace)"},{"line_number":200,"context_line":"                else:"},{"line_number":201,"context_line":"                    tenant2_namespaces.append(namespace)"},{"line_number":202,"context_line":""},{"line_number":203,"context_line":"        # Create a resource type for each namespace created above"},{"line_number":204,"context_line":"        tenant1_resource_types \u003d self._create_resource_type("}],"source_content_type":"text/x-python","patch_set":13,"id":"8f0b1f6d_a132d6a9","line":201,"range":{"start_line":183,"start_character":8,"end_line":201,"end_character":56},"in_reply_to":"5a6517e6_515c9727","updated":"2021-07-23 06:44:22.000000000","message":"ditto","commit_id":"1f62acdda47c94c1984d9c647b5767ea84b7b012"},{"author":{"_account_id":9303,"name":"Abhishek Kekane","email":"akekane@redhat.com","username":"abhishekkekane"},"change_message_id":"95e590680922952930dc953fce2782fffce636e3","unresolved":true,"context_lines":[{"line_number":256,"context_line":"            response \u003d requests.delete(path, headers\u003dself._headers())"},{"line_number":257,"context_line":"            self.assertEqual(http.NO_CONTENT, response.status_code)"},{"line_number":258,"context_line":""},{"line_number":259,"context_line":"            # Deassociated resource type should not be exist"},{"line_number":260,"context_line":"            path \u003d self._url(\u0027/v2/metadefs/namespaces/%s/resource_types\u0027 %"},{"line_number":261,"context_line":"                             (resource_type[\u0027namespace\u0027][\u0027namespace\u0027]))"},{"line_number":262,"context_line":"            response \u003d requests.get(path, headers\u003dself._headers())"}],"source_content_type":"text/x-python","patch_set":13,"id":"90f775e4_be96d14f","line":259,"range":{"start_line":259,"start_character":12,"end_line":259,"end_character":60},"updated":"2021-07-22 14:27:35.000000000","message":"Sounds confusing, you can add comment saying if the specified resource type is not associated with given namespace then it returns empty list in response instead of raising not found error.\n\nAlso you can use path variable from line 253 at line 262 and remove line 260,261","commit_id":"1f62acdda47c94c1984d9c647b5767ea84b7b012"},{"author":{"_account_id":19138,"name":"Pranali Deore","email":"pdeore@redhat.com","username":"PranaliD"},"change_message_id":"8bff5bb61291bb0bfd1a1ef999f86d532add6888","unresolved":true,"context_lines":[{"line_number":256,"context_line":"            response \u003d requests.delete(path, headers\u003dself._headers())"},{"line_number":257,"context_line":"            self.assertEqual(http.NO_CONTENT, response.status_code)"},{"line_number":258,"context_line":""},{"line_number":259,"context_line":"            # Deassociated resource type should not be exist"},{"line_number":260,"context_line":"            path \u003d self._url(\u0027/v2/metadefs/namespaces/%s/resource_types\u0027 %"},{"line_number":261,"context_line":"                             (resource_type[\u0027namespace\u0027][\u0027namespace\u0027]))"},{"line_number":262,"context_line":"            response \u003d requests.get(path, headers\u003dself._headers())"}],"source_content_type":"text/x-python","patch_set":13,"id":"05360f02_b698fb91","line":259,"range":{"start_line":259,"start_character":12,"end_line":259,"end_character":60},"in_reply_to":"90f775e4_be96d14f","updated":"2021-07-23 06:44:22.000000000","message":"1. Yes, I\u0027ll add the comment.\n2. Both the paths are different, here resource_type is not required.","commit_id":"1f62acdda47c94c1984d9c647b5767ea84b7b012"},{"author":{"_account_id":9303,"name":"Abhishek Kekane","email":"akekane@redhat.com","username":"abhishekkekane"},"change_message_id":"1bab3e6afaff0a1fd1c5af61886c57fcfdcfa29f","unresolved":true,"context_lines":[{"line_number":239,"context_line":""},{"line_number":240,"context_line":"        # List all resource type irrespective of namespace \u0026 tenant are"},{"line_number":241,"context_line":"        # accessible non admin rols"},{"line_number":242,"context_line":"        _check_resource_type_list_access_without_namespace()"},{"line_number":243,"context_line":""},{"line_number":244,"context_line":"        # Deassociate resource type should not be allowed to non admin role"},{"line_number":245,"context_line":"        total_resource_types \u003d tenant1_resource_types + tenant2_resource_types"}],"source_content_type":"text/x-python","patch_set":16,"id":"c15967b3_4c6f15d2","line":242,"range":{"start_line":242,"start_character":8,"end_line":242,"end_character":60},"updated":"2021-07-23 08:56:16.000000000","message":"Important thing here is resource_types are visible across tenants for all users until they are associated with the namespace. So you should check this for both the tenants.\n\nRename this function as\n_check_resource_types(tenant)\nand comment in the function explaining why you are able to see all 4 resource types for each tenants.","commit_id":"e7704882fa2fa671d01a23d2898a602c54eae089"},{"author":{"_account_id":9303,"name":"Abhishek Kekane","email":"akekane@redhat.com","username":"abhishekkekane"},"change_message_id":"365bdf742cd1802964b3e898190aae9d08a17c48","unresolved":true,"context_lines":[{"line_number":167,"context_line":"            }"},{"line_number":168,"context_line":"            path \u003d self._url(\u0027/v2/metadefs/namespaces/%s/resource_types\u0027 %"},{"line_number":169,"context_line":"                             (namespace[\u0027namespace\u0027]))"},{"line_number":170,"context_line":"            json_data \u003d jsonutils.dumps(data)"},{"line_number":171,"context_line":"            response \u003d requests.post(path, headers\u003dheaders, data\u003djson_data)"},{"line_number":172,"context_line":"            self.assertEqual(http.CREATED, response.status_code)"},{"line_number":173,"context_line":"            resource_type \u003d jsonutils.loads(response.text)"}],"source_content_type":"text/x-python","patch_set":20,"id":"2ea28780_8fb9b0ad","line":170,"range":{"start_line":170,"start_character":12,"end_line":170,"end_character":45},"updated":"2021-07-27 08:13:50.000000000","message":"nit: json_data is not required here you can restore it in data as you are not using data variable anywhere in this method.","commit_id":"12207a9752781f4d8984e50b9f54d72d44801184"},{"author":{"_account_id":19138,"name":"Pranali Deore","email":"pdeore@redhat.com","username":"PranaliD"},"change_message_id":"679234a5c28660e0b637d68592397fcbe8064ccc","unresolved":false,"context_lines":[{"line_number":167,"context_line":"            }"},{"line_number":168,"context_line":"            path \u003d self._url(\u0027/v2/metadefs/namespaces/%s/resource_types\u0027 %"},{"line_number":169,"context_line":"                             (namespace[\u0027namespace\u0027]))"},{"line_number":170,"context_line":"            json_data \u003d jsonutils.dumps(data)"},{"line_number":171,"context_line":"            response \u003d requests.post(path, headers\u003dheaders, data\u003djson_data)"},{"line_number":172,"context_line":"            self.assertEqual(http.CREATED, response.status_code)"},{"line_number":173,"context_line":"            resource_type \u003d jsonutils.loads(response.text)"}],"source_content_type":"text/x-python","patch_set":20,"id":"a6ed1b2a_ec6eba34","line":170,"range":{"start_line":170,"start_character":12,"end_line":170,"end_character":45},"in_reply_to":"2ea28780_8fb9b0ad","updated":"2021-07-29 12:21:14.000000000","message":"Ack","commit_id":"12207a9752781f4d8984e50b9f54d72d44801184"},{"author":{"_account_id":9303,"name":"Abhishek Kekane","email":"akekane@redhat.com","username":"abhishekkekane"},"change_message_id":"365bdf742cd1802964b3e898190aae9d08a17c48","unresolved":true,"context_lines":[{"line_number":172,"context_line":"            self.assertEqual(http.CREATED, response.status_code)"},{"line_number":173,"context_line":"            resource_type \u003d jsonutils.loads(response.text)"},{"line_number":174,"context_line":"            resource_type_with_namespace \u003d {}"},{"line_number":175,"context_line":"            resource_type_with_namespace[\u0027namespace\u0027] \u003d namespace"},{"line_number":176,"context_line":"            resource_type_with_namespace[\u0027resource_type\u0027] \u003d resource_type"},{"line_number":177,"context_line":"            resource_types.append(resource_type_with_namespace)"},{"line_number":178,"context_line":""},{"line_number":179,"context_line":"        return resource_types"}],"source_content_type":"text/x-python","patch_set":20,"id":"d298383b_5baf3fa3","line":176,"range":{"start_line":175,"start_character":12,"end_line":176,"end_character":73},"updated":"2021-07-27 08:13:50.000000000","message":"you could have done it like\nresource_type_with_namespace[namespace.namespace] \u003d resource_type\n\nand then in below for loops (line 252 and 264) iterate over key and value both.","commit_id":"12207a9752781f4d8984e50b9f54d72d44801184"},{"author":{"_account_id":9303,"name":"Abhishek Kekane","email":"akekane@redhat.com","username":"abhishekkekane"},"change_message_id":"f3018a069be55cbd30c64e92c4871a8c6fd16679","unresolved":true,"context_lines":[{"line_number":172,"context_line":"            self.assertEqual(http.CREATED, response.status_code)"},{"line_number":173,"context_line":"            resource_type \u003d jsonutils.loads(response.text)"},{"line_number":174,"context_line":"            resource_type_with_namespace \u003d {}"},{"line_number":175,"context_line":"            resource_type_with_namespace[\u0027namespace\u0027] \u003d namespace"},{"line_number":176,"context_line":"            resource_type_with_namespace[\u0027resource_type\u0027] \u003d resource_type"},{"line_number":177,"context_line":"            resource_types.append(resource_type_with_namespace)"},{"line_number":178,"context_line":""},{"line_number":179,"context_line":"        return resource_types"}],"source_content_type":"text/x-python","patch_set":20,"id":"dd3b4e0c_8dc9f8ee","line":176,"range":{"start_line":175,"start_character":12,"end_line":176,"end_character":73},"in_reply_to":"39bf183e_7acc1d9c","updated":"2021-07-29 15:57:07.000000000","message":"You do have tenant in namespace name.\nYou just need to use extra logic to retrieve that.\n\nYour namespace name is combination of tenant_visibility_namespace.\nYou can do it in one line like tenant \u003d key.split(\u0027_\u0027)[0]","commit_id":"12207a9752781f4d8984e50b9f54d72d44801184"},{"author":{"_account_id":19138,"name":"Pranali Deore","email":"pdeore@redhat.com","username":"PranaliD"},"change_message_id":"679234a5c28660e0b637d68592397fcbe8064ccc","unresolved":true,"context_lines":[{"line_number":172,"context_line":"            self.assertEqual(http.CREATED, response.status_code)"},{"line_number":173,"context_line":"            resource_type \u003d jsonutils.loads(response.text)"},{"line_number":174,"context_line":"            resource_type_with_namespace \u003d {}"},{"line_number":175,"context_line":"            resource_type_with_namespace[\u0027namespace\u0027] \u003d namespace"},{"line_number":176,"context_line":"            resource_type_with_namespace[\u0027resource_type\u0027] \u003d resource_type"},{"line_number":177,"context_line":"            resource_types.append(resource_type_with_namespace)"},{"line_number":178,"context_line":""},{"line_number":179,"context_line":"        return resource_types"}],"source_content_type":"text/x-python","patch_set":20,"id":"39bf183e_7acc1d9c","line":176,"range":{"start_line":175,"start_character":12,"end_line":176,"end_character":73},"in_reply_to":"d298383b_5baf3fa3","updated":"2021-07-29 12:21:14.000000000","message":"Well, I\u0027m using \u0027owner\u0027 of the namespace at line #258, so I have to keep all the metadata of namespace here instead of just having the name as key. But I can keep just resource type name instead of all the data.","commit_id":"12207a9752781f4d8984e50b9f54d72d44801184"},{"author":{"_account_id":4393,"name":"Dan Smith","email":"dms@danplanet.com","username":"danms"},"change_message_id":"6700d0671834726494672e1d40ed57bedbbf787e","unresolved":true,"context_lines":[{"line_number":150,"context_line":""},{"line_number":151,"context_line":"    def _create_namespace(self, path, headers, data):"},{"line_number":152,"context_line":"        json_data \u003d jsonutils.dumps(data)"},{"line_number":153,"context_line":"        response \u003d requests.post(path, headers\u003dheaders, data\u003djson_data)"},{"line_number":154,"context_line":"        self.assertEqual(http.CREATED, response.status_code)"},{"line_number":155,"context_line":""},{"line_number":156,"context_line":"        return jsonutils.loads(response.text)"}],"source_content_type":"text/x-python","patch_set":22,"id":"f3a1358b_e65d7aaf","line":153,"range":{"start_line":153,"start_character":56,"end_line":153,"end_character":61},"updated":"2021-07-30 14:06:21.000000000","message":"json\u003d and then you can avoid serializing the data yourself. That will also handle the content-type header.","commit_id":"716b4d058e4a2fc790ec762e6eca6ae085318c5e"},{"author":{"_account_id":19138,"name":"Pranali Deore","email":"pdeore@redhat.com","username":"PranaliD"},"change_message_id":"61d1a16aace35c2c120c723dc1fd3eff5c599c7e","unresolved":false,"context_lines":[{"line_number":150,"context_line":""},{"line_number":151,"context_line":"    def _create_namespace(self, path, headers, data):"},{"line_number":152,"context_line":"        json_data \u003d jsonutils.dumps(data)"},{"line_number":153,"context_line":"        response \u003d requests.post(path, headers\u003dheaders, data\u003djson_data)"},{"line_number":154,"context_line":"        self.assertEqual(http.CREATED, response.status_code)"},{"line_number":155,"context_line":""},{"line_number":156,"context_line":"        return jsonutils.loads(response.text)"}],"source_content_type":"text/x-python","patch_set":22,"id":"30a0f3f4_82b85408","line":153,"range":{"start_line":153,"start_character":56,"end_line":153,"end_character":61},"in_reply_to":"f3a1358b_e65d7aaf","updated":"2021-07-30 18:23:47.000000000","message":"Done","commit_id":"716b4d058e4a2fc790ec762e6eca6ae085318c5e"},{"author":{"_account_id":4393,"name":"Dan Smith","email":"dms@danplanet.com","username":"danms"},"change_message_id":"6700d0671834726494672e1d40ed57bedbbf787e","unresolved":true,"context_lines":[{"line_number":208,"context_line":"            for namespace in namespaces:"},{"line_number":209,"context_line":"                path \u003d self._url(\u0027/v2/metadefs/namespaces/%s/resource_types\u0027 %"},{"line_number":210,"context_line":"                                 (namespace[\u0027namespace\u0027]))"},{"line_number":211,"context_line":"                headers \u003d self._headers({\u0027content-type\u0027: \u0027application/json\u0027,"},{"line_number":212,"context_line":"                                         \u0027X-Tenant-Id\u0027: tenant,"},{"line_number":213,"context_line":"                                         \u0027X-Roles\u0027: \u0027reader,member\u0027})"},{"line_number":214,"context_line":"                response \u003d requests.get(path, headers\u003dheaders)"}],"source_content_type":"text/x-python","patch_set":22,"id":"b2fd0ec1_6269590d","line":211,"range":{"start_line":211,"start_character":41,"end_line":211,"end_character":76},"updated":"2021-07-30 14:06:21.000000000","message":"AFAIK, content-type doesn\u0027t make sense for a GET request. Accepts: maybe, but clearly you don\u0027t need that here.","commit_id":"716b4d058e4a2fc790ec762e6eca6ae085318c5e"},{"author":{"_account_id":19138,"name":"Pranali Deore","email":"pdeore@redhat.com","username":"PranaliD"},"change_message_id":"61d1a16aace35c2c120c723dc1fd3eff5c599c7e","unresolved":false,"context_lines":[{"line_number":208,"context_line":"            for namespace in namespaces:"},{"line_number":209,"context_line":"                path \u003d self._url(\u0027/v2/metadefs/namespaces/%s/resource_types\u0027 %"},{"line_number":210,"context_line":"                                 (namespace[\u0027namespace\u0027]))"},{"line_number":211,"context_line":"                headers \u003d self._headers({\u0027content-type\u0027: \u0027application/json\u0027,"},{"line_number":212,"context_line":"                                         \u0027X-Tenant-Id\u0027: tenant,"},{"line_number":213,"context_line":"                                         \u0027X-Roles\u0027: \u0027reader,member\u0027})"},{"line_number":214,"context_line":"                response \u003d requests.get(path, headers\u003dheaders)"}],"source_content_type":"text/x-python","patch_set":22,"id":"1381406c_4472c558","line":211,"range":{"start_line":211,"start_character":41,"end_line":211,"end_character":76},"in_reply_to":"b2fd0ec1_6269590d","updated":"2021-07-30 18:23:47.000000000","message":"Done","commit_id":"716b4d058e4a2fc790ec762e6eca6ae085318c5e"},{"author":{"_account_id":4393,"name":"Dan Smith","email":"dms@danplanet.com","username":"danms"},"change_message_id":"6700d0671834726494672e1d40ed57bedbbf787e","unresolved":true,"context_lines":[{"line_number":225,"context_line":"                                     \u0027X-Roles\u0027: \u0027reader,member\u0027})"},{"line_number":226,"context_line":"            response \u003d requests.get(path, headers\u003dheaders)"},{"line_number":227,"context_line":"            self.assertEqual(http.OK, response.status_code)"},{"line_number":228,"context_line":"            metadef_resource_type \u003d jsonutils.loads(response.text)"},{"line_number":229,"context_line":""},{"line_number":230,"context_line":"            # The resource types list count should be same as the total"},{"line_number":231,"context_line":"            # resource types created across the tenants."}],"source_content_type":"text/x-python","patch_set":22,"id":"617a49b0_a58ed195","line":228,"range":{"start_line":228,"start_character":36,"end_line":228,"end_character":66},"updated":"2021-07-30 14:06:21.000000000","message":"response.json","commit_id":"716b4d058e4a2fc790ec762e6eca6ae085318c5e"},{"author":{"_account_id":19138,"name":"Pranali Deore","email":"pdeore@redhat.com","username":"PranaliD"},"change_message_id":"61d1a16aace35c2c120c723dc1fd3eff5c599c7e","unresolved":false,"context_lines":[{"line_number":225,"context_line":"                                     \u0027X-Roles\u0027: \u0027reader,member\u0027})"},{"line_number":226,"context_line":"            response \u003d requests.get(path, headers\u003dheaders)"},{"line_number":227,"context_line":"            self.assertEqual(http.OK, response.status_code)"},{"line_number":228,"context_line":"            metadef_resource_type \u003d jsonutils.loads(response.text)"},{"line_number":229,"context_line":""},{"line_number":230,"context_line":"            # The resource types list count should be same as the total"},{"line_number":231,"context_line":"            # resource types created across the tenants."}],"source_content_type":"text/x-python","patch_set":22,"id":"20a16390_0cfd4166","line":228,"range":{"start_line":228,"start_character":36,"end_line":228,"end_character":66},"in_reply_to":"617a49b0_a58ed195","updated":"2021-07-30 18:23:47.000000000","message":"Done","commit_id":"716b4d058e4a2fc790ec762e6eca6ae085318c5e"},{"author":{"_account_id":4393,"name":"Dan Smith","email":"dms@danplanet.com","username":"danms"},"change_message_id":"6700d0671834726494672e1d40ed57bedbbf787e","unresolved":true,"context_lines":[{"line_number":268,"context_line":"                response \u003d requests.delete(path, headers\u003dself._headers())"},{"line_number":269,"context_line":"                self.assertEqual(http.NO_CONTENT, response.status_code)"},{"line_number":270,"context_line":""},{"line_number":271,"context_line":"                # Deassociated resource type should not be exisit"},{"line_number":272,"context_line":"                # When the specified resource type is not associated with given"},{"line_number":273,"context_line":"                # namespace then it returns empty list in response instead of"},{"line_number":274,"context_line":"                # raising not found error"}],"source_content_type":"text/x-python","patch_set":22,"id":"58ce932c_10b9b07b","line":271,"range":{"start_line":271,"start_character":56,"end_line":271,"end_character":65},"updated":"2021-07-30 14:06:21.000000000","message":"exist","commit_id":"716b4d058e4a2fc790ec762e6eca6ae085318c5e"},{"author":{"_account_id":19138,"name":"Pranali Deore","email":"pdeore@redhat.com","username":"PranaliD"},"change_message_id":"61d1a16aace35c2c120c723dc1fd3eff5c599c7e","unresolved":false,"context_lines":[{"line_number":268,"context_line":"                response \u003d requests.delete(path, headers\u003dself._headers())"},{"line_number":269,"context_line":"                self.assertEqual(http.NO_CONTENT, response.status_code)"},{"line_number":270,"context_line":""},{"line_number":271,"context_line":"                # Deassociated resource type should not be exisit"},{"line_number":272,"context_line":"                # When the specified resource type is not associated with given"},{"line_number":273,"context_line":"                # namespace then it returns empty list in response instead of"},{"line_number":274,"context_line":"                # raising not found error"}],"source_content_type":"text/x-python","patch_set":22,"id":"d68f1764_abc3b754","line":271,"range":{"start_line":271,"start_character":56,"end_line":271,"end_character":65},"in_reply_to":"58ce932c_10b9b07b","updated":"2021-07-30 18:23:47.000000000","message":"Done","commit_id":"716b4d058e4a2fc790ec762e6eca6ae085318c5e"},{"author":{"_account_id":5046,"name":"Lance Bragstad","email":"lbragstad@redhat.com","username":"ldbragst"},"change_message_id":"eb4fe3254c4cb6ae91cb941c4a97bd7cc288386b","unresolved":true,"context_lines":[{"line_number":148,"context_line":"        self.assertEqual("},{"line_number":149,"context_line":"            0, len(metadef_resource_type[\u0027resource_type_associations\u0027]))"},{"line_number":150,"context_line":""},{"line_number":151,"context_line":"    def _create_namespace(self, path, headers, data):"},{"line_number":152,"context_line":"        response \u003d requests.post(path, headers\u003dheaders, json\u003ddata)"},{"line_number":153,"context_line":"        self.assertEqual(http.CREATED, response.status_code)"},{"line_number":154,"context_line":""}],"source_content_type":"text/x-python","patch_set":32,"id":"58a5e7eb_7c262da3","line":151,"updated":"2021-08-31 14:40:42.000000000","message":"We could look at making this re-usable in the future, since it\u0027s duplicated with the tests from the previous patches.","commit_id":"503c9d9e8e9413255ac2b1a7daefdf88dda1c680"},{"author":{"_account_id":19138,"name":"Pranali Deore","email":"pdeore@redhat.com","username":"PranaliD"},"change_message_id":"47ac9c3749499135ebfb32c20c7ef700799b6e49","unresolved":true,"context_lines":[{"line_number":148,"context_line":"        self.assertEqual("},{"line_number":149,"context_line":"            0, len(metadef_resource_type[\u0027resource_type_associations\u0027]))"},{"line_number":150,"context_line":""},{"line_number":151,"context_line":"    def _create_namespace(self, path, headers, data):"},{"line_number":152,"context_line":"        response \u003d requests.post(path, headers\u003dheaders, json\u003ddata)"},{"line_number":153,"context_line":"        self.assertEqual(http.CREATED, response.status_code)"},{"line_number":154,"context_line":""}],"source_content_type":"text/x-python","patch_set":32,"id":"9d1811f4_e08b9759","line":151,"in_reply_to":"58a5e7eb_7c262da3","updated":"2021-08-31 20:25:10.000000000","message":"Me and Abhishek had this discussion earlier to have this change in followup patch.\n\nThanks for the change [1]\n\n[1]: https://review.opendev.org/c/openstack/glance/+/806775","commit_id":"503c9d9e8e9413255ac2b1a7daefdf88dda1c680"},{"author":{"_account_id":5046,"name":"Lance Bragstad","email":"lbragstad@redhat.com","username":"ldbragst"},"change_message_id":"eb4fe3254c4cb6ae91cb941c4a97bd7cc288386b","unresolved":true,"context_lines":[{"line_number":241,"context_line":"        _check_resource_types(TENANT1)"},{"line_number":242,"context_line":"        _check_resource_types(TENANT2)"},{"line_number":243,"context_line":""},{"line_number":244,"context_line":"        # Deassociate resource type should not be allowed to non admin role"},{"line_number":245,"context_line":"        total_resource_types \u003d tenant1_resource_types + tenant2_resource_types"},{"line_number":246,"context_line":"        for resource_type in total_resource_types:"},{"line_number":247,"context_line":"            for namespace, rs_type in resource_type.items():"}],"source_content_type":"text/x-python","patch_set":32,"id":"b544b204_be1ea200","line":244,"range":{"start_line":244,"start_character":10,"end_line":244,"end_character":21},"updated":"2021-08-31 14:40:42.000000000","message":"nit: disassociate","commit_id":"503c9d9e8e9413255ac2b1a7daefdf88dda1c680"},{"author":{"_account_id":19138,"name":"Pranali Deore","email":"pdeore@redhat.com","username":"PranaliD"},"change_message_id":"47ac9c3749499135ebfb32c20c7ef700799b6e49","unresolved":false,"context_lines":[{"line_number":241,"context_line":"        _check_resource_types(TENANT1)"},{"line_number":242,"context_line":"        _check_resource_types(TENANT2)"},{"line_number":243,"context_line":""},{"line_number":244,"context_line":"        # Deassociate resource type should not be allowed to non admin role"},{"line_number":245,"context_line":"        total_resource_types \u003d tenant1_resource_types + tenant2_resource_types"},{"line_number":246,"context_line":"        for resource_type in total_resource_types:"},{"line_number":247,"context_line":"            for namespace, rs_type in resource_type.items():"}],"source_content_type":"text/x-python","patch_set":32,"id":"9f13c0d6_7e21eea3","line":244,"range":{"start_line":244,"start_character":10,"end_line":244,"end_character":21},"in_reply_to":"b544b204_be1ea200","updated":"2021-08-31 20:25:10.000000000","message":"Done","commit_id":"503c9d9e8e9413255ac2b1a7daefdf88dda1c680"},{"author":{"_account_id":9303,"name":"Abhishek Kekane","email":"akekane@redhat.com","username":"abhishekkekane"},"change_message_id":"7da89eef9060f5a99a9fa42e8fe9f28005de9bdf","unresolved":true,"context_lines":[{"line_number":265,"context_line":"                path \u003d \\"},{"line_number":266,"context_line":"                    self._url(\u0027/v2/metadefs/namespaces/%s/resource_types/%s\u0027 %"},{"line_number":267,"context_line":"                              (namespace, rs_type))"},{"line_number":268,"context_line":"                response \u003d requests.delete(path, headers\u003dself._headers())"},{"line_number":269,"context_line":"                self.assertEqual(http.NO_CONTENT, response.status_code)"},{"line_number":270,"context_line":""},{"line_number":271,"context_line":"                # Disassociated resource type should not be exist"}],"source_content_type":"text/x-python","patch_set":35,"id":"4dee4ca1_8a02714b","line":268,"range":{"start_line":268,"start_character":57,"end_line":268,"end_character":72},"updated":"2021-09-02 09:36:25.000000000","message":"Use headers defined at line 262","commit_id":"d2fc573e311af1a166e3591f0ba5837fca973256"},{"author":{"_account_id":19138,"name":"Pranali Deore","email":"pdeore@redhat.com","username":"PranaliD"},"change_message_id":"cefbaeeca6568e6f2cd7476709b73043f5e7bacf","unresolved":false,"context_lines":[{"line_number":265,"context_line":"                path \u003d \\"},{"line_number":266,"context_line":"                    self._url(\u0027/v2/metadefs/namespaces/%s/resource_types/%s\u0027 %"},{"line_number":267,"context_line":"                              (namespace, rs_type))"},{"line_number":268,"context_line":"                response \u003d requests.delete(path, headers\u003dself._headers())"},{"line_number":269,"context_line":"                self.assertEqual(http.NO_CONTENT, response.status_code)"},{"line_number":270,"context_line":""},{"line_number":271,"context_line":"                # Disassociated resource type should not be exist"}],"source_content_type":"text/x-python","patch_set":35,"id":"335e7339_1ef0d466","line":268,"range":{"start_line":268,"start_character":57,"end_line":268,"end_character":72},"in_reply_to":"4dee4ca1_8a02714b","updated":"2021-09-02 12:17:38.000000000","message":"Done","commit_id":"d2fc573e311af1a166e3591f0ba5837fca973256"},{"author":{"_account_id":5046,"name":"Lance Bragstad","email":"lbragstad@redhat.com","username":"ldbragst"},"change_message_id":"1b64746356954a72d720beed74d3c6ffa7567f14","unresolved":true,"context_lines":[{"line_number":240,"context_line":"        _check_resource_type_access(tenant1_namespaces, TENANT2)"},{"line_number":241,"context_line":""},{"line_number":242,"context_line":"        # List all resource type irrespective of namespace \u0026 tenant are"},{"line_number":243,"context_line":"        # accessible non admin roles"},{"line_number":244,"context_line":"        total_resource_types \u003d tenant1_resource_types + tenant2_resource_types"},{"line_number":245,"context_line":"        _check_resource_types(TENANT1, total_resource_types)"},{"line_number":246,"context_line":"        _check_resource_types(TENANT2, total_resource_types)"}],"source_content_type":"text/x-python","patch_set":36,"id":"549e06ee_282dec1c","line":243,"updated":"2021-09-02 20:25:05.000000000","message":"This relationship still kinda blows my mind...","commit_id":"3a96d5ab326f5ca1fa90e77034a5f6ab0867cf7a"}]}
