zopefoundation / Products.PluggableAuthService

Pluggable Zope authentication / authorization framework
Other
9 stars 18 forks source link

Errors when using manage_roles page in ZMI #51

Closed mauritsvanrees closed 5 years ago

mauritsvanrees commented 5 years ago

This is in Plone 5.2, using PluggableAuthService 2.0, with both Python 2 and 3. The traceback is different.

Steps to reproduce:

On Python 3:

Traceback (innermost last):
  Module ZPublisher.WSGIPublisher, line 155, in transaction_pubevents
  Module ZPublisher.WSGIPublisher, line 337, in publish_module
  Module ZPublisher.WSGIPublisher, line 255, in publish
  Module ZPublisher.mapply, line 85, in mapply
  Module ZPublisher.WSGIPublisher, line 61, in call_object
  Module Products.PluggableAuthService.utils, line 4, in wrapper
  Module <string>, line 4, in manage_assignRoleToPrincipals
  Module AccessControl.requestmethod, line 88, in _curried
  Module Products.PluggableAuthService.plugins.ZODBRoleManager, line 421, in manage_assignRoleToPrincipals
  Module Products.PluggableAuthService.plugins.ZODBRoleManager, line 303, in assignRoleToPrincipal
TypeError: '<' not supported between instances of 'str' and ‘list'

On Python 2 the traceback looks exactly the same, except that the error is clearer:

Traceback (innermost last):
  Module ZPublisher.WSGIPublisher, line 155, in transaction_pubevents
  Module ZPublisher.WSGIPublisher, line 337, in publish_module
  Module ZPublisher.WSGIPublisher, line 255, in publish
  Module ZPublisher.mapply, line 85, in mapply
  Module ZPublisher.WSGIPublisher, line 61, in call_object
  Module Products.PluggableAuthService.utils, line 4, in wrapper
  Module <string>, line 4, in manage_assignRoleToPrincipals
  Module AccessControl.requestmethod, line 88, in _curried
  Module Products.PluggableAuthService.plugins.ZODBRoleManager, line 421, in manage_assignRoleToPrincipals
  Module Products.PluggableAuthService.plugins.ZODBRoleManager, line 303, in assignRoleToPrincipal
KeyError: ["['Manager', 'Manager']", "['Manager', 'Manager']"]

On Python 3:

Traceback (innermost last):
  Module ZPublisher.WSGIPublisher, line 155, in transaction_pubevents
  Module ZPublisher.WSGIPublisher, line 337, in publish_module
  Module ZPublisher.WSGIPublisher, line 255, in publish
  Module ZPublisher.mapply, line 85, in mapply
  Module ZPublisher.WSGIPublisher, line 61, in call_object
  Module Products.PluggableAuthService.utils, line 4, in wrapper
  Module <string>, line 4, in manage_removeRoleFromPrincipals
  Module AccessControl.requestmethod, line 88, in _curried
  Module Products.PluggableAuthService.plugins.ZODBRoleManager, line 444, in manage_removeRoleFromPrincipals
  Module Products.PluggableAuthService.plugins.ZODBRoleManager, line 328, in removeRoleFromPrincipal
TypeError: '<' not supported between instances of 'str' and 'list'

On Python 2, again the traceback looks exactly the same, except that the error is clearer:

Traceback (innermost last):
  Module ZPublisher.WSGIPublisher, line 155, in transaction_pubevents
  Module ZPublisher.WSGIPublisher, line 337, in publish_module
  Module ZPublisher.WSGIPublisher, line 255, in publish
  Module ZPublisher.mapply, line 85, in mapply
  Module ZPublisher.WSGIPublisher, line 61, in call_object
  Module Products.PluggableAuthService.utils, line 4, in wrapper
  Module <string>, line 4, in manage_removeRoleFromPrincipals
  Module AccessControl.requestmethod, line 88, in _curried
  Module Products.PluggableAuthService.plugins.ZODBRoleManager, line 444, in manage_removeRoleFromPrincipals
  Module Products.PluggableAuthService.plugins.ZODBRoleManager, line 328, in removeRoleFromPrincipal
KeyError: ['Manager', 'Manager']

For fun, try clicking the Search button a couple of times. Title changes to something like this:

Assign Role: ['[\'[\\\'["[\\\\\\\'Manager\\\\\\\', \\\\\\\'Manager\\\\\\\']", "[\\\\\\\'Manager\\\\\\\', \\\\\\\'Manager\\\\\\\']"]\\\', \\\'["[\\\\\\\'Manager\\\\\\\', \\\\\\\'Manager\\\\\\\']", "[\\\\\\\'Manager\\\\\\\', \\\\\\\'Manager\\\\\\\']"]\\\']\', \'[\\\'["[\\\\\\\'Manager\\\\\\\', \\\\\\\'Manager\\\\\\\']", "[\\\\\\\'Manager\\\\\\\', \\\\\\\'Manager\\\\\\\']"]\\\', \\\'["[\\\\\\\'Manager\\\\\\\', \\\\\\\'Manager\\\\\\\']", "[\\\\\\\'Manager\\\\\\\', \\\\\\\'Manager\\\\\\\']"]\\\']\']', '[\'[\\\'["[\\\\\\\'Manager\\\\\\\', \\\\\\\'Manager\\\\\\\']", "[\\\\\\\'Manager\\\\\\\', \\\\\\\'Manager\\\\\\\']"]\\\', \\\'["[\\\\\\\'Manager\\\\\\\', \\\\\\\'Manager\\\\\\\']", "[\\\\\\\'Manager\\\\\\\', \\\\\\\'Manager\\\\\\\']"]\\\']\', \'[\\\'["[\\\\\\\'Manager\\\\\\\', \\\\\\\'Manager\\\\\\\']", "[\\\\\\\'Manager\\\\\\\', \\\\\\\'Manager\\\\\\\']"]\\\', \\\'["[\\\\\\\'Manager\\\\\\\', \\\\\\\'Manager\\\\\\\']", "[\\\\\\\'Manager\\\\\\\', \\\\\\\'Manager\\\\\\\']"]\\\']\']']

Note that in core Zope, it works fine, because there is no manage_roles page.

I will see if I can create a PR.

mauritsvanrees commented 5 years ago

Wait, it seems fixed on master.

mauritsvanrees commented 5 years ago

Duplicate of issue #43. I did look for similar issues, but did not use a matching search term.