[Checkins] SVN: Products.PluggableAuthService/trunk/Products/PluggableAuthService/ updateUser: return True on successful update or when login name was the same.
Maurits van Rees
cvs-admin at zope.org
Tue Jan 22 21:57:16 UTC 2013
Log message for revision 129081:
updateUser: return True on successful update or when login name was the same.
Changed:
U Products.PluggableAuthService/trunk/Products/PluggableAuthService/PluggableAuthService.py
U Products.PluggableAuthService/trunk/Products/PluggableAuthService/interfaces/plugins.py
U Products.PluggableAuthService/trunk/Products/PluggableAuthService/plugins/ZODBUserManager.py
U Products.PluggableAuthService/trunk/Products/PluggableAuthService/tests/test_PluggableAuthService.py
-=-
Modified: Products.PluggableAuthService/trunk/Products/PluggableAuthService/PluggableAuthService.py
===================================================================
--- Products.PluggableAuthService/trunk/Products/PluggableAuthService/PluggableAuthService.py 2013-01-22 20:07:40 UTC (rev 129080)
+++ Products.PluggableAuthService/trunk/Products/PluggableAuthService/PluggableAuthService.py 2013-01-22 21:57:15 UTC (rev 129081)
@@ -1308,14 +1308,15 @@
"IUserEnumerationPlugin.", updater_id)
continue
try:
- updater.updateUser(user_id, login_name)
+ result = updater.updateUser(user_id, login_name)
except _SWALLOWABLE_PLUGIN_EXCEPTIONS:
reraise(updater)
logger.debug('UpdateLoginNamePlugin %s error' % updater_id,
exc_info=True)
else:
- success = True
- logger.debug("login name changed to: %r", login_name)
+ if result:
+ success = True
+ logger.debug("login name changed to: %r", login_name)
if not success:
raise ValueError("Cannot update login name of user %r to %r. "
Modified: Products.PluggableAuthService/trunk/Products/PluggableAuthService/interfaces/plugins.py
===================================================================
--- Products.PluggableAuthService/trunk/Products/PluggableAuthService/interfaces/plugins.py 2013-01-22 20:07:40 UTC (rev 129080)
+++ Products.PluggableAuthService/trunk/Products/PluggableAuthService/interfaces/plugins.py 2013-01-22 21:57:15 UTC (rev 129081)
@@ -347,6 +347,13 @@
def updateUser( user_id, login_name ):
""" Update the login name of the user with id user_id.
+
+ The plugin must return True (or any truth value) to indicate a
+ successful update, also when no update was needed.
+
+ When updating a login name makes no sense for a plugin (most
+ likely because it does not actually store login names) and it
+ does not do anything, it must return None or False.
"""
def updateEveryLoginName(quit_on_first_error=True):
Modified: Products.PluggableAuthService/trunk/Products/PluggableAuthService/plugins/ZODBUserManager.py
===================================================================
--- Products.PluggableAuthService/trunk/Products/PluggableAuthService/plugins/ZODBUserManager.py 2013-01-22 20:07:40 UTC (rev 129080)
+++ Products.PluggableAuthService/trunk/Products/PluggableAuthService/plugins/ZODBUserManager.py 2013-01-22 21:57:15 UTC (rev 129081)
@@ -325,6 +325,8 @@
del self._login_to_userid[old_login]
self._login_to_userid[login_name] = user_id
self._userid_to_login[user_id] = login_name
+ # Signal success.
+ return True
security.declarePrivate('updateEveryLoginName')
def updateEveryLoginName(self, quit_on_first_error=True):
Modified: Products.PluggableAuthService/trunk/Products/PluggableAuthService/tests/test_PluggableAuthService.py
===================================================================
--- Products.PluggableAuthService/trunk/Products/PluggableAuthService/tests/test_PluggableAuthService.py 2013-01-22 20:07:40 UTC (rev 129080)
+++ Products.PluggableAuthService/trunk/Products/PluggableAuthService/tests/test_PluggableAuthService.py 2013-01-22 21:57:15 UTC (rev 129081)
@@ -117,7 +117,7 @@
for info in self.users:
if info['id'] == user_id:
info['login'] = login_name
- return
+ return True
def updateEveryLoginName(self, quit_on_first_error=True):
# Let's lowercase all login names.
More information about the checkins
mailing list