diff options
author | Arthur de Jong <arthur@arthurdejong.org> | 2011-05-13 09:04:13 +0200 |
---|---|---|
committer | Arthur de Jong <arthur@arthurdejong.org> | 2011-05-13 09:04:13 +0200 |
commit | 3071301ee48117e25fd3baea683cc1e724ae6c76 (patch) | |
tree | 506ca35939abfd10fee95f1de80afa5a076e5a58 /pynslcd/shadow.py | |
parent | 4c19151250e318fa38dac33e5db1397b9d95a43e (diff) |
simplify request handling by passing read parameters around in a dict instead of setting object properties (this mainly simplifies search filter building)
git-svn-id: http://arthurdejong.org/svn/nss-pam-ldapd/nss-pam-ldapd@1455 ef36b2f9-881f-0410-afb5-c4e39611909c
Diffstat (limited to 'pynslcd/shadow.py')
-rw-r--r-- | pynslcd/shadow.py | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/pynslcd/shadow.py b/pynslcd/shadow.py index 4408c0c..34119b0 100644 --- a/pynslcd/shadow.py +++ b/pynslcd/shadow.py @@ -39,16 +39,16 @@ bases = ( 'ou=people,dc=test,dc=tld', ) class ShadowRequest(common.Request): - def write(self, dn, attributes): + def write(self, dn, attributes, parameters): # get name and check against requested name names = attributes['uid'] if not names: print 'Error: entry %s does not contain %s value' % ( dn, attmap['uid'] ) return - if self.name: - if self.name not in names: + if 'uid' in parameters: + if parameters['uid'] not in names: return - names = ( self.name, ) + names = ( parameters['uid'], ) # get password (passwd, ) = attributes['userPassword'] if not passwd or self.calleruid != 0: @@ -96,10 +96,9 @@ class ShadowRequest(common.Request): class ShadowByNameRequest(ShadowRequest): action = constants.NSLCD_ACTION_SHADOW_BYNAME - filter_attrs = dict(uid='name') - def read_parameters(self): - self.name = self.fp.read_string() + def read_parameters(self, fp): + return dict(uid=fp.read_string()) class ShadowAllRequest(ShadowRequest): |