Commit 2fc808b8 authored by Alain Takoudjou's avatar Alain Takoudjou

fix PAS: do not return None when person is found

parent 11dab143
...@@ -132,14 +132,16 @@ class SlapOSMachineAuthenticationPlugin(BasePlugin): ...@@ -132,14 +132,16 @@ class SlapOSMachineAuthenticationPlugin(BasePlugin):
# search for user linked to this serial # search for user linked to this serial
certificate_login_list = self.portal_catalog.unrestrictedSearchResults( certificate_login_list = self.portal_catalog.unrestrictedSearchResults(
portal_type=self.certificate_portal_type, portal_type=self.certificate_portal_type,
reference=serial) # XXX - reference should not contain '.crt.pem' here
reference=serial.lower() + '.crt.pem',
validation_state='validated')
creds['machine_login'] = None creds['machine_login'] = None
if len(certificate_login_list) != 0: if len(certificate_login_list) != 0:
if len(certificate_login_list) > 1: if len(certificate_login_list) > 1:
raise ConsistencyError('There is more than one of %s whose \ raise ConsistencyError('There is more than one of %s whose \
serial is %s' % (self.certificate_portal_type, serial)) serial is %s' % (self.certificate_portal_type, serial))
creds['machine_login'] = certificate_login_list[0]\ creds['machine_login'] = certificate_login_list[0]\
.getParent().getReference() .getParentValue().getReference()
elif user_id is not None: elif user_id is not None:
creds['machine_login'] = user_id creds['machine_login'] = user_id
else: else:
......
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