)]}'
{"README.rst":[{"author":{"_account_id":23186,"name":"Felipe Monteiro","email":"felipe.carneiro.monteiro@gmail.com","username":"felipe.monteiro"},"change_message_id":"cea8e7852da4c891a6b607fcf85ee2c67a3e86e2","unresolved":false,"context_lines":[{"line_number":199,"context_line":"  is an arbitrary role, but by convention is used to designate the default"},{"line_number":200,"context_line":"  non-admin role in the system. Most Patrole tests should be run with"},{"line_number":201,"context_line":"  **admin** and **member** roles. However, other services may use entirely"},{"line_number":202,"context_line":"  different role or combination of roles."},{"line_number":203,"context_line":""},{"line_number":204,"context_line":"For more information about the member role and its nomenclature,"},{"line_number":205,"context_line":"please see: `\u003chttps://ask.openstack.org/en/question/4759/member-vs-_member_/\u003e`__."}],"source_content_type":"text/x-rst","patch_set":38,"id":"3f79a3b5_a1e5a7dd","line":202,"range":{"start_line":202,"start_character":12,"end_line":202,"end_character":41},"updated":"2018-10-18 05:56:35.000000000","message":"roles or role combinations.","commit_id":"9d48c9d1a5c3af49c5fe91c0cf69dba7279c2f2b"},{"author":{"_account_id":16274,"name":"Mykola Yakovliev","email":"VegasQ@gmail.com","username":"vegasq"},"change_message_id":"4d0f4c40578c01d7136041e5b42898a8b4ef6bc9","unresolved":false,"context_lines":[{"line_number":199,"context_line":"  is an arbitrary role, but by convention is used to designate the default"},{"line_number":200,"context_line":"  non-admin role in the system. Most Patrole tests should be run with"},{"line_number":201,"context_line":"  **admin** and **member** roles. However, other services may use entirely"},{"line_number":202,"context_line":"  different role or combination of roles."},{"line_number":203,"context_line":""},{"line_number":204,"context_line":"For more information about the member role and its nomenclature,"},{"line_number":205,"context_line":"please see: `\u003chttps://ask.openstack.org/en/question/4759/member-vs-_member_/\u003e`__."}],"source_content_type":"text/x-rst","patch_set":38,"id":"3f79a3b5_b5071318","line":202,"range":{"start_line":202,"start_character":12,"end_line":202,"end_character":41},"in_reply_to":"3f79a3b5_a1e5a7dd","updated":"2018-10-18 15:49:52.000000000","message":"Done","commit_id":"9d48c9d1a5c3af49c5fe91c0cf69dba7279c2f2b"}],"devstack/plugin.sh":[{"author":{"_account_id":23186,"name":"Felipe Monteiro","email":"felipe.carneiro.monteiro@gmail.com","username":"felipe.monteiro"},"change_message_id":"d742d8e19b0372eff040f3e06294ed2086af8e53","unresolved":false,"context_lines":[{"line_number":41,"context_line":"    fi"},{"line_number":42,"context_line":""},{"line_number":43,"context_line":"    iniset $TEMPEST_CONFIG patrole rbac_test_role $RBAC_TEST_ROLE"},{"line_number":44,"context_line":"    iniset $TEMPEST_CONFIG patrole rbac_test_roles $RBAC_TEST_ROLE"},{"line_number":45,"context_line":"}"},{"line_number":46,"context_line":""},{"line_number":47,"context_line":"if is_service_enabled tempest; then"}],"source_content_type":"text/x-sh","patch_set":6,"id":"3f79a3b5_f99d2109","line":44,"range":{"start_line":44,"start_character":51,"end_line":44,"end_character":66},"updated":"2018-09-29 04:30:16.000000000","message":"This is not a list value, though maybe I\u0027m mistaken and iniset does some conversion magic?","commit_id":"5d74be287a608a631320c00c79853a572badd927"},{"author":{"_account_id":16274,"name":"Mykola Yakovliev","email":"VegasQ@gmail.com","username":"vegasq"},"change_message_id":"c09b529e6a1a24833e73c1cd445ec99e2d53e497","unresolved":false,"context_lines":[{"line_number":41,"context_line":"    fi"},{"line_number":42,"context_line":""},{"line_number":43,"context_line":"    iniset $TEMPEST_CONFIG patrole rbac_test_role $RBAC_TEST_ROLE"},{"line_number":44,"context_line":"    iniset $TEMPEST_CONFIG patrole rbac_test_roles $RBAC_TEST_ROLE"},{"line_number":45,"context_line":"}"},{"line_number":46,"context_line":""},{"line_number":47,"context_line":"if is_service_enabled tempest; then"}],"source_content_type":"text/x-sh","patch_set":6,"id":"3f79a3b5_51cada9f","line":44,"range":{"start_line":44,"start_character":51,"end_line":44,"end_character":66},"in_reply_to":"3f79a3b5_f99d2109","updated":"2018-09-30 17:36:21.000000000","message":"Done","commit_id":"5d74be287a608a631320c00c79853a572badd927"}],"doc/source/configuration.rst":[{"author":{"_account_id":23186,"name":"Felipe Monteiro","email":"felipe.carneiro.monteiro@gmail.com","username":"felipe.monteiro"},"change_message_id":"cea8e7852da4c891a6b607fcf85ee2c67a3e86e2","unresolved":false,"context_lines":[{"line_number":10,"context_line":"RBAC Test Roles"},{"line_number":11,"context_line":"---------------"},{"line_number":12,"context_line":""},{"line_number":13,"context_line":"The RBAC test roles governs list of roles to be used when running Patrole tests."},{"line_number":14,"context_line":"For example, setting ``rbac_test_roles`` to \"admin\" will execute all RBAC tests"},{"line_number":15,"context_line":"using admin credentials. Changing the ``rbac_test_roles`` value will `override`"},{"line_number":16,"context_line":"Tempest\u0027s primary credentials to use that role."}],"source_content_type":"text/x-rst","patch_set":38,"id":"3f79a3b5_41f373a1","line":13,"range":{"start_line":13,"start_character":20,"end_line":13,"end_character":27},"updated":"2018-10-18 05:56:35.000000000","message":"govern the","commit_id":"9d48c9d1a5c3af49c5fe91c0cf69dba7279c2f2b"},{"author":{"_account_id":16274,"name":"Mykola Yakovliev","email":"VegasQ@gmail.com","username":"vegasq"},"change_message_id":"4d0f4c40578c01d7136041e5b42898a8b4ef6bc9","unresolved":false,"context_lines":[{"line_number":10,"context_line":"RBAC Test Roles"},{"line_number":11,"context_line":"---------------"},{"line_number":12,"context_line":""},{"line_number":13,"context_line":"The RBAC test roles governs list of roles to be used when running Patrole tests."},{"line_number":14,"context_line":"For example, setting ``rbac_test_roles`` to \"admin\" will execute all RBAC tests"},{"line_number":15,"context_line":"using admin credentials. Changing the ``rbac_test_roles`` value will `override`"},{"line_number":16,"context_line":"Tempest\u0027s primary credentials to use that role."}],"source_content_type":"text/x-rst","patch_set":38,"id":"3f79a3b5_15a607ae","line":13,"range":{"start_line":13,"start_character":20,"end_line":13,"end_character":27},"in_reply_to":"3f79a3b5_41f373a1","updated":"2018-10-18 15:49:52.000000000","message":"Done","commit_id":"9d48c9d1a5c3af49c5fe91c0cf69dba7279c2f2b"},{"author":{"_account_id":23186,"name":"Felipe Monteiro","email":"felipe.carneiro.monteiro@gmail.com","username":"felipe.monteiro"},"change_message_id":"cea8e7852da4c891a6b607fcf85ee2c67a3e86e2","unresolved":false,"context_lines":[{"line_number":20,"context_line":"role. That is, ``self.os_primary.servers_client`` will run as though it were"},{"line_number":21,"context_line":"``self.os_admin.servers_client``."},{"line_number":22,"context_line":""},{"line_number":23,"context_line":"Similarly, setting ``rbac_test_roles`` to a non-admin roles, results in"},{"line_number":24,"context_line":"Tempest\u0027s primary credentials being overridden by the roles specified by"},{"line_number":25,"context_line":"``rbac_test_roles``."},{"line_number":26,"context_line":""}],"source_content_type":"text/x-rst","patch_set":38,"id":"3f79a3b5_812e6bf7","line":23,"range":{"start_line":23,"start_character":39,"end_line":23,"end_character":59},"updated":"2018-10-18 05:56:35.000000000","message":"with various roles","commit_id":"9d48c9d1a5c3af49c5fe91c0cf69dba7279c2f2b"},{"author":{"_account_id":16274,"name":"Mykola Yakovliev","email":"VegasQ@gmail.com","username":"vegasq"},"change_message_id":"4d0f4c40578c01d7136041e5b42898a8b4ef6bc9","unresolved":false,"context_lines":[{"line_number":20,"context_line":"role. That is, ``self.os_primary.servers_client`` will run as though it were"},{"line_number":21,"context_line":"``self.os_admin.servers_client``."},{"line_number":22,"context_line":""},{"line_number":23,"context_line":"Similarly, setting ``rbac_test_roles`` to a non-admin roles, results in"},{"line_number":24,"context_line":"Tempest\u0027s primary credentials being overridden by the roles specified by"},{"line_number":25,"context_line":"``rbac_test_roles``."},{"line_number":26,"context_line":""}],"source_content_type":"text/x-rst","patch_set":38,"id":"3f79a3b5_55355fdb","line":23,"range":{"start_line":23,"start_character":39,"end_line":23,"end_character":59},"in_reply_to":"3f79a3b5_812e6bf7","updated":"2018-10-18 15:49:52.000000000","message":"Done","commit_id":"9d48c9d1a5c3af49c5fe91c0cf69dba7279c2f2b"},{"author":{"_account_id":23186,"name":"Felipe Monteiro","email":"felipe.carneiro.monteiro@gmail.com","username":"felipe.monteiro"},"change_message_id":"cea8e7852da4c891a6b607fcf85ee2c67a3e86e2","unresolved":false,"context_lines":[{"line_number":26,"context_line":""},{"line_number":27,"context_line":".. note::"},{"line_number":28,"context_line":""},{"line_number":29,"context_line":"    Only the roles of the primary Tempest credentials (\"os_primary\") is"},{"line_number":30,"context_line":"    modified. The ``user_id`` and ``project_id`` remain unchanged."},{"line_number":31,"context_line":""},{"line_number":32,"context_line":"Custom Policy Files"}],"source_content_type":"text/x-rst","patch_set":38,"id":"3f79a3b5_61354f43","line":29,"range":{"start_line":29,"start_character":69,"end_line":29,"end_character":71},"updated":"2018-10-18 05:56:35.000000000","message":"are","commit_id":"9d48c9d1a5c3af49c5fe91c0cf69dba7279c2f2b"},{"author":{"_account_id":16274,"name":"Mykola Yakovliev","email":"VegasQ@gmail.com","username":"vegasq"},"change_message_id":"4d0f4c40578c01d7136041e5b42898a8b4ef6bc9","unresolved":false,"context_lines":[{"line_number":26,"context_line":""},{"line_number":27,"context_line":".. note::"},{"line_number":28,"context_line":""},{"line_number":29,"context_line":"    Only the roles of the primary Tempest credentials (\"os_primary\") is"},{"line_number":30,"context_line":"    modified. The ``user_id`` and ``project_id`` remain unchanged."},{"line_number":31,"context_line":""},{"line_number":32,"context_line":"Custom Policy Files"}],"source_content_type":"text/x-rst","patch_set":38,"id":"3f79a3b5_75997b69","line":29,"range":{"start_line":29,"start_character":69,"end_line":29,"end_character":71},"in_reply_to":"3f79a3b5_61354f43","updated":"2018-10-18 15:49:52.000000000","message":"Done","commit_id":"9d48c9d1a5c3af49c5fe91c0cf69dba7279c2f2b"}],"patrole_tempest_plugin/config.py":[{"author":{"_account_id":23186,"name":"Felipe Monteiro","email":"felipe.carneiro.monteiro@gmail.com","username":"felipe.monteiro"},"change_message_id":"d742d8e19b0372eff040f3e06294ed2086af8e53","unresolved":false,"context_lines":[{"line_number":20,"context_line":""},{"line_number":21,"context_line":""},{"line_number":22,"context_line":"PatroleGroup \u003d ["},{"line_number":23,"context_line":"    cfg.StrOpt(\u0027rbac_test_role\u0027,"},{"line_number":24,"context_line":"               default\u003d\u0027admin\u0027,"},{"line_number":25,"context_line":"               help\u003d\"\"\"The current RBAC role against which to run"},{"line_number":26,"context_line":"Patrole tests.\"\"\"),"}],"source_content_type":"text/x-python","patch_set":6,"id":"3f79a3b5_39987919","line":23,"range":{"start_line":23,"start_character":16,"end_line":23,"end_character":30},"updated":"2018-09-29 04:30:16.000000000","message":"This change is backwards incompatible currently as it\u0027s not using rbac_test_role at all. It will have to issue a deprecation warning if this value is present.","commit_id":"5d74be287a608a631320c00c79853a572badd927"},{"author":{"_account_id":16274,"name":"Mykola Yakovliev","email":"VegasQ@gmail.com","username":"vegasq"},"change_message_id":"c09b529e6a1a24833e73c1cd445ec99e2d53e497","unresolved":false,"context_lines":[{"line_number":20,"context_line":""},{"line_number":21,"context_line":""},{"line_number":22,"context_line":"PatroleGroup \u003d ["},{"line_number":23,"context_line":"    cfg.StrOpt(\u0027rbac_test_role\u0027,"},{"line_number":24,"context_line":"               default\u003d\u0027admin\u0027,"},{"line_number":25,"context_line":"               help\u003d\"\"\"The current RBAC role against which to run"},{"line_number":26,"context_line":"Patrole tests.\"\"\"),"}],"source_content_type":"text/x-python","patch_set":6,"id":"3f79a3b5_31ecfe26","line":23,"range":{"start_line":23,"start_character":16,"end_line":23,"end_character":30},"in_reply_to":"3f79a3b5_39987919","updated":"2018-09-30 17:36:21.000000000","message":"Done","commit_id":"5d74be287a608a631320c00c79853a572badd927"},{"author":{"_account_id":24817,"name":"Avishek Dutta","email":"ad620p@att.com","username":"ad620p"},"change_message_id":"11897c075f96599fcee9deef7bcda5d1e9cb7385","unresolved":false,"context_lines":[{"line_number":22,"context_line":"PatroleGroup \u003d ["},{"line_number":23,"context_line":"    cfg.StrOpt(\u0027rbac_test_role\u0027,"},{"line_number":24,"context_line":"               default\u003d\u0027admin\u0027,"},{"line_number":25,"context_line":"               deprecated_for_removal\u003dTrue,"},{"line_number":26,"context_line":"               deprecated_reason\u003d\"\"\"This option is deprecated and being"},{"line_number":27,"context_line":"replaced with ``rbac_test_roles``."},{"line_number":28,"context_line":"\"\"\","}],"source_content_type":"text/x-python","patch_set":13,"id":"3f79a3b5_a492f9fa","line":25,"updated":"2018-10-02 00:55:26.000000000","message":"I suggest not to depricate this. Group execution should not be default one, instead single role should be default one.","commit_id":"e5fc0e52548584dc877febb047401212856442bc"},{"author":{"_account_id":24817,"name":"Avishek Dutta","email":"ad620p@att.com","username":"ad620p"},"change_message_id":"11897c075f96599fcee9deef7bcda5d1e9cb7385","unresolved":false,"context_lines":[{"line_number":28,"context_line":"\"\"\","},{"line_number":29,"context_line":"               help\u003d\"\"\"The current RBAC role against which to run"},{"line_number":30,"context_line":"Patrole tests.\"\"\"),"},{"line_number":31,"context_line":"    cfg.ListOpt(\u0027rbac_test_roles\u0027,"},{"line_number":32,"context_line":"                help\u003d\"\"\"The current RBAC roles to be assigned to Keystone"},{"line_number":33,"context_line":"Group against which to run Patrole tests.\"\"\","},{"line_number":34,"context_line":"                default\u003d[]),"}],"source_content_type":"text/x-python","patch_set":13,"id":"3f79a3b5_0425edbe","line":31,"updated":"2018-10-02 00:55:26.000000000","message":"if we are going to depricate the above key and going to use rbac_test_roles only, there is no way to know that I want to run Patrole either without any group or with a group with single role (viewer) even using v2 Identity API.","commit_id":"e5fc0e52548584dc877febb047401212856442bc"},{"author":{"_account_id":23186,"name":"Felipe Monteiro","email":"felipe.carneiro.monteiro@gmail.com","username":"felipe.monteiro"},"change_message_id":"cea8e7852da4c891a6b607fcf85ee2c67a3e86e2","unresolved":false,"context_lines":[{"line_number":21,"context_line":""},{"line_number":22,"context_line":"PatroleGroup \u003d ["},{"line_number":23,"context_line":"    cfg.StrOpt(\u0027rbac_test_role\u0027,"},{"line_number":24,"context_line":"               default\u003d\u0027\u0027,"},{"line_number":25,"context_line":"               deprecated_for_removal\u003dTrue,"},{"line_number":26,"context_line":"               deprecated_reason\u003d\"\"\"This option is deprecated and being"},{"line_number":27,"context_line":"replaced with ``rbac_test_roles``."}],"source_content_type":"text/x-python","patch_set":38,"id":"3f79a3b5_412133fd","line":24,"range":{"start_line":24,"start_character":23,"end_line":24,"end_character":25},"updated":"2018-10-18 05:56:35.000000000","message":"Why change the default value here?","commit_id":"9d48c9d1a5c3af49c5fe91c0cf69dba7279c2f2b"},{"author":{"_account_id":16274,"name":"Mykola Yakovliev","email":"VegasQ@gmail.com","username":"vegasq"},"change_message_id":"4d0f4c40578c01d7136041e5b42898a8b4ef6bc9","unresolved":false,"context_lines":[{"line_number":21,"context_line":""},{"line_number":22,"context_line":"PatroleGroup \u003d ["},{"line_number":23,"context_line":"    cfg.StrOpt(\u0027rbac_test_role\u0027,"},{"line_number":24,"context_line":"               default\u003d\u0027\u0027,"},{"line_number":25,"context_line":"               deprecated_for_removal\u003dTrue,"},{"line_number":26,"context_line":"               deprecated_reason\u003d\"\"\"This option is deprecated and being"},{"line_number":27,"context_line":"replaced with ``rbac_test_roles``."}],"source_content_type":"text/x-python","patch_set":38,"id":"3f79a3b5_9577778f","line":24,"range":{"start_line":24,"start_character":23,"end_line":24,"end_character":25},"in_reply_to":"3f79a3b5_412133fd","updated":"2018-10-18 15:49:52.000000000","message":"Let\u0027s take ``member`` test:\n\n``rbac_test_role`` is not set by zuul, so the default value is ``admin``.\n``rbac_test_roles`` is set by zuul as ``member``.\n\nThe code will read both values so ``roles \u003d [\u0027admin\u0027, \u0027member\u0027]``and I think it\u0027s not what we want.\n\nAlternative is to take first value from ``rbac_test_roles`` and set it as a value for ``rbac_test_role`` in devstak/plugin.sh.","commit_id":"9d48c9d1a5c3af49c5fe91c0cf69dba7279c2f2b"},{"author":{"_account_id":23186,"name":"Felipe Monteiro","email":"felipe.carneiro.monteiro@gmail.com","username":"felipe.monteiro"},"change_message_id":"cea8e7852da4c891a6b607fcf85ee2c67a3e86e2","unresolved":false,"context_lines":[{"line_number":30,"context_line":"Patrole tests.\"\"\"),"},{"line_number":31,"context_line":"    cfg.ListOpt(\u0027rbac_test_roles\u0027,"},{"line_number":32,"context_line":"                help\u003d\"\"\"The current RBAC roles to be assigned to Keystone"},{"line_number":33,"context_line":"Group against which to run Patrole tests.\"\"\","},{"line_number":34,"context_line":"                default\u003d[\u0027admin\u0027]),"},{"line_number":35,"context_line":"    cfg.ListOpt(\u0027custom_policy_files\u0027,"},{"line_number":36,"context_line":"                default\u003d[\u0027/etc/%s/policy.json\u0027],"}],"source_content_type":"text/x-python","patch_set":38,"id":"3f79a3b5_a10cc793","line":33,"range":{"start_line":33,"start_character":0,"end_line":33,"end_character":5},"updated":"2018-10-18 05:56:35.000000000","message":"No longer true.","commit_id":"9d48c9d1a5c3af49c5fe91c0cf69dba7279c2f2b"},{"author":{"_account_id":16274,"name":"Mykola Yakovliev","email":"VegasQ@gmail.com","username":"vegasq"},"change_message_id":"4d0f4c40578c01d7136041e5b42898a8b4ef6bc9","unresolved":false,"context_lines":[{"line_number":30,"context_line":"Patrole tests.\"\"\"),"},{"line_number":31,"context_line":"    cfg.ListOpt(\u0027rbac_test_roles\u0027,"},{"line_number":32,"context_line":"                help\u003d\"\"\"The current RBAC roles to be assigned to Keystone"},{"line_number":33,"context_line":"Group against which to run Patrole tests.\"\"\","},{"line_number":34,"context_line":"                default\u003d[\u0027admin\u0027]),"},{"line_number":35,"context_line":"    cfg.ListOpt(\u0027custom_policy_files\u0027,"},{"line_number":36,"context_line":"                default\u003d[\u0027/etc/%s/policy.json\u0027],"}],"source_content_type":"text/x-python","patch_set":38,"id":"3f79a3b5_55447f1a","line":33,"range":{"start_line":33,"start_character":0,"end_line":33,"end_character":5},"in_reply_to":"3f79a3b5_a10cc793","updated":"2018-10-18 15:49:52.000000000","message":"Done","commit_id":"9d48c9d1a5c3af49c5fe91c0cf69dba7279c2f2b"}],"patrole_tempest_plugin/policy_authority.py":[{"author":{"_account_id":23186,"name":"Felipe Monteiro","email":"felipe.carneiro.monteiro@gmail.com","username":"felipe.monteiro"},"change_message_id":"d742d8e19b0372eff040f3e06294ed2086af8e53","unresolved":false,"context_lines":[{"line_number":163,"context_line":"        :raises RbacParsingException: If ``rule_name`` does not exist in the"},{"line_number":164,"context_line":"            cloud (in policy file or among registered in-code policy defaults)."},{"line_number":165,"context_line":"        \"\"\""},{"line_number":166,"context_line":"        if type(roles) !\u003d list:"},{"line_number":167,"context_line":"            roles \u003d [roles]"},{"line_number":168,"context_line":"        for role in roles:"},{"line_number":169,"context_line":"            is_admin_context \u003d self._is_admin_context(role)"}],"source_content_type":"text/x-python","patch_set":6,"id":"3f79a3b5_59de95db","line":166,"range":{"start_line":166,"start_character":11,"end_line":166,"end_character":30},"updated":"2018-09-29 04:30:16.000000000","message":"isinstance(roles, list)","commit_id":"5d74be287a608a631320c00c79853a572badd927"},{"author":{"_account_id":16274,"name":"Mykola Yakovliev","email":"VegasQ@gmail.com","username":"vegasq"},"change_message_id":"c09b529e6a1a24833e73c1cd445ec99e2d53e497","unresolved":false,"context_lines":[{"line_number":163,"context_line":"        :raises RbacParsingException: If ``rule_name`` does not exist in the"},{"line_number":164,"context_line":"            cloud (in policy file or among registered in-code policy defaults)."},{"line_number":165,"context_line":"        \"\"\""},{"line_number":166,"context_line":"        if type(roles) !\u003d list:"},{"line_number":167,"context_line":"            roles \u003d [roles]"},{"line_number":168,"context_line":"        for role in roles:"},{"line_number":169,"context_line":"            is_admin_context \u003d self._is_admin_context(role)"}],"source_content_type":"text/x-python","patch_set":6,"id":"3f79a3b5_51a3baff","line":166,"range":{"start_line":166,"start_character":11,"end_line":166,"end_character":30},"in_reply_to":"3f79a3b5_59de95db","updated":"2018-09-30 17:36:21.000000000","message":"Done","commit_id":"5d74be287a608a631320c00c79853a572badd927"},{"author":{"_account_id":23186,"name":"Felipe Monteiro","email":"felipe.carneiro.monteiro@gmail.com","username":"felipe.monteiro"},"change_message_id":"d742d8e19b0372eff040f3e06294ed2086af8e53","unresolved":false,"context_lines":[{"line_number":173,"context_line":"                is_admin\u003dis_admin_context)"},{"line_number":174,"context_line":"            if is_allowed:"},{"line_number":175,"context_line":"                return is_allowed"},{"line_number":176,"context_line":"        return is_allowed"},{"line_number":177,"context_line":""},{"line_number":178,"context_line":"    def _get_policy_data(self):"},{"line_number":179,"context_line":"        file_policy_data \u003d {}"}],"source_content_type":"text/x-python","patch_set":6,"id":"3f79a3b5_79f4b155","line":176,"range":{"start_line":176,"start_character":15,"end_line":176,"end_character":25},"updated":"2018-09-29 04:30:16.000000000","message":"This should be return False to handle the case where there are no roles.","commit_id":"5d74be287a608a631320c00c79853a572badd927"},{"author":{"_account_id":16274,"name":"Mykola Yakovliev","email":"VegasQ@gmail.com","username":"vegasq"},"change_message_id":"c09b529e6a1a24833e73c1cd445ec99e2d53e497","unresolved":false,"context_lines":[{"line_number":173,"context_line":"                is_admin\u003dis_admin_context)"},{"line_number":174,"context_line":"            if is_allowed:"},{"line_number":175,"context_line":"                return is_allowed"},{"line_number":176,"context_line":"        return is_allowed"},{"line_number":177,"context_line":""},{"line_number":178,"context_line":"    def _get_policy_data(self):"},{"line_number":179,"context_line":"        file_policy_data \u003d {}"}],"source_content_type":"text/x-python","patch_set":6,"id":"3f79a3b5_919dd2bc","line":176,"range":{"start_line":176,"start_character":15,"end_line":176,"end_character":25},"in_reply_to":"3f79a3b5_79f4b155","updated":"2018-09-30 17:36:21.000000000","message":"Done","commit_id":"5d74be287a608a631320c00c79853a572badd927"},{"author":{"_account_id":23186,"name":"Felipe Monteiro","email":"felipe.carneiro.monteiro@gmail.com","username":"felipe.monteiro"},"change_message_id":"960f64ef6faa9f7c90bd7e4745c2d85d422bbc8a","unresolved":false,"context_lines":[{"line_number":165,"context_line":"        \"\"\""},{"line_number":166,"context_line":"        if type(roles) !\u003d list:"},{"line_number":167,"context_line":"            roles \u003d [roles]"},{"line_number":168,"context_line":"        for role in roles:"},{"line_number":169,"context_line":"            is_admin_context \u003d self._is_admin_context(role)"},{"line_number":170,"context_line":"            is_allowed \u003d self._allowed("},{"line_number":171,"context_line":"                access\u003dself._get_access_token(role),"},{"line_number":172,"context_line":"                apply_rule\u003drule_name,"},{"line_number":173,"context_line":"                is_admin\u003dis_admin_context)"},{"line_number":174,"context_line":"            if is_allowed:"},{"line_number":175,"context_line":"                return is_allowed"},{"line_number":176,"context_line":"        return is_allowed"},{"line_number":177,"context_line":""},{"line_number":178,"context_line":"    def _get_policy_data(self):"}],"source_content_type":"text/x-python","patch_set":7,"id":"3f79a3b5_1ddc8243","line":175,"range":{"start_line":168,"start_character":0,"end_line":175,"end_character":33},"updated":"2018-09-29 15:21:19.000000000","message":"This is also not correct.\n\nThe logic should be reverted to what is on the LHS.\n\nWhat will have to be changed is this: https://github.com/openstack/patrole/blob/40c450d0882ab55cd667bb24e6751898b5ab2aab/patrole_tempest_plugin/policy_authority.py#L243\n\nShould be:\n\n    def _get_access_token(self, roles):\n        access_token \u003d {\n            \"token\": {\n                \"roles\": [\n                    {\n                        \"name\": role\n                    } for role in roles\n                ],\n                \"project_id\": self.project_id,\n                \"tenant_id\": self.project_id,\n                \"user_id\": self.user_id\n            }\n        }\n        return access_token\n\nThat is because oslo.policy should be doing all the authorization calculation on our behalf. What you\u0027ve included above will not work for all cases.","commit_id":"87ee7d903dabadd280e036b57f6262ec9757d32b"}],"patrole_tempest_plugin/rbac_rule_validation.py":[{"author":{"_account_id":23186,"name":"Felipe Monteiro","email":"felipe.carneiro.monteiro@gmail.com","username":"felipe.monteiro"},"change_message_id":"cea8e7852da4c891a6b607fcf85ee2c67a3e86e2","unresolved":false,"context_lines":[{"line_number":145,"context_line":"        roles \u003d CONF.patrole.rbac_test_roles"},{"line_number":146,"context_line":"        # TODO(vegasq) drop once CONF.patrole.rbac_test_role is removed"},{"line_number":147,"context_line":"        if CONF.patrole.rbac_test_role:"},{"line_number":148,"context_line":"            roles.append(CONF.patrole.rbac_test_role)"},{"line_number":149,"context_line":"            roles \u003d list(set(roles))"},{"line_number":150,"context_line":""},{"line_number":151,"context_line":"        @functools.wraps(test_func)"}],"source_content_type":"text/x-python","patch_set":38,"id":"3f79a3b5_01701b09","line":148,"updated":"2018-10-18 05:56:35.000000000","message":"Since you are taking set of roles on L149 the default value of \u0027admin\u0027 for this and the default value of [\u0027admin\u0027] for the pluralized option should still result in [\u0027admin\u0027] which is good.","commit_id":"9d48c9d1a5c3af49c5fe91c0cf69dba7279c2f2b"},{"author":{"_account_id":16274,"name":"Mykola Yakovliev","email":"VegasQ@gmail.com","username":"vegasq"},"change_message_id":"4d0f4c40578c01d7136041e5b42898a8b4ef6bc9","unresolved":false,"context_lines":[{"line_number":145,"context_line":"        roles \u003d CONF.patrole.rbac_test_roles"},{"line_number":146,"context_line":"        # TODO(vegasq) drop once CONF.patrole.rbac_test_role is removed"},{"line_number":147,"context_line":"        if CONF.patrole.rbac_test_role:"},{"line_number":148,"context_line":"            roles.append(CONF.patrole.rbac_test_role)"},{"line_number":149,"context_line":"            roles \u003d list(set(roles))"},{"line_number":150,"context_line":""},{"line_number":151,"context_line":"        @functools.wraps(test_func)"}],"source_content_type":"text/x-python","patch_set":38,"id":"3f79a3b5_75741b38","line":148,"in_reply_to":"3f79a3b5_01701b09","updated":"2018-10-18 15:49:52.000000000","message":"See config.py discussion. ``rbac_test_role`` default set to \"\", so if something is specified here, it\u0027s nice to see what exactly and probably fail later in tests.\n\nAlternative proposed in config.py as well.","commit_id":"9d48c9d1a5c3af49c5fe91c0cf69dba7279c2f2b"},{"author":{"_account_id":16274,"name":"Mykola Yakovliev","email":"VegasQ@gmail.com","username":"vegasq"},"change_message_id":"59b1e21c4b110d99866ade87a6ef48d1f0e9e053","unresolved":false,"context_lines":[{"line_number":145,"context_line":"        roles \u003d CONF.patrole.rbac_test_roles"},{"line_number":146,"context_line":"        # TODO(vegasq) drop once CONF.patrole.rbac_test_role is removed"},{"line_number":147,"context_line":"        if CONF.patrole.rbac_test_role:"},{"line_number":148,"context_line":"            roles.append(CONF.patrole.rbac_test_role)"},{"line_number":149,"context_line":"            roles \u003d list(set(roles))"},{"line_number":150,"context_line":""},{"line_number":151,"context_line":"        @functools.wraps(test_func)"}],"source_content_type":"text/x-python","patch_set":38,"id":"3f79a3b5_5115019a","line":148,"in_reply_to":"3f79a3b5_701da50e","updated":"2018-10-24 16:55:12.000000000","message":"Done","commit_id":"9d48c9d1a5c3af49c5fe91c0cf69dba7279c2f2b"},{"author":{"_account_id":23186,"name":"Felipe Monteiro","email":"felipe.carneiro.monteiro@gmail.com","username":"felipe.monteiro"},"change_message_id":"553973cb3d4762d4804eacf4a7ac89f7c4f3f30d","unresolved":false,"context_lines":[{"line_number":145,"context_line":"        roles \u003d CONF.patrole.rbac_test_roles"},{"line_number":146,"context_line":"        # TODO(vegasq) drop once CONF.patrole.rbac_test_role is removed"},{"line_number":147,"context_line":"        if CONF.patrole.rbac_test_role:"},{"line_number":148,"context_line":"            roles.append(CONF.patrole.rbac_test_role)"},{"line_number":149,"context_line":"            roles \u003d list(set(roles))"},{"line_number":150,"context_line":""},{"line_number":151,"context_line":"        @functools.wraps(test_func)"}],"source_content_type":"text/x-python","patch_set":38,"id":"3f79a3b5_701da50e","line":148,"in_reply_to":"3f79a3b5_75741b38","updated":"2018-10-24 05:44:02.000000000","message":"I think the correct behavior then is to keep the default of \u0027admin\u0027 for backwards compatibility and to make `rbac_test_roles` and `rbac_test_role` mutually exclusive, that is:\n\n        roles \u003d CONF.patrole.rbac_test_roles\n        # TODO(vegasq) drop once CONF.patrole.rbac_test_role is removed\n        if CONF.patrole.rbac_test_role:\n            version_utils.report_deprecated_feature(...)\n            if not roles:\n                roles.append(CONF.patrole.rbac_test_role)\n                roles \u003d list(set(roles))\n\nThis should work because you would have to explicitly set CONF.patrole.rbac_test_roles \u003d [] to make use of CONF.patrole.rbac_test_role and this way they are mutually exclusive.\n\nNote that code sample above also includes https://docs.openstack.org/oslo.log/3.29.0/reference/versionutils.html#oslo_log.versionutils.report_deprecated_feature which should be called just once (here is fine, don\u0027t need to do it in other places) to let user know to switch to new config option.","commit_id":"9d48c9d1a5c3af49c5fe91c0cf69dba7279c2f2b"},{"author":{"_account_id":23186,"name":"Felipe Monteiro","email":"felipe.carneiro.monteiro@gmail.com","username":"felipe.monteiro"},"change_message_id":"553973cb3d4762d4804eacf4a7ac89f7c4f3f30d","unresolved":false,"context_lines":[{"line_number":332,"context_line":"        LOG.error(msg)"},{"line_number":333,"context_line":"        raise rbac_exceptions.RbacResourceSetupFailed(msg)"},{"line_number":334,"context_line":""},{"line_number":335,"context_line":"    roles \u003d CONF.patrole.rbac_test_roles"},{"line_number":336,"context_line":"    # TODO(vegasq) drop once CONF.patrole.rbac_test_role is removed"},{"line_number":337,"context_line":"    if CONF.patrole.rbac_test_role:"},{"line_number":338,"context_line":"        roles.append(CONF.patrole.rbac_test_role)"},{"line_number":339,"context_line":"        roles \u003d list(set(roles))"},{"line_number":340,"context_line":""},{"line_number":341,"context_line":"    # Test RBAC against custom requirements. Otherwise use oslo.policy."},{"line_number":342,"context_line":"    if CONF.patrole.test_custom_requirements:"}],"source_content_type":"text/x-python","patch_set":38,"id":"3f79a3b5_f0b775f7","line":339,"range":{"start_line":335,"start_character":0,"end_line":339,"end_character":32},"updated":"2018-10-24 05:44:02.000000000","message":"Ditto","commit_id":"9d48c9d1a5c3af49c5fe91c0cf69dba7279c2f2b"},{"author":{"_account_id":16274,"name":"Mykola Yakovliev","email":"VegasQ@gmail.com","username":"vegasq"},"change_message_id":"59b1e21c4b110d99866ade87a6ef48d1f0e9e053","unresolved":false,"context_lines":[{"line_number":332,"context_line":"        LOG.error(msg)"},{"line_number":333,"context_line":"        raise rbac_exceptions.RbacResourceSetupFailed(msg)"},{"line_number":334,"context_line":""},{"line_number":335,"context_line":"    roles \u003d CONF.patrole.rbac_test_roles"},{"line_number":336,"context_line":"    # TODO(vegasq) drop once CONF.patrole.rbac_test_role is removed"},{"line_number":337,"context_line":"    if CONF.patrole.rbac_test_role:"},{"line_number":338,"context_line":"        roles.append(CONF.patrole.rbac_test_role)"},{"line_number":339,"context_line":"        roles \u003d list(set(roles))"},{"line_number":340,"context_line":""},{"line_number":341,"context_line":"    # Test RBAC against custom requirements. Otherwise use oslo.policy."},{"line_number":342,"context_line":"    if CONF.patrole.test_custom_requirements:"}],"source_content_type":"text/x-python","patch_set":38,"id":"3f79a3b5_913dd92a","line":339,"range":{"start_line":335,"start_character":0,"end_line":339,"end_character":32},"in_reply_to":"3f79a3b5_f0b775f7","updated":"2018-10-24 16:55:12.000000000","message":"Done","commit_id":"9d48c9d1a5c3af49c5fe91c0cf69dba7279c2f2b"}],"patrole_tempest_plugin/rbac_utils.py":[{"author":{"_account_id":23186,"name":"Felipe Monteiro","email":"felipe.carneiro.monteiro@gmail.com","username":"felipe.monteiro"},"change_message_id":"8d329614fa89269ab3bdbb3f9dd9e7d81ebcac6f","unresolved":false,"context_lines":[{"line_number":146,"context_line":"            auth_providers \u003d test_obj.get_auth_providers()"},{"line_number":147,"context_line":"            for provider in auth_providers:"},{"line_number":148,"context_line":"                provider.clear_auth()"},{"line_number":149,"context_line":"            # Fernet tokens are not subsecond aware so sleep to ensure we are"},{"line_number":150,"context_line":"            # passing the second boundary before attempting to authenticate."},{"line_number":151,"context_line":"            # Only sleep if a token revocation occurred as a result of role"},{"line_number":152,"context_line":"            # overriding. This will optimize test runtime in the case where"},{"line_number":153,"context_line":"            # ``[identity] admin_role`` \u003d\u003d ``[patrole] rbac_test_role``."},{"line_number":154,"context_line":"            if not role_already_present:"},{"line_number":155,"context_line":"                time.sleep(1)"},{"line_number":156,"context_line":""},{"line_number":157,"context_line":"            for provider in auth_providers:"},{"line_number":158,"context_line":"                provider.set_auth()"}],"source_content_type":"text/x-python","patch_set":4,"id":"3f79a3b5_9a0d0237","side":"PARENT","line":155,"range":{"start_line":149,"start_character":0,"end_line":155,"end_character":29},"updated":"2018-09-28 21:25:09.000000000","message":"We want to keep this around for sure. There\u0027s no way to reliably do this without the sleep. The role_already_present thing is an optimization but strictly speaking not needed.","commit_id":"787fbd72542c233a66309c1700fad9645d01a394"},{"author":{"_account_id":16274,"name":"Mykola Yakovliev","email":"VegasQ@gmail.com","username":"vegasq"},"change_message_id":"c09b529e6a1a24833e73c1cd445ec99e2d53e497","unresolved":false,"context_lines":[{"line_number":146,"context_line":"            auth_providers \u003d test_obj.get_auth_providers()"},{"line_number":147,"context_line":"            for provider in auth_providers:"},{"line_number":148,"context_line":"                provider.clear_auth()"},{"line_number":149,"context_line":"            # Fernet tokens are not subsecond aware so sleep to ensure we are"},{"line_number":150,"context_line":"            # passing the second boundary before attempting to authenticate."},{"line_number":151,"context_line":"            # Only sleep if a token revocation occurred as a result of role"},{"line_number":152,"context_line":"            # overriding. This will optimize test runtime in the case where"},{"line_number":153,"context_line":"            # ``[identity] admin_role`` \u003d\u003d ``[patrole] rbac_test_role``."},{"line_number":154,"context_line":"            if not role_already_present:"},{"line_number":155,"context_line":"                time.sleep(1)"},{"line_number":156,"context_line":""},{"line_number":157,"context_line":"            for provider in auth_providers:"},{"line_number":158,"context_line":"                provider.set_auth()"}],"source_content_type":"text/x-python","patch_set":4,"id":"3f79a3b5_0e08c32a","side":"PARENT","line":155,"range":{"start_line":149,"start_character":0,"end_line":155,"end_character":29},"in_reply_to":"3f79a3b5_9a0d0237","updated":"2018-09-30 17:36:21.000000000","message":"Done","commit_id":"787fbd72542c233a66309c1700fad9645d01a394"},{"author":{"_account_id":23186,"name":"Felipe Monteiro","email":"felipe.carneiro.monteiro@gmail.com","username":"felipe.monteiro"},"change_message_id":"d0801a7ac14ddd40275e9122a4ea6d6d09c5723a","unresolved":false,"context_lines":[{"line_number":57,"context_line":"            admin_groups_client \u003d admin_mgr.groups_client"},{"line_number":58,"context_line":"        else:"},{"line_number":59,"context_line":"            # TODO(vegasq) move to rbac_exceptions"},{"line_number":60,"context_line":"            raise Exception(\"v3 only\")"},{"line_number":61,"context_line":""},{"line_number":62,"context_line":"        self.admin_roles_client \u003d admin_roles_client"},{"line_number":63,"context_line":"        self.admin_groups_client \u003d admin_groups_client"}],"source_content_type":"text/x-python","patch_set":4,"id":"3f79a3b5_9f509460","line":60,"range":{"start_line":60,"start_character":18,"end_line":60,"end_character":27},"updated":"2018-09-28 21:10:54.000000000","message":"Generic exception? Since this is a WIP I don\u0027t know if this is a placeholder but should be changed to a tempest.lib exception or else a patrole one.","commit_id":"f761b5e889725e7889ea932d2646a28e213f865c"},{"author":{"_account_id":16274,"name":"Mykola Yakovliev","email":"VegasQ@gmail.com","username":"vegasq"},"change_message_id":"c09b529e6a1a24833e73c1cd445ec99e2d53e497","unresolved":false,"context_lines":[{"line_number":57,"context_line":"            admin_groups_client \u003d admin_mgr.groups_client"},{"line_number":58,"context_line":"        else:"},{"line_number":59,"context_line":"            # TODO(vegasq) move to rbac_exceptions"},{"line_number":60,"context_line":"            raise Exception(\"v3 only\")"},{"line_number":61,"context_line":""},{"line_number":62,"context_line":"        self.admin_roles_client \u003d admin_roles_client"},{"line_number":63,"context_line":"        self.admin_groups_client \u003d admin_groups_client"}],"source_content_type":"text/x-python","patch_set":4,"id":"3f79a3b5_4e123b63","line":60,"range":{"start_line":60,"start_character":18,"end_line":60,"end_character":27},"in_reply_to":"3f79a3b5_9f509460","updated":"2018-09-30 17:36:21.000000000","message":"Done","commit_id":"f761b5e889725e7889ea932d2646a28e213f865c"},{"author":{"_account_id":23186,"name":"Felipe Monteiro","email":"felipe.carneiro.monteiro@gmail.com","username":"felipe.monteiro"},"change_message_id":"d742d8e19b0372eff040f3e06294ed2086af8e53","unresolved":false,"context_lines":[{"line_number":146,"context_line":"            auth_providers \u003d test_obj.get_auth_providers()"},{"line_number":147,"context_line":"            for provider in auth_providers:"},{"line_number":148,"context_line":"                provider.clear_auth()"},{"line_number":149,"context_line":"            # Fernet tokens are not subsecond aware so sleep to ensure we are"},{"line_number":150,"context_line":"            # passing the second boundary before attempting to authenticate."},{"line_number":151,"context_line":"            # Only sleep if a token revocation occurred as a result of role"},{"line_number":152,"context_line":"            # overriding. This will optimize test runtime in the case where"},{"line_number":153,"context_line":"            # ``[identity] admin_role`` \u003d\u003d ``[patrole] rbac_test_role``."}],"source_content_type":"text/x-python","patch_set":6,"id":"3f79a3b5_791831cc","side":"PARENT","line":150,"range":{"start_line":149,"start_character":12,"end_line":150,"end_character":76},"updated":"2018-09-29 04:30:16.000000000","message":"This should be reincluded as well as this is important information to understand what\u0027s going on behind the scenes.","commit_id":"787fbd72542c233a66309c1700fad9645d01a394"},{"author":{"_account_id":16274,"name":"Mykola Yakovliev","email":"VegasQ@gmail.com","username":"vegasq"},"change_message_id":"c09b529e6a1a24833e73c1cd445ec99e2d53e497","unresolved":false,"context_lines":[{"line_number":146,"context_line":"            auth_providers \u003d test_obj.get_auth_providers()"},{"line_number":147,"context_line":"            for provider in auth_providers:"},{"line_number":148,"context_line":"                provider.clear_auth()"},{"line_number":149,"context_line":"            # Fernet tokens are not subsecond aware so sleep to ensure we are"},{"line_number":150,"context_line":"            # passing the second boundary before attempting to authenticate."},{"line_number":151,"context_line":"            # Only sleep if a token revocation occurred as a result of role"},{"line_number":152,"context_line":"            # overriding. This will optimize test runtime in the case where"},{"line_number":153,"context_line":"            # ``[identity] admin_role`` \u003d\u003d ``[patrole] rbac_test_role``."}],"source_content_type":"text/x-python","patch_set":6,"id":"3f79a3b5_91015207","side":"PARENT","line":150,"range":{"start_line":149,"start_character":12,"end_line":150,"end_character":76},"in_reply_to":"3f79a3b5_791831cc","updated":"2018-09-30 17:36:21.000000000","message":"Done","commit_id":"787fbd72542c233a66309c1700fad9645d01a394"},{"author":{"_account_id":23186,"name":"Felipe Monteiro","email":"felipe.carneiro.monteiro@gmail.com","username":"felipe.monteiro"},"change_message_id":"d742d8e19b0372eff040f3e06294ed2086af8e53","unresolved":false,"context_lines":[{"line_number":64,"context_line":""},{"line_number":65,"context_line":"        self.user_id \u003d test_obj.os_primary.credentials.user_id"},{"line_number":66,"context_line":"        self.project_id \u003d test_obj.os_primary.credentials.tenant_id"},{"line_number":67,"context_line":"        self.token \u003d test_obj.os_primary.auth_provider.get_token()"},{"line_number":68,"context_line":""},{"line_number":69,"context_line":"        # Change default role to admin"},{"line_number":70,"context_line":"        self._override_role(test_obj, False)"}],"source_content_type":"text/x-python","patch_set":6,"id":"3f79a3b5_b9d569b9","line":67,"updated":"2018-09-29 04:30:16.000000000","message":"Is this token being used anywhere?","commit_id":"5d74be287a608a631320c00c79853a572badd927"},{"author":{"_account_id":16274,"name":"Mykola Yakovliev","email":"VegasQ@gmail.com","username":"vegasq"},"change_message_id":"c09b529e6a1a24833e73c1cd445ec99e2d53e497","unresolved":false,"context_lines":[{"line_number":64,"context_line":""},{"line_number":65,"context_line":"        self.user_id \u003d test_obj.os_primary.credentials.user_id"},{"line_number":66,"context_line":"        self.project_id \u003d test_obj.os_primary.credentials.tenant_id"},{"line_number":67,"context_line":"        self.token \u003d test_obj.os_primary.auth_provider.get_token()"},{"line_number":68,"context_line":""},{"line_number":69,"context_line":"        # Change default role to admin"},{"line_number":70,"context_line":"        self._override_role(test_obj, False)"}],"source_content_type":"text/x-python","patch_set":6,"id":"3f79a3b5_51073a18","line":67,"in_reply_to":"3f79a3b5_b9d569b9","updated":"2018-09-30 17:36:21.000000000","message":"Done","commit_id":"5d74be287a608a631320c00c79853a572badd927"},{"author":{"_account_id":23186,"name":"Felipe Monteiro","email":"felipe.carneiro.monteiro@gmail.com","username":"felipe.monteiro"},"change_message_id":"d742d8e19b0372eff040f3e06294ed2086af8e53","unresolved":false,"context_lines":[{"line_number":134,"context_line":"        :param test_obj: instance of :py:class:`tempest.test.BaseTestCase`"},{"line_number":135,"context_line":"        :param toggle_rbac_role: Boolean value that controls the role that"},{"line_number":136,"context_line":"            overrides default role of ``os_primary`` credentials."},{"line_number":137,"context_line":"            * If True: assign user to group with ``[patrole]"},{"line_number":138,"context_line":"            rbac_test_roles`` roles."},{"line_number":139,"context_line":"            * If False: role is set to ``[identity] admin_role``"},{"line_number":140,"context_line":"        \"\"\""},{"line_number":141,"context_line":""}],"source_content_type":"text/x-python","patch_set":6,"id":"3f79a3b5_f981a1c3","line":138,"range":{"start_line":137,"start_character":49,"end_line":138,"end_character":29},"updated":"2018-09-29 04:30:16.000000000","message":"Please keep this together on same line.","commit_id":"5d74be287a608a631320c00c79853a572badd927"},{"author":{"_account_id":16274,"name":"Mykola Yakovliev","email":"VegasQ@gmail.com","username":"vegasq"},"change_message_id":"c09b529e6a1a24833e73c1cd445ec99e2d53e497","unresolved":false,"context_lines":[{"line_number":134,"context_line":"        :param test_obj: instance of :py:class:`tempest.test.BaseTestCase`"},{"line_number":135,"context_line":"        :param toggle_rbac_role: Boolean value that controls the role that"},{"line_number":136,"context_line":"            overrides default role of ``os_primary`` credentials."},{"line_number":137,"context_line":"            * If True: assign user to group with ``[patrole]"},{"line_number":138,"context_line":"            rbac_test_roles`` roles."},{"line_number":139,"context_line":"            * If False: role is set to ``[identity] admin_role``"},{"line_number":140,"context_line":"        \"\"\""},{"line_number":141,"context_line":""}],"source_content_type":"text/x-python","patch_set":6,"id":"3f79a3b5_110d4234","line":138,"range":{"start_line":137,"start_character":49,"end_line":138,"end_character":29},"in_reply_to":"3f79a3b5_f981a1c3","updated":"2018-09-30 17:36:21.000000000","message":"Done","commit_id":"5d74be287a608a631320c00c79853a572badd927"},{"author":{"_account_id":23186,"name":"Felipe Monteiro","email":"felipe.carneiro.monteiro@gmail.com","username":"felipe.monteiro"},"change_message_id":"d742d8e19b0372eff040f3e06294ed2086af8e53","unresolved":false,"context_lines":[{"line_number":149,"context_line":""},{"line_number":150,"context_line":"            # Sleep since a token revocation occurred as a result of role"},{"line_number":151,"context_line":"            # overriding."},{"line_number":152,"context_line":"            time.sleep(1)"},{"line_number":153,"context_line":""},{"line_number":154,"context_line":"        except Exception as exp:"},{"line_number":155,"context_line":"            with excutils.save_and_reraise_exception():"}],"source_content_type":"text/x-python","patch_set":6,"id":"3f79a3b5_9953cd6c","line":152,"range":{"start_line":152,"start_character":12,"end_line":152,"end_character":25},"updated":"2018-09-29 04:30:16.000000000","message":"I think it is better to put this in the finally block so it is always executed.","commit_id":"5d74be287a608a631320c00c79853a572badd927"},{"author":{"_account_id":16274,"name":"Mykola Yakovliev","email":"VegasQ@gmail.com","username":"vegasq"},"change_message_id":"c09b529e6a1a24833e73c1cd445ec99e2d53e497","unresolved":false,"context_lines":[{"line_number":149,"context_line":""},{"line_number":150,"context_line":"            # Sleep since a token revocation occurred as a result of role"},{"line_number":151,"context_line":"            # overriding."},{"line_number":152,"context_line":"            time.sleep(1)"},{"line_number":153,"context_line":""},{"line_number":154,"context_line":"        except Exception as exp:"},{"line_number":155,"context_line":"            with excutils.save_and_reraise_exception():"}],"source_content_type":"text/x-python","patch_set":6,"id":"3f79a3b5_3102be09","line":152,"range":{"start_line":152,"start_character":12,"end_line":152,"end_character":25},"in_reply_to":"3f79a3b5_9953cd6c","updated":"2018-09-30 17:36:21.000000000","message":"Done","commit_id":"5d74be287a608a631320c00c79853a572badd927"},{"author":{"_account_id":23186,"name":"Felipe Monteiro","email":"felipe.carneiro.monteiro@gmail.com","username":"felipe.monteiro"},"change_message_id":"d742d8e19b0372eff040f3e06294ed2086af8e53","unresolved":false,"context_lines":[{"line_number":167,"context_line":""},{"line_number":168,"context_line":"        :return: Admin ID"},{"line_number":169,"context_line":"        \"\"\""},{"line_number":170,"context_line":"        available_roles \u003d self.admin_roles_client.list_roles()[\u0027roles\u0027]"},{"line_number":171,"context_line":"        role_map \u003d {r[\u0027name\u0027]: r[\u0027id\u0027] for r in available_roles}"},{"line_number":172,"context_line":"        LOG.debug(\u0027Available roles: %s\u0027, list(role_map.keys()))"},{"line_number":173,"context_line":""}],"source_content_type":"text/x-python","patch_set":6,"id":"3f79a3b5_397cf9e9","line":170,"range":{"start_line":170,"start_character":50,"end_line":170,"end_character":60},"updated":"2018-09-29 04:30:16.000000000","message":"This could just be a show_role as well and return the \u0027id\u0027. No need for the role_map.\n\nActually, this should just be CONF.identity.admin_role so there is no need to call this.","commit_id":"5d74be287a608a631320c00c79853a572badd927"},{"author":{"_account_id":16274,"name":"Mykola Yakovliev","email":"VegasQ@gmail.com","username":"vegasq"},"change_message_id":"c09b529e6a1a24833e73c1cd445ec99e2d53e497","unresolved":false,"context_lines":[{"line_number":167,"context_line":""},{"line_number":168,"context_line":"        :return: Admin ID"},{"line_number":169,"context_line":"        \"\"\""},{"line_number":170,"context_line":"        available_roles \u003d self.admin_roles_client.list_roles()[\u0027roles\u0027]"},{"line_number":171,"context_line":"        role_map \u003d {r[\u0027name\u0027]: r[\u0027id\u0027] for r in available_roles}"},{"line_number":172,"context_line":"        LOG.debug(\u0027Available roles: %s\u0027, list(role_map.keys()))"},{"line_number":173,"context_line":""}],"source_content_type":"text/x-python","patch_set":6,"id":"3f79a3b5_d1126a55","line":170,"range":{"start_line":170,"start_character":50,"end_line":170,"end_character":60},"in_reply_to":"3f79a3b5_397cf9e9","updated":"2018-09-30 17:36:21.000000000","message":"Done","commit_id":"5d74be287a608a631320c00c79853a572badd927"},{"author":{"_account_id":23186,"name":"Felipe Monteiro","email":"felipe.carneiro.monteiro@gmail.com","username":"felipe.monteiro"},"change_message_id":"d742d8e19b0372eff040f3e06294ed2086af8e53","unresolved":false,"context_lines":[{"line_number":173,"context_line":""},{"line_number":174,"context_line":"        return role_map.get(CONF.identity.admin_role)"},{"line_number":175,"context_line":""},{"line_number":176,"context_line":"    def _restore_user_role_on_project(self):"},{"line_number":177,"context_line":"        \"\"\"Assign tempest user to admin role.\"\"\""},{"line_number":178,"context_line":"        # for role_id in self.original_roles:"},{"line_number":179,"context_line":"        self.admin_roles_client.create_user_role_on_project("}],"source_content_type":"text/x-python","patch_set":6,"id":"3f79a3b5_d955c553","line":176,"range":{"start_line":176,"start_character":8,"end_line":176,"end_character":37},"updated":"2018-09-29 04:30:16.000000000","message":"It\u0027s not really really restoring any roles, but rather assigning admin role. This should be _assign_admin_role_on_project.","commit_id":"5d74be287a608a631320c00c79853a572badd927"},{"author":{"_account_id":16274,"name":"Mykola Yakovliev","email":"VegasQ@gmail.com","username":"vegasq"},"change_message_id":"c09b529e6a1a24833e73c1cd445ec99e2d53e497","unresolved":false,"context_lines":[{"line_number":173,"context_line":""},{"line_number":174,"context_line":"        return role_map.get(CONF.identity.admin_role)"},{"line_number":175,"context_line":""},{"line_number":176,"context_line":"    def _restore_user_role_on_project(self):"},{"line_number":177,"context_line":"        \"\"\"Assign tempest user to admin role.\"\"\""},{"line_number":178,"context_line":"        # for role_id in self.original_roles:"},{"line_number":179,"context_line":"        self.admin_roles_client.create_user_role_on_project("}],"source_content_type":"text/x-python","patch_set":6,"id":"3f79a3b5_311b9e6f","line":176,"range":{"start_line":176,"start_character":8,"end_line":176,"end_character":37},"in_reply_to":"3f79a3b5_d955c553","updated":"2018-09-30 17:36:21.000000000","message":"Done","commit_id":"5d74be287a608a631320c00c79853a572badd927"},{"author":{"_account_id":23186,"name":"Felipe Monteiro","email":"felipe.carneiro.monteiro@gmail.com","username":"felipe.monteiro"},"change_message_id":"d742d8e19b0372eff040f3e06294ed2086af8e53","unresolved":false,"context_lines":[{"line_number":177,"context_line":"        \"\"\"Assign tempest user to admin role.\"\"\""},{"line_number":178,"context_line":"        # for role_id in self.original_roles:"},{"line_number":179,"context_line":"        self.admin_roles_client.create_user_role_on_project("},{"line_number":180,"context_line":"            self.project_id, self.user_id, self._get_admin_role_id())"},{"line_number":181,"context_line":""},{"line_number":182,"context_line":"    def _clear_user_roles_on_project(self):"},{"line_number":183,"context_line":"        \"\"\"Clean tempest user from any pre-assigned roles.\"\"\""}],"source_content_type":"text/x-python","patch_set":6,"id":"3f79a3b5_b967a951","line":180,"range":{"start_line":180,"start_character":43,"end_line":180,"end_character":68},"updated":"2018-09-29 04:30:16.000000000","message":"CONF.identity.admin_role","commit_id":"5d74be287a608a631320c00c79853a572badd927"},{"author":{"_account_id":16274,"name":"Mykola Yakovliev","email":"VegasQ@gmail.com","username":"vegasq"},"change_message_id":"c09b529e6a1a24833e73c1cd445ec99e2d53e497","unresolved":false,"context_lines":[{"line_number":177,"context_line":"        \"\"\"Assign tempest user to admin role.\"\"\""},{"line_number":178,"context_line":"        # for role_id in self.original_roles:"},{"line_number":179,"context_line":"        self.admin_roles_client.create_user_role_on_project("},{"line_number":180,"context_line":"            self.project_id, self.user_id, self._get_admin_role_id())"},{"line_number":181,"context_line":""},{"line_number":182,"context_line":"    def _clear_user_roles_on_project(self):"},{"line_number":183,"context_line":"        \"\"\"Clean tempest user from any pre-assigned roles.\"\"\""}],"source_content_type":"text/x-python","patch_set":6,"id":"3f79a3b5_51209a9a","line":180,"range":{"start_line":180,"start_character":43,"end_line":180,"end_character":68},"in_reply_to":"3f79a3b5_b967a951","updated":"2018-09-30 17:36:21.000000000","message":"Done","commit_id":"5d74be287a608a631320c00c79853a572badd927"},{"author":{"_account_id":23186,"name":"Felipe Monteiro","email":"felipe.carneiro.monteiro@gmail.com","username":"felipe.monteiro"},"change_message_id":"d742d8e19b0372eff040f3e06294ed2086af8e53","unresolved":false,"context_lines":[{"line_number":201,"context_line":"        # Fill group with roles"},{"line_number":202,"context_line":"        for role in CONF.patrole.rbac_test_roles:"},{"line_number":203,"context_line":"            try:"},{"line_number":204,"context_line":"                role_id \u003d roles_cln.create_role(name\u003drole)[\"role\"][\"id\"]"},{"line_number":205,"context_line":""},{"line_number":206,"context_line":"                # Remove only roles we have created"},{"line_number":207,"context_line":"                self.rbac_roles_cleanup.append(role_id)"}],"source_content_type":"text/x-python","patch_set":6,"id":"3f79a3b5_594215ae","line":204,"range":{"start_line":204,"start_character":36,"end_line":204,"end_character":47},"updated":"2018-09-29 04:30:16.000000000","message":"Patrole shouldn\u0027t be creating roles. They should already exist. If the user provides a non-existent role, then that could imply that it\u0027s not even used in the policy file (e.g. the user misspells admin as admn or someting) and then that leads to a case where tests results are completely unexpected. If the role doesn\u0027t exist, this should be an exception.\n\nSimilarly, Tempest doesn\u0027t create any roles; it assumes that they already exist.","commit_id":"5d74be287a608a631320c00c79853a572badd927"},{"author":{"_account_id":16274,"name":"Mykola Yakovliev","email":"VegasQ@gmail.com","username":"vegasq"},"change_message_id":"c09b529e6a1a24833e73c1cd445ec99e2d53e497","unresolved":false,"context_lines":[{"line_number":201,"context_line":"        # Fill group with roles"},{"line_number":202,"context_line":"        for role in CONF.patrole.rbac_test_roles:"},{"line_number":203,"context_line":"            try:"},{"line_number":204,"context_line":"                role_id \u003d roles_cln.create_role(name\u003drole)[\"role\"][\"id\"]"},{"line_number":205,"context_line":""},{"line_number":206,"context_line":"                # Remove only roles we have created"},{"line_number":207,"context_line":"                self.rbac_roles_cleanup.append(role_id)"}],"source_content_type":"text/x-python","patch_set":6,"id":"3f79a3b5_b12ece8a","line":204,"range":{"start_line":204,"start_character":36,"end_line":204,"end_character":47},"in_reply_to":"3f79a3b5_594215ae","updated":"2018-09-30 17:36:21.000000000","message":"Done","commit_id":"5d74be287a608a631320c00c79853a572badd927"},{"author":{"_account_id":23186,"name":"Felipe Monteiro","email":"felipe.carneiro.monteiro@gmail.com","username":"felipe.monteiro"},"change_message_id":"d742d8e19b0372eff040f3e06294ed2086af8e53","unresolved":false,"context_lines":[{"line_number":206,"context_line":"                # Remove only roles we have created"},{"line_number":207,"context_line":"                self.rbac_roles_cleanup.append(role_id)"},{"line_number":208,"context_line":"            except exceptions.Conflict:"},{"line_number":209,"context_line":"                # Member may already exist, f.e. admin"},{"line_number":210,"context_line":"                role_id \u003d roles_cln.list_roles(name\u003drole)[\"roles\"][0][\"id\"]"},{"line_number":211,"context_line":""},{"line_number":212,"context_line":"            # Assign role to group"}],"source_content_type":"text/x-python","patch_set":6,"id":"3f79a3b5_f933e15f","line":209,"range":{"start_line":209,"start_character":44,"end_line":209,"end_character":47},"updated":"2018-09-29 04:30:16.000000000","message":"What does f.e. mean?","commit_id":"5d74be287a608a631320c00c79853a572badd927"},{"author":{"_account_id":23186,"name":"Felipe Monteiro","email":"felipe.carneiro.monteiro@gmail.com","username":"felipe.monteiro"},"change_message_id":"d742d8e19b0372eff040f3e06294ed2086af8e53","unresolved":false,"context_lines":[{"line_number":207,"context_line":"                self.rbac_roles_cleanup.append(role_id)"},{"line_number":208,"context_line":"            except exceptions.Conflict:"},{"line_number":209,"context_line":"                # Member may already exist, f.e. admin"},{"line_number":210,"context_line":"                role_id \u003d roles_cln.list_roles(name\u003drole)[\"roles\"][0][\"id\"]"},{"line_number":211,"context_line":""},{"line_number":212,"context_line":"            # Assign role to group"},{"line_number":213,"context_line":"            roles_cln.create_group_role_on_project(self.project_id,"}],"source_content_type":"text/x-python","patch_set":6,"id":"3f79a3b5_d92e25f8","line":210,"range":{"start_line":210,"start_character":36,"end_line":210,"end_character":46},"updated":"2018-09-29 04:30:16.000000000","message":"It makes more sense to do a show_role here","commit_id":"5d74be287a608a631320c00c79853a572badd927"},{"author":{"_account_id":16274,"name":"Mykola Yakovliev","email":"VegasQ@gmail.com","username":"vegasq"},"change_message_id":"c09b529e6a1a24833e73c1cd445ec99e2d53e497","unresolved":false,"context_lines":[{"line_number":207,"context_line":"                self.rbac_roles_cleanup.append(role_id)"},{"line_number":208,"context_line":"            except exceptions.Conflict:"},{"line_number":209,"context_line":"                # Member may already exist, f.e. admin"},{"line_number":210,"context_line":"                role_id \u003d roles_cln.list_roles(name\u003drole)[\"roles\"][0][\"id\"]"},{"line_number":211,"context_line":""},{"line_number":212,"context_line":"            # Assign role to group"},{"line_number":213,"context_line":"            roles_cln.create_group_role_on_project(self.project_id,"}],"source_content_type":"text/x-python","patch_set":6,"id":"3f79a3b5_b15c8e1a","line":210,"range":{"start_line":210,"start_character":36,"end_line":210,"end_character":46},"in_reply_to":"3f79a3b5_d92e25f8","updated":"2018-09-30 17:36:21.000000000","message":"Done","commit_id":"5d74be287a608a631320c00c79853a572badd927"},{"author":{"_account_id":24817,"name":"Avishek Dutta","email":"ad620p@att.com","username":"ad620p"},"change_message_id":"11897c075f96599fcee9deef7bcda5d1e9cb7385","unresolved":false,"context_lines":[{"line_number":56,"context_line":"            admin_roles_client \u003d admin_mgr.roles_v3_client"},{"line_number":57,"context_line":"            admin_groups_client \u003d admin_mgr.groups_client"},{"line_number":58,"context_line":"        else:"},{"line_number":59,"context_line":"            raise rbac_exceptions.IdentityV3Required()"},{"line_number":60,"context_line":""},{"line_number":61,"context_line":"        self.admin_roles_client \u003d admin_roles_client"},{"line_number":62,"context_line":"        self.admin_groups_client \u003d admin_groups_client"}],"source_content_type":"text/x-python","patch_set":13,"id":"3f79a3b5_240b492b","line":59,"updated":"2018-10-02 00:55:26.000000000","message":"is that means we don\u0027t support v2 anymore?","commit_id":"e5fc0e52548584dc877febb047401212856442bc"},{"author":{"_account_id":23186,"name":"Felipe Monteiro","email":"felipe.carneiro.monteiro@gmail.com","username":"felipe.monteiro"},"change_message_id":"7dd2a62c8a96138c8eca109613e0ea5cac0f8b13","unresolved":false,"context_lines":[{"line_number":56,"context_line":"            admin_roles_client \u003d admin_mgr.roles_v3_client"},{"line_number":57,"context_line":"            admin_groups_client \u003d admin_mgr.groups_client"},{"line_number":58,"context_line":"        else:"},{"line_number":59,"context_line":"            raise rbac_exceptions.IdentityV3Required()"},{"line_number":60,"context_line":""},{"line_number":61,"context_line":"        self.admin_roles_client \u003d admin_roles_client"},{"line_number":62,"context_line":"        self.admin_groups_client \u003d admin_groups_client"}],"source_content_type":"text/x-python","patch_set":13,"id":"3f79a3b5_3a8fe02e","line":59,"in_reply_to":"3f79a3b5_240b492b","updated":"2018-10-02 02:45:17.000000000","message":"The Groups API isn\u0027t available in v2, but regardless, v2 isn\u0027t really supported anymore.","commit_id":"e5fc0e52548584dc877febb047401212856442bc"},{"author":{"_account_id":24817,"name":"Avishek Dutta","email":"ad620p@att.com","username":"ad620p"},"change_message_id":"61ed15f607e52d6c909217d412dc5982e0af972b","unresolved":false,"context_lines":[{"line_number":56,"context_line":"            admin_roles_client \u003d admin_mgr.roles_v3_client"},{"line_number":57,"context_line":"            admin_groups_client \u003d admin_mgr.groups_client"},{"line_number":58,"context_line":"        else:"},{"line_number":59,"context_line":"            raise rbac_exceptions.IdentityV3Required()"},{"line_number":60,"context_line":""},{"line_number":61,"context_line":"        self.admin_roles_client \u003d admin_roles_client"},{"line_number":62,"context_line":"        self.admin_groups_client \u003d admin_groups_client"}],"source_content_type":"text/x-python","patch_set":13,"id":"3f79a3b5_f5597928","line":59,"in_reply_to":"3f79a3b5_3a8fe02e","updated":"2018-10-02 03:27:58.000000000","message":"What about backward compatibility? We are not suppose to maintain any branch as per tempest \"branchless strategy\".\n\nhttps://specs.openstack.org/openstack/qa-specs/specs/tempest/implemented/branchless-tempest.html\n\nhttps://docs.openstack.org/tempest/latest/HACKING.html#branchless-tempest-considerations","commit_id":"e5fc0e52548584dc877febb047401212856442bc"},{"author":{"_account_id":23186,"name":"Felipe Monteiro","email":"felipe.carneiro.monteiro@gmail.com","username":"felipe.monteiro"},"change_message_id":"3b0df0d9236acb3fa8e592ac701ad49ffffc8128","unresolved":false,"context_lines":[{"line_number":56,"context_line":"            admin_roles_client \u003d admin_mgr.roles_v3_client"},{"line_number":57,"context_line":"            admin_groups_client \u003d admin_mgr.groups_client"},{"line_number":58,"context_line":"        else:"},{"line_number":59,"context_line":"            raise rbac_exceptions.IdentityV3Required()"},{"line_number":60,"context_line":""},{"line_number":61,"context_line":"        self.admin_roles_client \u003d admin_roles_client"},{"line_number":62,"context_line":"        self.admin_groups_client \u003d admin_groups_client"}],"source_content_type":"text/x-python","patch_set":13,"id":"3f79a3b5_26879bb8","line":59,"in_reply_to":"3f79a3b5_6b355ef5","updated":"2018-10-03 22:26:41.000000000","message":"I decided to go with deprecation period for v2: https://review.openstack.org/#/c/607578/\n\nWe should do that to give people a case to switch in case they are using it. It\u0027s the right process.\n\nBut we do not need to test this with a separate Zuul job definition for Keystone v2 + API tests. Unit tests are enough.","commit_id":"e5fc0e52548584dc877febb047401212856442bc"},{"author":{"_account_id":16274,"name":"Mykola Yakovliev","email":"VegasQ@gmail.com","username":"vegasq"},"change_message_id":"34df7a3e3524f90285823aaa50454de318451670","unresolved":false,"context_lines":[{"line_number":56,"context_line":"            admin_roles_client \u003d admin_mgr.roles_v3_client"},{"line_number":57,"context_line":"            admin_groups_client \u003d admin_mgr.groups_client"},{"line_number":58,"context_line":"        else:"},{"line_number":59,"context_line":"            raise rbac_exceptions.IdentityV3Required()"},{"line_number":60,"context_line":""},{"line_number":61,"context_line":"        self.admin_roles_client \u003d admin_roles_client"},{"line_number":62,"context_line":"        self.admin_groups_client \u003d admin_groups_client"}],"source_content_type":"text/x-python","patch_set":13,"id":"3f79a3b5_6b355ef5","line":59,"in_reply_to":"3f79a3b5_d390f244","updated":"2018-10-03 21:42:01.000000000","message":"Alright, gentlemen, now I\u0027m playing with the idea to keep v2 as a default way to run tests (without groups), but this way raises another question. Should we test both cases, for v2 and v3-group approach?\n\n@Felipe, I don\u0027t know what kind of resources do we have for testing. If We will decide to keep both ways - we will double the number of jobs for zuul... And it\u0027s already a slow process.","commit_id":"e5fc0e52548584dc877febb047401212856442bc"},{"author":{"_account_id":23186,"name":"Felipe Monteiro","email":"felipe.carneiro.monteiro@gmail.com","username":"felipe.monteiro"},"change_message_id":"46d606e762545593e0630fbd8a9ee92764ae1b6c","unresolved":false,"context_lines":[{"line_number":56,"context_line":"            admin_roles_client \u003d admin_mgr.roles_v3_client"},{"line_number":57,"context_line":"            admin_groups_client \u003d admin_mgr.groups_client"},{"line_number":58,"context_line":"        else:"},{"line_number":59,"context_line":"            raise rbac_exceptions.IdentityV3Required()"},{"line_number":60,"context_line":""},{"line_number":61,"context_line":"        self.admin_roles_client \u003d admin_roles_client"},{"line_number":62,"context_line":"        self.admin_groups_client \u003d admin_groups_client"}],"source_content_type":"text/x-python","patch_set":13,"id":"3f79a3b5_d390f244","line":59,"in_reply_to":"3f79a3b5_f5597928","updated":"2018-10-03 13:48:59.000000000","message":"I think we shouldn\u0027t implement this with groups for now, because of what I wrote previously which is that I think it would be better to create the group/teardown the group once per test class but that has a dependency on refactoring this code to exist in a `BasePatroleTest` class. It is perhaps possible to pull it off using the `RbacUtilsMixin` class, but probably less clean.\n\nRegardless, I think in a separate patch set we should drop support for v2 from Patrole -- Patrole has already dropped v2 API tests so it only makes sense to stop making the framework dependent on v2. Simialry, Tempest doesn\u0027t test v2 anymore either by default.","commit_id":"e5fc0e52548584dc877febb047401212856442bc"},{"author":{"_account_id":23186,"name":"Felipe Monteiro","email":"felipe.carneiro.monteiro@gmail.com","username":"felipe.monteiro"},"change_message_id":"7dd2a62c8a96138c8eca109613e0ea5cac0f8b13","unresolved":false,"context_lines":[{"line_number":176,"context_line":"            self.admin_roles_client.delete_role_from_user_on_project("},{"line_number":177,"context_line":"                self.project_id, self.user_id, role_id)"},{"line_number":178,"context_line":""},{"line_number":179,"context_line":"    def _create_rbac_group(self):"},{"line_number":180,"context_line":"        roles_cln \u003d self.admin_roles_client"},{"line_number":181,"context_line":""},{"line_number":182,"context_line":"        # Create and save group for rbac tests"}],"source_content_type":"text/x-python","patch_set":13,"id":"3f79a3b5_ba91b048","line":179,"range":{"start_line":179,"start_character":8,"end_line":179,"end_character":26},"updated":"2018-10-02 02:45:17.000000000","message":"None of this group creation is actually needed and, in fact, just adds unnecessary API calls.\n\nWe could just continue to use `create_user_role_on_project` which will remove the need to create a group then delete it.\n\nIf the group were actually created once per class (via resource_setup) and cleaned up once per class (via resource_cleanup) then I could see the value in it. As it stands though, without creating a base Patrole class (which is what rbac_utils.py needs to turn into), all this is doing is adding additional steps to achieve the goal: assigning multiple roles to the user on a project.\n\nWe can just as easily accomplish that without groups in this case.","commit_id":"e5fc0e52548584dc877febb047401212856442bc"},{"author":{"_account_id":24817,"name":"Avishek Dutta","email":"ad620p@att.com","username":"ad620p"},"change_message_id":"61ed15f607e52d6c909217d412dc5982e0af972b","unresolved":false,"context_lines":[{"line_number":176,"context_line":"            self.admin_roles_client.delete_role_from_user_on_project("},{"line_number":177,"context_line":"                self.project_id, self.user_id, role_id)"},{"line_number":178,"context_line":""},{"line_number":179,"context_line":"    def _create_rbac_group(self):"},{"line_number":180,"context_line":"        roles_cln \u003d self.admin_roles_client"},{"line_number":181,"context_line":""},{"line_number":182,"context_line":"        # Create and save group for rbac tests"}],"source_content_type":"text/x-python","patch_set":13,"id":"3f79a3b5_15951588","line":179,"range":{"start_line":179,"start_character":8,"end_line":179,"end_character":26},"in_reply_to":"3f79a3b5_ba91b048","updated":"2018-10-02 03:27:58.000000000","message":"agree with group creation once per class logic.","commit_id":"e5fc0e52548584dc877febb047401212856442bc"},{"author":{"_account_id":24817,"name":"Avishek Dutta","email":"ad620p@att.com","username":"ad620p"},"change_message_id":"11897c075f96599fcee9deef7bcda5d1e9cb7385","unresolved":false,"context_lines":[{"line_number":180,"context_line":"        roles_cln \u003d self.admin_roles_client"},{"line_number":181,"context_line":""},{"line_number":182,"context_line":"        # Create and save group for rbac tests"},{"line_number":183,"context_line":"        group \u003d data_utils.rand_name(\"PatroleRbacGroup\")"},{"line_number":184,"context_line":"        self.rbac_group_id \u003d self.admin_groups_client.create_group("},{"line_number":185,"context_line":"            name\u003dgroup)[\"group\"][\"id\"]"},{"line_number":186,"context_line":""}],"source_content_type":"text/x-python","patch_set":13,"id":"3f79a3b5_7707b118","line":183,"updated":"2018-10-02 00:55:26.000000000","message":"use or append random","commit_id":"e5fc0e52548584dc877febb047401212856442bc"},{"author":{"_account_id":23186,"name":"Felipe Monteiro","email":"felipe.carneiro.monteiro@gmail.com","username":"felipe.monteiro"},"change_message_id":"b7d0342b2641ecfeb3c166a065f5aec1b3a285de","unresolved":false,"context_lines":[{"line_number":121,"context_line":"            # up."},{"line_number":122,"context_line":"            self._override_role(test_obj, False)"},{"line_number":123,"context_line":""},{"line_number":124,"context_line":"    def _override_role_v2(self, test_obj, toggle_rbac_role\u003dFalse):"},{"line_number":125,"context_line":"        \"\"\"Private helper for overriding ``os_primary`` Tempest credentials."},{"line_number":126,"context_line":""},{"line_number":127,"context_line":"        :param test_obj: instance of :py:class:`tempest.test.BaseTestCase`"}],"source_content_type":"text/x-python","patch_set":27,"id":"3f79a3b5_876e7495","line":124,"range":{"start_line":124,"start_character":8,"end_line":124,"end_character":25},"updated":"2018-10-06 03:31:39.000000000","message":"I\u0027m still not convinced this group thing is needed. I understand why architecturally people want groups but frankly it\u0027s just a nice way of clumping together roles; it\u0027s not actually required here.\n\nThat being said, it\u0027s possible to get around having to support so much extra code just to use groups.\n\nIt\u0027s possible to do something like this (in __init__ of RbacUtils):\n\nif CONF.identity_feature_enabled.api_v3:\n    admin_roles_client \u003d admin_mgr.roles_v3_client\n    admin_groups_client \u003d admin_mgr.groups_client\nelse:\n    admin_roles_client \u003d admin_mgr.roles_client\n    admin_groups_client \u003d None\n\nIn override_role have something like:\n\nif CONF.identity_feature_enabled.api_v3:\n   _setup_group()\n   _override_group()  # add user to group with RBAC roles\nelse:\n   _override_role()  # assign RBAC roles to user on project\n\nIf you catch my drift. As it stands there is a lot of redundant code that can be abstracted away as the operations are very similar. Ultimately it\u0027s the difference between adding the user to the group and assigning the role to the user on the project -- just a difference in API calls.\n\nSee here for a slightly similar example: https://review.openstack.org/#/c/607578/2/patrole_tempest_plugin/rbac_utils.py","commit_id":"d6c9d0135ee91c3a2565288dd6fd56bf0f47b28c"},{"author":{"_account_id":16274,"name":"Mykola Yakovliev","email":"VegasQ@gmail.com","username":"vegasq"},"change_message_id":"f469ff04d5553d52b84230afc0f0610c19f30a77","unresolved":false,"context_lines":[{"line_number":121,"context_line":"            # up."},{"line_number":122,"context_line":"            self._override_role(test_obj, False)"},{"line_number":123,"context_line":""},{"line_number":124,"context_line":"    def _override_role_v2(self, test_obj, toggle_rbac_role\u003dFalse):"},{"line_number":125,"context_line":"        \"\"\"Private helper for overriding ``os_primary`` Tempest credentials."},{"line_number":126,"context_line":""},{"line_number":127,"context_line":"        :param test_obj: instance of :py:class:`tempest.test.BaseTestCase`"}],"source_content_type":"text/x-python","patch_set":27,"id":"3f79a3b5_ab5ebd4e","line":124,"range":{"start_line":124,"start_character":8,"end_line":124,"end_character":25},"in_reply_to":"3f79a3b5_10f4bc54","updated":"2018-10-08 21:13:11.000000000","message":"Oooh, somehow it slipped my mind that user may have more than a single role.","commit_id":"d6c9d0135ee91c3a2565288dd6fd56bf0f47b28c"},{"author":{"_account_id":23186,"name":"Felipe Monteiro","email":"felipe.carneiro.monteiro@gmail.com","username":"felipe.monteiro"},"change_message_id":"d4588154fb2cac3dbce08a7e5bef1d74cc016eba","unresolved":false,"context_lines":[{"line_number":121,"context_line":"            # up."},{"line_number":122,"context_line":"            self._override_role(test_obj, False)"},{"line_number":123,"context_line":""},{"line_number":124,"context_line":"    def _override_role_v2(self, test_obj, toggle_rbac_role\u003dFalse):"},{"line_number":125,"context_line":"        \"\"\"Private helper for overriding ``os_primary`` Tempest credentials."},{"line_number":126,"context_line":""},{"line_number":127,"context_line":"        :param test_obj: instance of :py:class:`tempest.test.BaseTestCase`"}],"source_content_type":"text/x-python","patch_set":27,"id":"3f79a3b5_10f4bc54","line":124,"range":{"start_line":124,"start_character":8,"end_line":124,"end_character":25},"in_reply_to":"3f79a3b5_2272d2e5","updated":"2018-10-08 20:23:21.000000000","message":"As I understand it, without groups you get:\n\nassign role neutron_show to user bob\n...\nassign role cinder_show to user bob\n\nassign role neutron_show to user joe\n...\nassign role cinder_show to user joe\n\nThat basically means you have to do N API calls for each user.\n\nWith groups you do:\n\nassign role neutron_show to group g\n...\nassign role cinder_show to group g\nadd bob to group g\nadd joe to group g\n\nSuch that you substantially reduce the number of API calls for multiple users.\n\nBut in the case of Patrole, we are only assigning the roles to primary user, so the convenience of a group disappears.\n\nThe only \"justification\" in using a group is to want exact parity with the downstream production use case -- but all you are testing at that point is that the Groups API is behaving correctly in Patrole. Assuming that the Groups API is behaving correctly (which is logical) then we can just use role assignments directly.","commit_id":"d6c9d0135ee91c3a2565288dd6fd56bf0f47b28c"},{"author":{"_account_id":16274,"name":"Mykola Yakovliev","email":"VegasQ@gmail.com","username":"vegasq"},"change_message_id":"a3d6f477cff611867cdfcc63f520e6588ae6ba6b","unresolved":false,"context_lines":[{"line_number":121,"context_line":"            # up."},{"line_number":122,"context_line":"            self._override_role(test_obj, False)"},{"line_number":123,"context_line":""},{"line_number":124,"context_line":"    def _override_role_v2(self, test_obj, toggle_rbac_role\u003dFalse):"},{"line_number":125,"context_line":"        \"\"\"Private helper for overriding ``os_primary`` Tempest credentials."},{"line_number":126,"context_line":""},{"line_number":127,"context_line":"        :param test_obj: instance of :py:class:`tempest.test.BaseTestCase`"}],"source_content_type":"text/x-python","patch_set":27,"id":"3f79a3b5_2272d2e5","line":124,"range":{"start_line":124,"start_character":8,"end_line":124,"end_character":25},"in_reply_to":"3f79a3b5_876e7495","updated":"2018-10-08 18:39:35.000000000","message":"\u003e I\u0027m still not convinced this group thing is needed.\n\nAgreed. Tho is there a better place where this can be implemented? Like for example, we may have such group (pure fiction):\n\nnet_mgr_group:\n    neutron_show\n    neutron_create\n    neutron_update\n    neutron_delete\n    nova_show\n    cinder_show\n    \nAnd in CI\\CD fashion we want to verify changes to our custom built OpenStack is still keeps rules enforced.\n\nI think the only goal here is to let users define their own complex roles and more explicit polocy.json.","commit_id":"d6c9d0135ee91c3a2565288dd6fd56bf0f47b28c"},{"author":{"_account_id":23186,"name":"Felipe Monteiro","email":"felipe.carneiro.monteiro@gmail.com","username":"felipe.monteiro"},"change_message_id":"b7d0342b2641ecfeb3c166a065f5aec1b3a285de","unresolved":false,"context_lines":[{"line_number":223,"context_line":"        if not admin_roles:"},{"line_number":224,"context_line":"            raise rbac_exceptions.RbacRoleNotFound("},{"line_number":225,"context_line":"                role\u003dCONF.identity.admin_role)"},{"line_number":226,"context_line":"        if len(admin_roles) \u003e 1:"},{"line_number":227,"context_line":"            raise rbac_exceptions.RbacDuplicateRoleName("},{"line_number":228,"context_line":"                role\u003dCONF.identity.admin_role)"},{"line_number":229,"context_line":""},{"line_number":230,"context_line":"        admin_role_id \u003d admin_roles[0][\u0027id\u0027]"},{"line_number":231,"context_line":"        self.admin_roles_client.create_user_role_on_project("}],"source_content_type":"text/x-python","patch_set":27,"id":"3f79a3b5_c7546cc9","line":228,"range":{"start_line":226,"start_character":0,"end_line":228,"end_character":46},"updated":"2018-10-06 03:31:39.000000000","message":"I\u0027m not sure that this is possible. I would think that role names are unique at the DB level.","commit_id":"d6c9d0135ee91c3a2565288dd6fd56bf0f47b28c"},{"author":{"_account_id":16274,"name":"Mykola Yakovliev","email":"VegasQ@gmail.com","username":"vegasq"},"change_message_id":"a3d6f477cff611867cdfcc63f520e6588ae6ba6b","unresolved":false,"context_lines":[{"line_number":223,"context_line":"        if not admin_roles:"},{"line_number":224,"context_line":"            raise rbac_exceptions.RbacRoleNotFound("},{"line_number":225,"context_line":"                role\u003dCONF.identity.admin_role)"},{"line_number":226,"context_line":"        if len(admin_roles) \u003e 1:"},{"line_number":227,"context_line":"            raise rbac_exceptions.RbacDuplicateRoleName("},{"line_number":228,"context_line":"                role\u003dCONF.identity.admin_role)"},{"line_number":229,"context_line":""},{"line_number":230,"context_line":"        admin_role_id \u003d admin_roles[0][\u0027id\u0027]"},{"line_number":231,"context_line":"        self.admin_roles_client.create_user_role_on_project("}],"source_content_type":"text/x-python","patch_set":27,"id":"3f79a3b5_a2c26201","line":228,"range":{"start_line":226,"start_character":0,"end_line":228,"end_character":46},"in_reply_to":"3f79a3b5_c7546cc9","updated":"2018-10-08 18:39:35.000000000","message":"Done","commit_id":"d6c9d0135ee91c3a2565288dd6fd56bf0f47b28c"},{"author":{"_account_id":23186,"name":"Felipe Monteiro","email":"felipe.carneiro.monteiro@gmail.com","username":"felipe.monteiro"},"change_message_id":"553973cb3d4762d4804eacf4a7ac89f7c4f3f30d","unresolved":false,"context_lines":[{"line_number":165,"context_line":""},{"line_number":166,"context_line":"        rbac_role_ids \u003d []"},{"line_number":167,"context_line":"        roles \u003d CONF.patrole.rbac_test_roles"},{"line_number":168,"context_line":"        # TODO(vegasq) drop once CONF.patrole.rbac_test_role is removed"},{"line_number":169,"context_line":"        if CONF.patrole.rbac_test_role:"},{"line_number":170,"context_line":"            roles.append(CONF.patrole.rbac_test_role)"},{"line_number":171,"context_line":"            roles \u003d list(set(roles))"},{"line_number":172,"context_line":""},{"line_number":173,"context_line":"        for role_name in roles:"},{"line_number":174,"context_line":"            rbac_role_ids.append(role_map.get(role_name))"}],"source_content_type":"text/x-python","patch_set":38,"id":"3f79a3b5_50e50906","line":171,"range":{"start_line":168,"start_character":0,"end_line":171,"end_character":36},"updated":"2018-10-24 05:44:02.000000000","message":"Ditto","commit_id":"9d48c9d1a5c3af49c5fe91c0cf69dba7279c2f2b"},{"author":{"_account_id":16274,"name":"Mykola Yakovliev","email":"VegasQ@gmail.com","username":"vegasq"},"change_message_id":"59b1e21c4b110d99866ade87a6ef48d1f0e9e053","unresolved":false,"context_lines":[{"line_number":165,"context_line":""},{"line_number":166,"context_line":"        rbac_role_ids \u003d []"},{"line_number":167,"context_line":"        roles \u003d CONF.patrole.rbac_test_roles"},{"line_number":168,"context_line":"        # TODO(vegasq) drop once CONF.patrole.rbac_test_role is removed"},{"line_number":169,"context_line":"        if CONF.patrole.rbac_test_role:"},{"line_number":170,"context_line":"            roles.append(CONF.patrole.rbac_test_role)"},{"line_number":171,"context_line":"            roles \u003d list(set(roles))"},{"line_number":172,"context_line":""},{"line_number":173,"context_line":"        for role_name in roles:"},{"line_number":174,"context_line":"            rbac_role_ids.append(role_map.get(role_name))"}],"source_content_type":"text/x-python","patch_set":38,"id":"3f79a3b5_07818bfa","line":171,"range":{"start_line":168,"start_character":0,"end_line":171,"end_character":36},"in_reply_to":"3f79a3b5_50e50906","updated":"2018-10-24 16:55:12.000000000","message":"Done","commit_id":"9d48c9d1a5c3af49c5fe91c0cf69dba7279c2f2b"}],"patrole_tempest_plugin/requirements_authority.py":[{"author":{"_account_id":23186,"name":"Felipe Monteiro","email":"felipe.carneiro.monteiro@gmail.com","username":"felipe.monteiro"},"change_message_id":"d0801a7ac14ddd40275e9122a4ea6d6d09c5723a","unresolved":false,"context_lines":[{"line_number":101,"context_line":"        :param string rule_name: Rule to be checked using provided requirements"},{"line_number":102,"context_line":"            file specified by ``[patrole].custom_requirements_file``. Must be"},{"line_number":103,"context_line":"            a key present in this file, under the appropriate component."},{"line_number":104,"context_line":"        :param []string roles: Roles to validate against custom requirements"},{"line_number":105,"context_line":"        file."},{"line_number":106,"context_line":"        :returns: True if ``role`` is allowed to perform ``rule_name``, else"},{"line_number":107,"context_line":"            False."}],"source_content_type":"text/x-python","patch_set":4,"id":"3f79a3b5_df5a8c80","line":104,"range":{"start_line":104,"start_character":15,"end_line":104,"end_character":24},"updated":"2018-09-28 21:10:54.000000000","message":"List[string]","commit_id":"f761b5e889725e7889ea932d2646a28e213f865c"},{"author":{"_account_id":23186,"name":"Felipe Monteiro","email":"felipe.carneiro.monteiro@gmail.com","username":"felipe.monteiro"},"change_message_id":"d742d8e19b0372eff040f3e06294ed2086af8e53","unresolved":false,"context_lines":[{"line_number":101,"context_line":"        :param string rule_name: Rule to be checked using provided requirements"},{"line_number":102,"context_line":"            file specified by ``[patrole].custom_requirements_file``. Must be"},{"line_number":103,"context_line":"            a key present in this file, under the appropriate component."},{"line_number":104,"context_line":"        :param []string roles: Roles to validate against custom requirements"},{"line_number":105,"context_line":"        file."},{"line_number":106,"context_line":"        :returns: True if ``role`` is allowed to perform ``rule_name``, else"},{"line_number":107,"context_line":"            False."}],"source_content_type":"text/x-python","patch_set":6,"id":"3f79a3b5_39cab919","line":104,"range":{"start_line":104,"start_character":15,"end_line":104,"end_character":23},"updated":"2018-09-29 04:30:16.000000000","message":"List[string]\n\nSee http://git.openstack.org/cgit/openstack/nova/tree/nova/virt/hardware.py#n1404 as an example.","commit_id":"5d74be287a608a631320c00c79853a572badd927"},{"author":{"_account_id":16274,"name":"Mykola Yakovliev","email":"VegasQ@gmail.com","username":"vegasq"},"change_message_id":"c09b529e6a1a24833e73c1cd445ec99e2d53e497","unresolved":false,"context_lines":[{"line_number":101,"context_line":"        :param string rule_name: Rule to be checked using provided requirements"},{"line_number":102,"context_line":"            file specified by ``[patrole].custom_requirements_file``. Must be"},{"line_number":103,"context_line":"            a key present in this file, under the appropriate component."},{"line_number":104,"context_line":"        :param []string roles: Roles to validate against custom requirements"},{"line_number":105,"context_line":"        file."},{"line_number":106,"context_line":"        :returns: True if ``role`` is allowed to perform ``rule_name``, else"},{"line_number":107,"context_line":"            False."}],"source_content_type":"text/x-python","patch_set":6,"id":"3f79a3b5_f16686ee","line":104,"range":{"start_line":104,"start_character":15,"end_line":104,"end_character":23},"in_reply_to":"3f79a3b5_39cab919","updated":"2018-09-30 17:36:21.000000000","message":"Done","commit_id":"5d74be287a608a631320c00c79853a572badd927"},{"author":{"_account_id":23186,"name":"Felipe Monteiro","email":"felipe.carneiro.monteiro@gmail.com","username":"felipe.monteiro"},"change_message_id":"d742d8e19b0372eff040f3e06294ed2086af8e53","unresolved":false,"context_lines":[{"line_number":102,"context_line":"            file specified by ``[patrole].custom_requirements_file``. Must be"},{"line_number":103,"context_line":"            a key present in this file, under the appropriate component."},{"line_number":104,"context_line":"        :param []string roles: Roles to validate against custom requirements"},{"line_number":105,"context_line":"        file."},{"line_number":106,"context_line":"        :returns: True if ``role`` is allowed to perform ``rule_name``, else"},{"line_number":107,"context_line":"            False."},{"line_number":108,"context_line":"        :rtype: bool"}],"source_content_type":"text/x-python","patch_set":6,"id":"3f79a3b5_7946f1a9","line":105,"range":{"start_line":105,"start_character":8,"end_line":105,"end_character":12},"updated":"2018-09-29 04:30:16.000000000","message":"Please indent by 4 spaces for consistency.","commit_id":"5d74be287a608a631320c00c79853a572badd927"},{"author":{"_account_id":23186,"name":"Felipe Monteiro","email":"felipe.carneiro.monteiro@gmail.com","username":"felipe.monteiro"},"change_message_id":"d742d8e19b0372eff040f3e06294ed2086af8e53","unresolved":false,"context_lines":[{"line_number":116,"context_line":"                \"formatted.\")"},{"line_number":117,"context_line":"        try:"},{"line_number":118,"context_line":"            _api \u003d self.roles_dict[rule_name]"},{"line_number":119,"context_line":"            if type(roles) !\u003d list:"},{"line_number":120,"context_line":"                roles \u003d [roles]"},{"line_number":121,"context_line":"            for role in roles:"},{"line_number":122,"context_line":"                return role in _api"}],"source_content_type":"text/x-python","patch_set":6,"id":"3f79a3b5_5949b5b5","line":119,"range":{"start_line":119,"start_character":15,"end_line":119,"end_character":34},"updated":"2018-09-29 04:30:16.000000000","message":"instance(roles, list)","commit_id":"5d74be287a608a631320c00c79853a572badd927"},{"author":{"_account_id":16274,"name":"Mykola Yakovliev","email":"VegasQ@gmail.com","username":"vegasq"},"change_message_id":"c09b529e6a1a24833e73c1cd445ec99e2d53e497","unresolved":false,"context_lines":[{"line_number":116,"context_line":"                \"formatted.\")"},{"line_number":117,"context_line":"        try:"},{"line_number":118,"context_line":"            _api \u003d self.roles_dict[rule_name]"},{"line_number":119,"context_line":"            if type(roles) !\u003d list:"},{"line_number":120,"context_line":"                roles \u003d [roles]"},{"line_number":121,"context_line":"            for role in roles:"},{"line_number":122,"context_line":"                return role in _api"}],"source_content_type":"text/x-python","patch_set":6,"id":"3f79a3b5_116462e4","line":119,"range":{"start_line":119,"start_character":15,"end_line":119,"end_character":34},"in_reply_to":"3f79a3b5_5949b5b5","updated":"2018-09-30 17:36:21.000000000","message":"Done","commit_id":"5d74be287a608a631320c00c79853a572badd927"},{"author":{"_account_id":23186,"name":"Felipe Monteiro","email":"felipe.carneiro.monteiro@gmail.com","username":"felipe.monteiro"},"change_message_id":"960f64ef6faa9f7c90bd7e4745c2d85d422bbc8a","unresolved":false,"context_lines":[{"line_number":118,"context_line":"            _api \u003d self.roles_dict[rule_name]"},{"line_number":119,"context_line":"            if type(roles) !\u003d list:"},{"line_number":120,"context_line":"                roles \u003d [roles]"},{"line_number":121,"context_line":"            for role in roles:"},{"line_number":122,"context_line":"                return role in _api"},{"line_number":123,"context_line":"        except KeyError:"},{"line_number":124,"context_line":"            raise KeyError(\"\u0027%s\u0027 API is not defined in the requirements YAML \""},{"line_number":125,"context_line":"                           \"file\" % rule_name)"}],"source_content_type":"text/x-python","patch_set":7,"id":"3f79a3b5_9d7732d2","line":122,"range":{"start_line":121,"start_character":12,"end_line":122,"end_character":35},"updated":"2018-09-29 15:21:19.000000000","message":"I don\u0027t think that this will work either. The policy_authority module can intelligently figure this out by deferring to oslo.policy for an answer. But the requirements_authority module relies on the following:\n\nhttps://docs.openstack.org/patrole/latest/framework/requirements_authority.html#custom-requirements-file\n\nWhich means that you can infer easily whether a role is allowed because it is included underneath the rule. By extension, you can easily figure out whether a role is not allowed because it is NOT included underneath the rule. \n\nBut how do you know whether BOTH need to be allowed or only ONE needs to be allowed?\n\nThat is, take the following example:\n\nGiven:\n\n1) CONF.patrole.rbac_roles \u003d [member, reader]\n\n2) \u003cservice_foo\u003e:\n       \u003capi_action_a\u003e:\n         - member\n         - admin\n\nThen it\u0027s obvious that member is allowed and reader is NOT allowed. But it is not possible with this design to know what the combination of that result is:\n\n* What if the rule is \"role:member and not role:reader\" (not allowed)\n* What if the rule is \"role:member or role:reader\" (allowed)\n\nThis relies necessarily on the nature of the oslo.policy rule check. That can only be gleaned via the policy authority module.","commit_id":"87ee7d903dabadd280e036b57f6262ec9757d32b"},{"author":{"_account_id":23186,"name":"Felipe Monteiro","email":"felipe.carneiro.monteiro@gmail.com","username":"felipe.monteiro"},"change_message_id":"752054b38c39981b9c3ce510a43a1bb1318dc2db","unresolved":false,"context_lines":[{"line_number":118,"context_line":"            _api \u003d self.roles_dict[rule_name]"},{"line_number":119,"context_line":"            if type(roles) !\u003d list:"},{"line_number":120,"context_line":"                roles \u003d [roles]"},{"line_number":121,"context_line":"            for role in roles:"},{"line_number":122,"context_line":"                return role in _api"},{"line_number":123,"context_line":"        except KeyError:"},{"line_number":124,"context_line":"            raise KeyError(\"\u0027%s\u0027 API is not defined in the requirements YAML \""},{"line_number":125,"context_line":"                           \"file\" % rule_name)"}],"source_content_type":"text/x-python","patch_set":7,"id":"3f79a3b5_e0d79d4e","line":122,"range":{"start_line":121,"start_character":12,"end_line":122,"end_character":35},"in_reply_to":"3f79a3b5_00edf922","updated":"2018-09-29 15:26:08.000000000","message":"That is, for case 2:\n\n* What if the rule is \"role:member or role:reader\"\n\nThen that changes 2) to be:\n\n2) \u003cservice_foo\u003e:\n       \u003capi_action_a\u003e:\n         - member\n         - reader\n\nWhich refutes my point.","commit_id":"87ee7d903dabadd280e036b57f6262ec9757d32b"},{"author":{"_account_id":23186,"name":"Felipe Monteiro","email":"felipe.carneiro.monteiro@gmail.com","username":"felipe.monteiro"},"change_message_id":"778667927de31e0f4147e730d887712e704cc588","unresolved":false,"context_lines":[{"line_number":118,"context_line":"            _api \u003d self.roles_dict[rule_name]"},{"line_number":119,"context_line":"            if type(roles) !\u003d list:"},{"line_number":120,"context_line":"                roles \u003d [roles]"},{"line_number":121,"context_line":"            for role in roles:"},{"line_number":122,"context_line":"                return role in _api"},{"line_number":123,"context_line":"        except KeyError:"},{"line_number":124,"context_line":"            raise KeyError(\"\u0027%s\u0027 API is not defined in the requirements YAML \""},{"line_number":125,"context_line":"                           \"file\" % rule_name)"}],"source_content_type":"text/x-python","patch_set":7,"id":"3f79a3b5_65132967","line":122,"range":{"start_line":121,"start_character":12,"end_line":122,"end_character":35},"in_reply_to":"3f79a3b5_31215e50","updated":"2018-10-05 05:02:17.000000000","message":"We can\u0027t change the syntax. That would incur massive tech debt.\n\nI\u0027m thinking\n\n        _api \u003d self.roles_dict[rule_name]\n            if not isinstance(roles, list):\n                roles \u003d [roles]\n            return all(role in _api for role in roles)\n\nmight work. Examples:\n\nroleA: allowed \nroleB: allowed\nroleC: not allowed\n\nIf user has roleA \u003d\u003e expected: allowed, actual: allowed \u003d\u003e OK\nIf user has roleB \u003d\u003e expected: allowed, actual: allowed \u003d\u003e OK\nIf user has roleC \u003d\u003e expected: not allowed, actual: not allowed \u003d\u003e OK\nIf user has roleA and roleB \u003d\u003e expected: allowed, actual: allowed \u003d\u003e OK\nIf user has roleA and roleB and roleC \u003d\u003e expected: not allowed, actual: not allowed \u003d\u003e OK\n\nThat is because `_api` will look like:\n\n- roleA\n- roleB\n\nroleC, since it is not allowed, is excluded. This is the approach taken currently in the requirements file.","commit_id":"87ee7d903dabadd280e036b57f6262ec9757d32b"},{"author":{"_account_id":23186,"name":"Felipe Monteiro","email":"felipe.carneiro.monteiro@gmail.com","username":"felipe.monteiro"},"change_message_id":"d9aa5d7248fd9aa12b2b5fd61606cc04e97b93bf","unresolved":false,"context_lines":[{"line_number":118,"context_line":"            _api \u003d self.roles_dict[rule_name]"},{"line_number":119,"context_line":"            if type(roles) !\u003d list:"},{"line_number":120,"context_line":"                roles \u003d [roles]"},{"line_number":121,"context_line":"            for role in roles:"},{"line_number":122,"context_line":"                return role in _api"},{"line_number":123,"context_line":"        except KeyError:"},{"line_number":124,"context_line":"            raise KeyError(\"\u0027%s\u0027 API is not defined in the requirements YAML \""},{"line_number":125,"context_line":"                           \"file\" % rule_name)"}],"source_content_type":"text/x-python","patch_set":7,"id":"3f79a3b5_00edf922","line":122,"range":{"start_line":121,"start_character":12,"end_line":122,"end_character":35},"in_reply_to":"3f79a3b5_9d7732d2","updated":"2018-09-29 15:25:04.000000000","message":"Actually if the rule is \"role:reader\" then it would be included under the action. I think then that the code would become:\n\n    try:\n            _api \u003d self.roles_dict[rule_name]\n            if not isinstance(roles, list):\n                roles \u003d [roles]\n            return all(role in _api for role in roles)\n    except:\n         ....\n    return False\n\nBut this requires some careful testing to see if there are any edge cases.","commit_id":"87ee7d903dabadd280e036b57f6262ec9757d32b"},{"author":{"_account_id":16274,"name":"Mykola Yakovliev","email":"VegasQ@gmail.com","username":"vegasq"},"change_message_id":"c09b529e6a1a24833e73c1cd445ec99e2d53e497","unresolved":false,"context_lines":[{"line_number":118,"context_line":"            _api \u003d self.roles_dict[rule_name]"},{"line_number":119,"context_line":"            if type(roles) !\u003d list:"},{"line_number":120,"context_line":"                roles \u003d [roles]"},{"line_number":121,"context_line":"            for role in roles:"},{"line_number":122,"context_line":"                return role in _api"},{"line_number":123,"context_line":"        except KeyError:"},{"line_number":124,"context_line":"            raise KeyError(\"\u0027%s\u0027 API is not defined in the requirements YAML \""},{"line_number":125,"context_line":"                           \"file\" % rule_name)"}],"source_content_type":"text/x-python","patch_set":7,"id":"3f79a3b5_31215e50","line":122,"range":{"start_line":121,"start_character":12,"end_line":122,"end_character":35},"in_reply_to":"3f79a3b5_e0d79d4e","updated":"2018-09-30 17:36:21.000000000","message":"What am I getting here is that this change might require a change of requirements_file syntax to mirror what policy.json is doing with ``or`` and ``and``. For now, I\u0027ll limit requirements_authority usage to groups with a single role only, since this change will require some extra effort.","commit_id":"87ee7d903dabadd280e036b57f6262ec9757d32b"},{"author":{"_account_id":23186,"name":"Felipe Monteiro","email":"felipe.carneiro.monteiro@gmail.com","username":"felipe.monteiro"},"change_message_id":"011661633113cef197cc8479c78635be5b94c721","unresolved":false,"context_lines":[{"line_number":88,"context_line":"            Defaults to ``[patrole].custom_requirements_file``."},{"line_number":89,"context_line":"        :param str component: Name of the OpenStack service to be validated."},{"line_number":90,"context_line":"        \"\"\""},{"line_number":91,"context_line":"        if len(CONF.patrole.rbac_test_roles) !\u003d 1:"},{"line_number":92,"context_line":"            raise Exception(\"RequirementsAuthority supports single role \""},{"line_number":93,"context_line":"                            \"validation.\")"},{"line_number":94,"context_line":"        filepath \u003d filepath or CONF.patrole.custom_requirements_file"},{"line_number":95,"context_line":""},{"line_number":96,"context_line":"        if component is not None:"}],"source_content_type":"text/x-python","patch_set":13,"id":"3f79a3b5_6667d325","line":93,"range":{"start_line":91,"start_character":8,"end_line":93,"end_character":42},"updated":"2018-10-03 22:31:14.000000000","message":"Is this necessarily true? I\u0027m curious whether the code I included before doesn\u0027t work for all cases?","commit_id":"e5fc0e52548584dc877febb047401212856442bc"},{"author":{"_account_id":16274,"name":"Mykola Yakovliev","email":"VegasQ@gmail.com","username":"vegasq"},"change_message_id":"dd5f5545aee7e39f8e4a753db00af57ba35a0c6f","unresolved":false,"context_lines":[{"line_number":88,"context_line":"            Defaults to ``[patrole].custom_requirements_file``."},{"line_number":89,"context_line":"        :param str component: Name of the OpenStack service to be validated."},{"line_number":90,"context_line":"        \"\"\""},{"line_number":91,"context_line":"        if len(CONF.patrole.rbac_test_roles) !\u003d 1:"},{"line_number":92,"context_line":"            raise Exception(\"RequirementsAuthority supports single role \""},{"line_number":93,"context_line":"                            \"validation.\")"},{"line_number":94,"context_line":"        filepath \u003d filepath or CONF.patrole.custom_requirements_file"},{"line_number":95,"context_line":""},{"line_number":96,"context_line":"        if component is not None:"}],"source_content_type":"text/x-python","patch_set":13,"id":"3f79a3b5_c3bc80b7","line":93,"range":{"start_line":91,"start_character":8,"end_line":93,"end_character":42},"in_reply_to":"3f79a3b5_6667d325","updated":"2018-10-04 18:49:57.000000000","message":"Oh, probably I misunderstood what you were saying here: https://review.openstack.org/#/c/606110/7/patrole_tempest_plugin/requirements_authority.py@122\n\nSince it\u0027s impossible to have logical arguments like OR and AND in requirements file, I thought we need to rewrite it to be closer to what we have in oslo.policy.\n\nIn other words, instead of a list of rules, we should be using the same syntax as policy.json.\n\nPlease, correct me if I\u0027m wrong.","commit_id":"e5fc0e52548584dc877febb047401212856442bc"},{"author":{"_account_id":23186,"name":"Felipe Monteiro","email":"felipe.carneiro.monteiro@gmail.com","username":"felipe.monteiro"},"change_message_id":"cea8e7852da4c891a6b607fcf85ee2c67a3e86e2","unresolved":false,"context_lines":[{"line_number":102,"context_line":"            file specified by ``[patrole].custom_requirements_file``. Must be"},{"line_number":103,"context_line":"            a key present in this file, under the appropriate component."},{"line_number":104,"context_line":"        :param List[string] roles: Roles to validate against custom"},{"line_number":105,"context_line":"            requirements file. RequirementsAuthority supports only single"},{"line_number":106,"context_line":"            role validation."},{"line_number":107,"context_line":"        :returns: True if ``role`` is allowed to perform ``rule_name``, else"},{"line_number":108,"context_line":"            False."},{"line_number":109,"context_line":"        :rtype: bool"}],"source_content_type":"text/x-python","patch_set":38,"id":"3f79a3b5_614c6fc9","line":106,"range":{"start_line":105,"start_character":31,"end_line":106,"end_character":28},"updated":"2018-10-18 05:56:35.000000000","message":"This no longer appears to be true?","commit_id":"9d48c9d1a5c3af49c5fe91c0cf69dba7279c2f2b"},{"author":{"_account_id":16274,"name":"Mykola Yakovliev","email":"VegasQ@gmail.com","username":"vegasq"},"change_message_id":"4d0f4c40578c01d7136041e5b42898a8b4ef6bc9","unresolved":false,"context_lines":[{"line_number":102,"context_line":"            file specified by ``[patrole].custom_requirements_file``. Must be"},{"line_number":103,"context_line":"            a key present in this file, under the appropriate component."},{"line_number":104,"context_line":"        :param List[string] roles: Roles to validate against custom"},{"line_number":105,"context_line":"            requirements file. RequirementsAuthority supports only single"},{"line_number":106,"context_line":"            role validation."},{"line_number":107,"context_line":"        :returns: True if ``role`` is allowed to perform ``rule_name``, else"},{"line_number":108,"context_line":"            False."},{"line_number":109,"context_line":"        :rtype: bool"}],"source_content_type":"text/x-python","patch_set":38,"id":"3f79a3b5_559c7f5b","line":106,"range":{"start_line":105,"start_character":31,"end_line":106,"end_character":28},"in_reply_to":"3f79a3b5_614c6fc9","updated":"2018-10-18 15:49:52.000000000","message":"Done","commit_id":"9d48c9d1a5c3af49c5fe91c0cf69dba7279c2f2b"}],"patrole_tempest_plugin/tests/unit/test_rbac_rule_validation.py":[{"author":{"_account_id":24817,"name":"Avishek Dutta","email":"ad620p@att.com","username":"ad620p"},"change_message_id":"11897c075f96599fcee9deef7bcda5d1e9cb7385","unresolved":false,"context_lines":[{"line_number":46,"context_line":"        setattr(self.mock_test_args.os_primary, \u0027credentials\u0027, mock_creds)"},{"line_number":47,"context_line":""},{"line_number":48,"context_line":"        self.useFixture("},{"line_number":49,"context_line":"            patrole_fixtures.ConfPatcher(rbac_test_roles\u003d[\u0027Member\u0027],"},{"line_number":50,"context_line":"                                         group\u003d\u0027patrole\u0027))"},{"line_number":51,"context_line":"        # Disable patrole log for unit tests."},{"line_number":52,"context_line":"        self.useFixture("}],"source_content_type":"text/x-python","patch_set":13,"id":"3f79a3b5_7720119b","line":49,"updated":"2018-10-02 00:55:26.000000000","message":"should not it be like member instead like fixtures.py","commit_id":"e5fc0e52548584dc877febb047401212856442bc"},{"author":{"_account_id":23186,"name":"Felipe Monteiro","email":"felipe.carneiro.monteiro@gmail.com","username":"felipe.monteiro"},"change_message_id":"011661633113cef197cc8479c78635be5b94c721","unresolved":false,"context_lines":[{"line_number":46,"context_line":"        setattr(self.mock_test_args.os_primary, \u0027credentials\u0027, mock_creds)"},{"line_number":47,"context_line":""},{"line_number":48,"context_line":"        self.useFixture("},{"line_number":49,"context_line":"            patrole_fixtures.ConfPatcher(rbac_test_roles\u003d[\u0027Member\u0027],"},{"line_number":50,"context_line":"                                         group\u003d\u0027patrole\u0027))"},{"line_number":51,"context_line":"        # Disable patrole log for unit tests."},{"line_number":52,"context_line":"        self.useFixture("}],"source_content_type":"text/x-python","patch_set":13,"id":"3f79a3b5_866a2fe9","line":49,"in_reply_to":"3f79a3b5_7720119b","updated":"2018-10-03 22:31:14.000000000","message":"It is better to use \u0027member\u0027 here but that is a tiny nit and unrelated.","commit_id":"e5fc0e52548584dc877febb047401212856442bc"}],"releasenotes/notes/multi-role-rbac-7f597c004a558956.yaml":[{"author":{"_account_id":23186,"name":"Felipe Monteiro","email":"felipe.carneiro.monteiro@gmail.com","username":"felipe.monteiro"},"change_message_id":"a0b69a0b84bc5c522032025b2db91806aead3217","unresolved":false,"context_lines":[{"line_number":4,"context_line":"    We have replaced CONF.patrole.rbac_test_role with"},{"line_number":5,"context_line":"    CONF.patrole.rbac_test_roles, where instead of single role we can specify"},{"line_number":6,"context_line":"    list of roles to be assigned to test user. This way we may run rbac tests"},{"line_number":7,"context_line":"    for scenarious that requires user to have more that a single role."},{"line_number":8,"context_line":"deprecations:"},{"line_number":9,"context_line":"  - |"},{"line_number":10,"context_line":"    Config parameter CONF.rbac_test_role is deprecated in favor of"}],"source_content_type":"text/x-yaml","patch_set":45,"id":"3f79a3b5_3a4b07b3","line":7,"range":{"start_line":7,"start_character":8,"end_line":7,"end_character":18},"updated":"2018-10-31 05:06:13.000000000","message":"scenarios","commit_id":"a87f0e00845ab0fafb605db1dda1d8d4ecee956b"},{"author":{"_account_id":16274,"name":"Mykola Yakovliev","email":"VegasQ@gmail.com","username":"vegasq"},"change_message_id":"874eb9f24049886aea784005e1d9e15275ce0bae","unresolved":false,"context_lines":[{"line_number":4,"context_line":"    We have replaced CONF.patrole.rbac_test_role with"},{"line_number":5,"context_line":"    CONF.patrole.rbac_test_roles, where instead of single role we can specify"},{"line_number":6,"context_line":"    list of roles to be assigned to test user. This way we may run rbac tests"},{"line_number":7,"context_line":"    for scenarious that requires user to have more that a single role."},{"line_number":8,"context_line":"deprecations:"},{"line_number":9,"context_line":"  - |"},{"line_number":10,"context_line":"    Config parameter CONF.rbac_test_role is deprecated in favor of"}],"source_content_type":"text/x-yaml","patch_set":45,"id":"3f79a3b5_3f2be47c","line":7,"range":{"start_line":7,"start_character":8,"end_line":7,"end_character":18},"in_reply_to":"3f79a3b5_3a4b07b3","updated":"2018-10-31 22:36:01.000000000","message":"Done","commit_id":"a87f0e00845ab0fafb605db1dda1d8d4ecee956b"}]}
