Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions src/pas/plugins/sqlalchemy/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,17 @@ def group_class(self):
# IUserManagement implementation
#

security.declarePrivate('updateUser')
@graceful_recovery()
def updateUser(self, user_id, login_name):
session = Session()
principal = self._get_principal_by_id(user_id)
principal.zope_id = login_name
userquery = session.query(self.user_class).filter_by(zope_id=user_id)
userquery = userquery.first()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This does not fail if no user can be found; perhaps you want to use the one() method? Otherwise, the method will fail in the next line with a "can't assign attribute to None object".

userquery.login = login_name


security.declarePrivate('doChangeUser')
@graceful_recovery()
def doChangeUser(self, principal_id, password, **kw):
Expand Down