Commit b465f196 authored by Kazuhiko Shiozaki's avatar Kazuhiko Shiozaki

fixup! fixup! [by Vincent] Get rid of all module-global callables. Use PAS API...

fixup! fixup! [by Vincent] Get rid of all module-global callables. Use PAS API instead. Use all non-PAS API public methods. Use PAS API instead. Implement IAuthenticationPlugin API better, so PAS API becomes usable for ERP5-based authentication.
parent 39bfe1dc
......@@ -71,10 +71,15 @@ class Login(XMLObject, LoginAccountProviderMixin, EncryptedPasswordMixin):
activate_kw['tag'] = tag = \
self.getPortalType() + '_setReference_' + value.encode('hex')
# Check that there no existing user
erp5_users = portal.acl_users.erp5_users
user_list = erp5_users.enumerateUsers(login=value)
if [x for x in user_list if x.get('login', {}).get('path', '') != self.getPath()]:
raise RuntimeError, 'user id %s already exist' % (value,)
user_list = [x for x in portal.acl_users.searchUsers(
exact_match=True,
login=self.getReference(),
) if 'login_list' in x]
if user_list:
for user in user_list:
login, = user['login_list']
if login['path'] == self.getPath():
raise RuntimeError, 'user id %s already exist' % (value,)
# Check that there is no reindexation related to reference indexation
if portal.portal_activities.countMessageWithTag(tag):
raise RuntimeError, 'user id %s already exist' % (value,)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment