summaryrefslogtreecommitdiff
path: root/pynslcd/alias.py
diff options
context:
space:
mode:
authorArthur de Jong <arthur@arthurdejong.org>2011-05-13 07:04:13 +0000
committerArthur de Jong <arthur@arthurdejong.org>2011-05-13 07:04:13 +0000
commit3071301ee48117e25fd3baea683cc1e724ae6c76 (patch)
tree506ca35939abfd10fee95f1de80afa5a076e5a58 /pynslcd/alias.py
parent4c19151250e318fa38dac33e5db1397b9d95a43e (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/alias.py')
-rw-r--r--pynslcd/alias.py13
1 files changed, 6 insertions, 7 deletions
diff --git a/pynslcd/alias.py b/pynslcd/alias.py
index d432945..b35e009 100644
--- a/pynslcd/alias.py
+++ b/pynslcd/alias.py
@@ -30,16 +30,16 @@ filter = '(objectClass=nisMailAlias)'
class AliasRequest(common.Request):
- def write(self, dn, attributes):
+ def write(self, dn, attributes, parameters):
# get name and check against requested name
names = attributes['cn']
if not names:
logging.error('Error: entry %s does not contain %s value', dn, attmap['cn'])
return
- if self.name:
- if self.name.lower() not in (x.lower() for x in names):
+ if 'cn' in parameters:
+ if parameters['cn'].lower() not in (x.lower() for x in names):
return
- names = ( self.name, )
+ names = ( parameters['cn'], )
# get the members of the alias
members = attributes['rfc822MailMember']
if not members:
@@ -55,10 +55,9 @@ class AliasRequest(common.Request):
class AliasByNameRequest(AliasRequest):
action = constants.NSLCD_ACTION_ALIAS_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())
class AliasAllRequest(AliasRequest):