Ticket #5535 (closed Bug: fixed)

Opened 6 years ago

Last modified 6 years ago

acl_users.getUser(owner) returns wrong user when users with similar login names exist

Reported by: mt Owned by: wichert
Priority: major Milestone: 2.5
Component: Users/Groups Keywords: ZODBUserManager
Cc:

Description (last modified by wichert) (diff)

PluggableAuthService with plugin ZODBUserManager returns an incorrect user when users with similar login names exist. e.g. system with two users 'editor' and 'copyeditor' PloneTool.py line 441

        user = acl_users.getUser(owner)

will return the user 'copyeditor' when you enter 'editor' Appending the following test case to PluggableAuthService/plugins/tests/test_ZODBUserManager.py shows the test failing

   def test_changeOwnership(self):        
        zum = self._makeOne()
        zum.addUser('copyeditor', 'copyeditor', 'password')
        zum.addUser('editor', 'editor', 'password')
        info = zum.enumerateUsers(login='editor')        
        self.assertEqual(info[0]['login'], 'editor')

then

cd zopeinstance
./bin/zopectl test --dir Products/PluggableAuthService

note: info[0] is used in the test as this is what is used in the function _verifyUser (PluggableAuthService.py line 785)

Change History

comment:1 Changed 6 years ago by mt

The correct formatting for the test above is

 def test_changeOwnership(self):        
        zum = self._makeOne()
        zum.addUser('copyeditor', 'copyeditor', 'password')
        zum.addUser('editor', 'editor', 'password')
        info = zum.enumerateUsers(login='editor')        
        self.assertEqual(info[0]['login'], 'editor')

comment:2 Changed 6 years ago by wichert

Can you retry with enumerateUsres(login='editor', exact=True) ?

comment:3 Changed 6 years ago by mt

Hi Wichert, If I rerun the test with

info = zum.enumerateUsers(login='editor', exact_match=True)

the test passes fine, however the same problem arises with the getUsers function,

acl_users.getUser(owner)

How do I make it obey exact_match ?

comment:4 Changed 6 years ago by wichert

  • Status changed from new to assigned
  • Description modified (diff)

comment:5 Changed 6 years ago by wichert

  • Status changed from assigned to closed
  • Resolution set to fixed

(In [9908]) The new owner is identified by his/her userid, not by the users name. fixes #5535

Note: See TracTickets for help on using tickets.