From 3071301ee48117e25fd3baea683cc1e724ae6c76 Mon Sep 17 00:00:00 2001 From: Arthur de Jong Date: Fri, 13 May 2011 07:04:13 +0000 Subject: 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 --- pynslcd/netgroup.py | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) (limited to 'pynslcd/netgroup.py') diff --git a/pynslcd/netgroup.py b/pynslcd/netgroup.py index 21be7a8..0f44660 100644 --- a/pynslcd/netgroup.py +++ b/pynslcd/netgroup.py @@ -36,13 +36,13 @@ filter = '(objectClass=nisNetgroup)' class NetgroupRequest(common.Request): - def write(self, dn, attributes): + def write(self, dn, attributes, parameters): # get names and check against requested user name names = attributes['cn'] - if self.name: - if self.name not in names: + if 'cn' in parameters: + if parameters['cn'] not in names: return - names = ( self.name, ) + names = ( parameters['cn'], ) if not names: print 'Error: entry %s does not contain %s value' % (dn, attmap['cn']) # write the netgroup triples @@ -66,7 +66,6 @@ class NetgroupRequest(common.Request): class NetgroupByNameRequest(NetgroupRequest): action = constants.NSLCD_ACTION_NETGROUP_BYNAME - filter_attrs = dict(cn='name') - def read_parameters(self): - self.name = self.fp.read_string() + def read_parameters(self, fp): + return dict(cn=fp.read_string()) -- cgit v1.2.3