[CalendarServer-changes] [13211] CalendarServer/trunk/txdav/who/util.py

source_changes at macosforge.org source_changes at macosforge.org
Tue Apr 8 17:04:38 PDT 2014


Revision: 13211
          http://trac.calendarserver.org//changeset/13211
Author:   sagen at apple.com
Date:     2014-04-08 17:04:38 -0700 (Tue, 08 Apr 2014)
Log Message:
-----------
Starting work on hooking up LDAP

Modified Paths:
--------------
    CalendarServer/trunk/txdav/who/util.py

Modified: CalendarServer/trunk/txdav/who/util.py
===================================================================
--- CalendarServer/trunk/txdav/who/util.py	2014-04-09 00:04:10 UTC (rev 13210)
+++ CalendarServer/trunk/txdav/who/util.py	2014-04-09 00:04:38 UTC (rev 13211)
@@ -16,27 +16,30 @@
 
 
 import os
+
+from calendarserver.tap.util import getDBPool, storeFromConfig
 from twext.python.log import Logger
-from twisted.cred.credentials import UsernamePassword
+from twext.python.types import MappingProxyType
 from twext.who.aggregate import DirectoryService as AggregateDirectoryService
-from txdav.who.augment import AugmentedDirectoryService
-
-from calendarserver.tap.util import getDBPool, storeFromConfig
 from twext.who.idirectory import (
-    RecordType, DirectoryConfigurationError
+    FieldName as BaseFieldName, RecordType, DirectoryConfigurationError
 )
-from twext.who.ldap import DirectoryService as LDAPDirectoryService
+from twext.who.ldap import (
+    DirectoryService as LDAPDirectoryService, LDAPAttribute
+)
 from twext.who.util import ConstantsContainer
+from twisted.cred.credentials import UsernamePassword
 from twisted.python.filepath import FilePath
 from twisted.python.reflect import namedClass
 from twistedcaldav.config import fullServerPath
+from txdav.who.augment import AugmentedDirectoryService
 from txdav.who.delegates import DirectoryService as DelegateDirectoryService
 from txdav.who.idirectory import (
     RecordType as CalRecordType,
     FieldName as CalFieldName
 )
+from txdav.who.wiki import DirectoryService as WikiDirectoryService
 from txdav.who.xml import DirectoryService as XMLDirectoryService
-from txdav.who.wiki import DirectoryService as WikiDirectoryService
 
 
 log = Logger()
@@ -99,7 +102,16 @@
             directory = LDAPDirectoryService(
                 params.uri,
                 params.rdnSchema.base,
-                credentials=creds
+                credentials=creds,
+                fieldNameToAttributesMap=MappingProxyType({
+                    # FieldName.dn: (LDAPAttribute.dn.value,),
+                    BaseFieldName.uid: ("apple-generateduid",),
+                    BaseFieldName.guid: ("apple-generateduid",),
+                    BaseFieldName.shortNames: (LDAPAttribute.uid.value,),
+                    BaseFieldName.fullNames: (LDAPAttribute.cn.value,),
+                    BaseFieldName.emailAddresses: (LDAPAttribute.mail.value,),
+                    BaseFieldName.password: (LDAPAttribute.userPassword.value,),
+                })
             )
 
         else:
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20140408/b43b8a57/attachment.html>


More information about the calendarserver-changes mailing list