)]}'
{"openstack_auth/policy.py":[{"author":{"_account_id":841,"name":"Akihiro Motoki","email":"amotoki@gmail.com","username":"amotoki"},"change_message_id":"134de5cf4e0e67170926ad154ccfb6dc5b88b5ae","unresolved":false,"context_lines":[{"line_number":189,"context_line":"        if action not in enforcer_scope.rules:"},{"line_number":190,"context_line":"            if not enforcer_scope.enforce(\u0027default\u0027, target, credentials):"},{"line_number":191,"context_line":"                if \u0027default\u0027 in enforcer_scope.rules:"},{"line_number":192,"context_line":"                    is_valid \u003d False"},{"line_number":193,"context_line":"        else:"},{"line_number":194,"context_line":"            is_valid \u003d False"},{"line_number":195,"context_line":"    return is_valid"}],"source_content_type":"text/x-python","patch_set":4,"id":"9f91af0f_49695ebc","line":192,"updated":"2018-01-01 01:40:39.000000000","message":"If \u0027default\u0027 does not exist, there is no need to call enforce().\nHow about the following?\n\n  if action not in enforcer_scope.rules:\n    if \u0027default\u0027 in enforce_scope.rules:\n      is_valid \u003d enforcer_scope.enforce(\u0027default\u0027, target, credentials)\n\nWe can simplify the logic more.\nActually, we check if a specified action is found at L.189 after calling enforce() at L.183. I think we can swap the order of these.\nDoes the following make sense?\n\n  if action in enforcer_scope.rules:\n    is_valid \u003d enforcer_scope.enforce(action, target, credentials)\n  elif \u0027default\u0027 in enforcer_scope.rules:\n    is_valid \u003d enforcer_scope.enforce(action, target, credentials)\n  else:\n    is_valid \u003d True\n\nThis is based on the fact that enforce() returns False if a specified action is not found.","commit_id":"25ee08db49573f190290416246ee781f00379f31"},{"author":{"_account_id":841,"name":"Akihiro Motoki","email":"amotoki@gmail.com","username":"amotoki"},"change_message_id":"6a574cc98d66d797ca0ed7757f25278a10c6e2d6","unresolved":false,"context_lines":[{"line_number":189,"context_line":"        if action not in enforcer_scope.rules:"},{"line_number":190,"context_line":"            if not enforcer_scope.enforce(\u0027default\u0027, target, credentials):"},{"line_number":191,"context_line":"                if \u0027default\u0027 in enforcer_scope.rules:"},{"line_number":192,"context_line":"                    is_valid \u003d False"},{"line_number":193,"context_line":"        else:"},{"line_number":194,"context_line":"            is_valid \u003d False"},{"line_number":195,"context_line":"    return is_valid"}],"source_content_type":"text/x-python","patch_set":4,"id":"7f96bb07_f33848d4","line":192,"in_reply_to":"9f91af0f_2d8c6fd5","updated":"2018-01-12 04:39:04.000000000","message":"\u003e This doesn\u0027t work, you can see that I tried it with one of the\n \u003e previous patches. The reason for the convoluted inversed logic is\n \u003e that the rules are loaded lazily.\n\nThanks for clarification. Totally makes sense and I understand it now.","commit_id":"25ee08db49573f190290416246ee781f00379f31"},{"author":{"_account_id":8648,"name":"Radomir Dopieralski","email":"openstack@dopieralski.pl","username":"thesheep"},"change_message_id":"ec7234f6448703acd7d539c0abef42bd90fa7180","unresolved":false,"context_lines":[{"line_number":189,"context_line":"        if action not in enforcer_scope.rules:"},{"line_number":190,"context_line":"            if not enforcer_scope.enforce(\u0027default\u0027, target, credentials):"},{"line_number":191,"context_line":"                if \u0027default\u0027 in enforcer_scope.rules:"},{"line_number":192,"context_line":"                    is_valid \u003d False"},{"line_number":193,"context_line":"        else:"},{"line_number":194,"context_line":"            is_valid \u003d False"},{"line_number":195,"context_line":"    return is_valid"}],"source_content_type":"text/x-python","patch_set":4,"id":"9f91af0f_0d588b53","line":192,"in_reply_to":"9f91af0f_2d8c6fd5","updated":"2018-01-10 14:50:28.000000000","message":"The comment on line 187 refers to that.","commit_id":"25ee08db49573f190290416246ee781f00379f31"},{"author":{"_account_id":8648,"name":"Radomir Dopieralski","email":"openstack@dopieralski.pl","username":"thesheep"},"change_message_id":"cd061ad8f1fa0431c64ec70d327df23a7bb334fc","unresolved":false,"context_lines":[{"line_number":189,"context_line":"        if action not in enforcer_scope.rules:"},{"line_number":190,"context_line":"            if not enforcer_scope.enforce(\u0027default\u0027, target, credentials):"},{"line_number":191,"context_line":"                if \u0027default\u0027 in enforcer_scope.rules:"},{"line_number":192,"context_line":"                    is_valid \u003d False"},{"line_number":193,"context_line":"        else:"},{"line_number":194,"context_line":"            is_valid \u003d False"},{"line_number":195,"context_line":"    return is_valid"}],"source_content_type":"text/x-python","patch_set":4,"id":"9f91af0f_2d8c6fd5","line":192,"in_reply_to":"9f91af0f_49695ebc","updated":"2018-01-10 14:45:39.000000000","message":"This doesn\u0027t work, you can see that I tried it with one of the previous patches. The reason for the convoluted inversed logic is that the rules are loaded lazily.","commit_id":"25ee08db49573f190290416246ee781f00379f31"}]}
