X-Git-Url: https://git.adam-barratt.org.uk/?a=blobdiff_plain;f=UDLdap.py;h=096f117cde0c3a822e3bf5f76d6ff5b4f7cd0d23;hb=6b038cc113dde577b9cc19c62656bf6d2b41362d;hp=4f83137f1e892468ba27fa3abf2a94589f41b565;hpb=9c3400fed701494b24575a602d25a83ae1815b72;p=mirror%2Fuserdir-ldap.git diff --git a/UDLdap.py b/UDLdap.py index 4f83137..096f117 100644 --- a/UDLdap.py +++ b/UDLdap.py @@ -3,7 +3,7 @@ import time import userdir_ldap class Account: - array_values = ['keyFingerPrint', 'mailWhitelist', 'mailRBL', 'mailRHSBL', 'supplementaryGid'] + array_values = ['keyFingerPrint', 'mailWhitelist', 'mailRBL', 'mailRHSBL', 'supplementaryGid', 'sshRSAAuthKey', 'sudoPassword'] int_values = ['shadowExpire', 'gidNumber'] defaults = { 'accountStatus': 'active', @@ -30,11 +30,12 @@ class Account: if key in self.attributes: if key in self.array_values: return self.attributes[key] - elif key in self.int_values: - if len(self.attributes[key]) == 1: - return int(self.attributes[key][0]) - else: - raise ValueError, 'non-array value has not exactly one value' + + if not len(self.attributes[key]) == 1: + raise ValueError, 'non-array value has not exactly one value' + + if key in self.int_values: + return int(self.attributes[key][0]) else: return self.attributes[key][0] elif key in self.defaults: