[CalendarServer-changes] [13841] CalendarServer/trunk
source_changes at macosforge.org
source_changes at macosforge.org
Tue Aug 5 16:11:29 PDT 2014
Revision: 13841
http://trac.calendarserver.org//changeset/13841
Author: sagen at apple.com
Date: 2014-08-05 16:11:29 -0700 (Tue, 05 Aug 2014)
Log Message:
-----------
Clean up directory service config; allow specifying of LDAP RDN and attribute mapping
Modified Paths:
--------------
CalendarServer/trunk/calendarserver/tools/util.py
CalendarServer/trunk/conf/caldavd-test.plist
CalendarServer/trunk/requirements-stable.txt
CalendarServer/trunk/twistedcaldav/stdconfig.py
CalendarServer/trunk/twistedcaldav/test/test_config.py
CalendarServer/trunk/twistedcaldav/upgrade.py
CalendarServer/trunk/txdav/who/groups.py
CalendarServer/trunk/txdav/who/util.py
Modified: CalendarServer/trunk/calendarserver/tools/util.py
===================================================================
--- CalendarServer/trunk/calendarserver/tools/util.py 2014-08-05 22:49:28 UTC (rev 13840)
+++ CalendarServer/trunk/calendarserver/tools/util.py 2014-08-05 23:11:29 UTC (rev 13841)
@@ -69,146 +69,6 @@
-# def getDirectory(config=config):
-
-# class MyDirectoryService (AggregateDirectoryService):
-# def getPrincipalCollection(self):
-# if not hasattr(self, "_principalCollection"):
-
-# if config.Notifications.Enabled:
-# # FIXME: NotifierFactory needs reference to the store in order
-# # to get a txn in order to create a Work item
-# notifierFactory = NotifierFactory(
-# None, config.ServerHostName,
-# config.Notifications.CoalesceSeconds,
-# )
-# else:
-# notifierFactory = None
-
-# # Need a data store
-# _newStore = CommonDataStore(FilePath(config.DocumentRoot),
-# notifierFactory, self, True, False)
-# if notifierFactory is not None:
-# notifierFactory.store = _newStore
-
-# #
-# # Instantiating a DirectoryCalendarHomeProvisioningResource with a directory
-# # will register it with the directory (still smells like a hack).
-# #
-# # We need that in order to locate calendar homes via the directory.
-# #
-# from twistedcaldav.directory.calendar import DirectoryCalendarHomeProvisioningResource
-# DirectoryCalendarHomeProvisioningResource(self, "/calendars/", _newStore)
-
-# from twistedcaldav.directory.principal import DirectoryPrincipalProvisioningResource
-# self._principalCollection = DirectoryPrincipalProvisioningResource("/principals/", self)
-
-# return self._principalCollection
-
-# def setPrincipalCollection(self, coll):
-# # See principal.py line 237: self.directory.principalCollection = self
-# pass
-
-# principalCollection = property(getPrincipalCollection, setPrincipalCollection)
-
-# def calendarHomeForRecord(self, record):
-# principal = self.principalCollection.principalForRecord(record)
-# if principal:
-# try:
-# return principal.calendarHome()
-# except AttributeError:
-# pass
-# return None
-
-# def calendarHomeForShortName(self, recordType, shortName):
-# principal = self.principalCollection.principalForShortName(recordType, shortName)
-# if principal:
-# return principal.calendarHome()
-# return None
-
-# def principalForCalendarUserAddress(self, cua):
-# return self.principalCollection.principalForCalendarUserAddress(cua)
-
-# def principalForUID(self, uid):
-# return self.principalCollection.principalForUID(uid)
-
-# # Load augment/proxy db classes now
-# if config.AugmentService.type:
-# augmentClass = namedClass(config.AugmentService.type)
-# augmentService = augmentClass(**config.AugmentService.params)
-# else:
-# augmentService = None
-
-# proxydbClass = namedClass(config.ProxyDBService.type)
-# calendaruserproxy.ProxyDBService = proxydbClass(**config.ProxyDBService.params)
-
-# # Wait for directory service to become available
-# BaseDirectoryService = namedClass(config.DirectoryService.type)
-# config.DirectoryService.params.augmentService = augmentService
-# directory = BaseDirectoryService(config.DirectoryService.params)
-# while not directory.isAvailable():
-# sleep(5)
-
-# directories = [directory]
-
-# if config.ResourceService.Enabled:
-# resourceClass = namedClass(config.ResourceService.type)
-# config.ResourceService.params.augmentService = augmentService
-# resourceDirectory = resourceClass(config.ResourceService.params)
-# resourceDirectory.realmName = directory.realmName
-# directories.append(resourceDirectory)
-
-# aggregate = MyDirectoryService(directories, None)
-# aggregate.augmentService = augmentService
-
-# #
-# # Wire up the resource hierarchy
-# #
-# principalCollection = aggregate.getPrincipalCollection()
-# root = RootResource(
-# config.DocumentRoot,
-# principalCollections=(principalCollection,),
-# )
-# root.putChild("principals", principalCollection)
-
-# # Need a data store
-# _newStore = CommonDataStore(FilePath(config.DocumentRoot), None, aggregate, True, False)
-
-# from twistedcaldav.directory.calendar import DirectoryCalendarHomeProvisioningResource
-# calendarCollection = DirectoryCalendarHomeProvisioningResource(
-# aggregate, "/calendars/",
-# _newStore,
-# )
-# root.putChild("calendars", calendarCollection)
-
-# return aggregate
-
-
-
-# class DummyDirectoryService (DirectoryService):
-# realmName = ""
-# baseGUID = "51856FD4-5023-4890-94FE-4356C4AAC3E4"
-# def recordTypes(self):
-# return ()
-
-
-# def listRecords(self):
-# return ()
-
-
-# def recordWithShortName(self):
-# return None
-
-# dummyDirectoryRecord = DirectoryRecord(
-# service=DummyDirectoryService(),
-# recordType="dummy",
-# guid="8EF0892F-7CB6-4B8E-B294-7C5A5321136A",
-# shortNames=("dummy",),
-# fullName="Dummy McDummerson",
-# firstName="Dummy",
-# lastName="McDummerson",
-# )
-
class UsageError (StandardError):
pass
Modified: CalendarServer/trunk/conf/caldavd-test.plist
===================================================================
--- CalendarServer/trunk/conf/caldavd-test.plist 2014-08-05 22:49:28 UTC (rev 13840)
+++ CalendarServer/trunk/conf/caldavd-test.plist 2014-08-05 23:11:29 UTC (rev 13841)
@@ -196,7 +196,7 @@
<key>DirectoryService</key>
<dict>
<key>type</key>
- <string>twistedcaldav.directory.xmlfile.XMLDirectoryService</string>
+ <string>xml</string>
<key>params</key>
<dict>
@@ -210,14 +210,12 @@
<key>DirectoryService</key>
<dict>
<key>type</key>
- <string>twistedcaldav.directory.appleopendirectory.OpenDirectoryService</string>
+ <string>opendirectory</string>
<key>params</key>
<dict>
<key>node</key>
<string>/Search</string>
- <key>cacheTimeout</key>
- <integer>10</integer>
</dict>
</dict>
-->
@@ -227,7 +225,7 @@
<key>DirectoryService</key>
<dict>
<key>type</key>
- <string>twistedcaldav.directory.ldapdirectory.LdapDirectoryService</string>
+ <string>ldap</string>
<key>params</key>
<dict>
@@ -235,137 +233,58 @@
<array>
<string>users</string>
<string>groups</string>
- <string>locations</string>
- <string>resources</string>
</array>
- <key>cacheTimeout</key>
- <integer>10</integer>
<key>uri</key>
- <string>ldap://ldapserver.example.com/</string>
- <key>tls</key>
- <false/>
- <key>tlsCACertFile</key>
- <string></string>
- <key>tlsCACertDir</key>
- <string></string>
- <key>tlsRequireCert</key>
- <string>never</string>
+ <string>ldap://server.example.com/</string>
<key>credentials</key>
<dict>
<key>dn</key>
<string>uid=admin,ou=people,o=example.com</string>
<key>password</key>
- <string>PASSWORD</string>
+ <string></string>
</dict>
<key>rdnSchema</key>
<dict>
<key>base</key>
- <string>o=example.com</string>
- <key>guidAttr</key>
- <string>GUID</string>
+ <string>dc=server,dc=example,dc=com</string>
<key>users</key>
- <dict>
- <key>rdn</key>
- <string>ou=people</string>
- <key>mapping</key>
- <dict>
- <key>recordName</key>
- <string>uid</string>
- <key>fullName</key>
- <string>cn</string>
- <key>emailAddresses</key>
- <array>
- <string>mail</string>
- <string>mailAlias</string>
- </array>
- <key>firstName</key>
- <string>givenName</string>
- <key>lastName</key>
- <string>sn</string>
- </dict>
- </dict>
+ <string>cn=users</string>
<key>groups</key>
- <dict>
- <key>rdn</key>
- <string>ou=groups</string>
- <key>mapping</key>
- <dict>
- <key>recordName</key>
- <string>cn</string>
- <key>fullName</key>
- <string>cn</string>
- <key>emailAddresses</key>
- <array>
- <string>mail</string>
- <string>mailAlias</string>
- </array>
- </dict>
- </dict>
+ <string>cn=groups</string>
<key>locations</key>
- <dict>
- <key>rdn</key>
- <string>ou=locations</string>
- <key>associatedAddressAttr</key>
- <string></string>
- <key>mapping</key>
- <dict>
- <key>recordName</key>
- <string>cn</string>
- <key>fullName</key>
- <string>cn</string>
- </dict>
- </dict>
+ <string>cn=locations</string>
<key>resources</key>
- <dict>
- <key>rdn</key>
- <string>ou=resources</string>
- <key>mapping</key>
- <dict>
- <key>recordName</key>
- <string>cn</string>
- <key>fullName</key>
- <string>cn</string>
- </dict>
- </dict>
+ <string>cn=resources</string>
<key>addresses</key>
- <dict>
- <key>rdn</key>
- <string>ou=buildings</string>
- <key>geoAttr</key>
- <string></string>
- <key>streetAddressAttr</key>
- <string></string>
- <key>mapping</key>
- <dict>
- <key>recordName</key>
- <string>cn</string>
- <key>fullName</key>
- <string>cn</string>
- </dict>
- </dict>
+ <string>cn=addresses</string>
</dict>
- <key>groupSchema</key>
+ <key>mapping</key>
<dict>
- <key>membersAttr</key>
- <string>uniqueMember</string>
- <key>nestedGroupsAttr</key>
- <string></string>
- <key>memberIdAttr</key>
- <string></string>
+ <key>uid</key>
+ <array>
+ <string>apple-generateduid</string>
+ </array>
+ <key>guid</key>
+ <array>
+ <string>apple-generateduid</string>
+ </array>
+ <key>shortNames</key>
+ <array>
+ <string>uid</string>
+ </array>
+ <key>fullNames</key>
+ <array>
+ <string>cn</string>
+ </array>
+ <key>emailAddresses</key>
+ <array>
+ <string>mail</string>
+ </array>
+ <key>memberDNs</key>
+ <array>
+ <string>uniqueMember</string>
+ </array>
</dict>
- <key>resourceSchema</key>
- <dict>
- <key>resourceInfoAttr</key>
- <string></string>
- <key>autoScheduleAttr</key>
- <string></string>
- <key>autoScheduleEnabledValue</key>
- <string></string>
- <key>proxyAttr</key>
- <string></string>
- <key>readOnlyProxyAttr</key>
- <string></string>
- </dict>
</dict>
</dict>
-->
@@ -380,7 +299,7 @@
<key>Enabled</key>
<true/>
<key>type</key>
- <string>twistedcaldav.directory.xmlfile.XMLDirectoryService</string>
+ <string>xml</string>
<key>params</key>
<dict>
@@ -436,36 +355,6 @@
</dict>
-->
- <!-- Sqlite ProxyDB Service -->
- <key>ProxyDBService</key>
- <dict>
- <key>type</key>
- <string>twistedcaldav.directory.calendaruserproxy.ProxySqliteDB</string>
-
- <key>params</key>
- <dict>
- <key>dbpath</key>
- <string>proxies.sqlite</string>
- </dict>
- </dict>
-
- <!-- PostgreSQL ProxyDB Service -->
- <!--
- <key>ProxyDBService</key>
- <dict>
- <key>type</key>
- <string>twistedcaldav.directory.calendaruserproxy.ProxyPostgreSQLDB</string>
-
- <key>params</key>
- <dict>
- <key>host</key>
- <string>localhost</string>
- <key>database</key>
- <string>proxies</string>
- </dict>
- </dict>
- -->
-
<key>ProxyLoadFromFile</key>
<string>./conf/auth/proxies-test.xml</string>
Modified: CalendarServer/trunk/requirements-stable.txt
===================================================================
--- CalendarServer/trunk/requirements-stable.txt 2014-08-05 22:49:28 UTC (rev 13840)
+++ CalendarServer/trunk/requirements-stable.txt 2014-08-05 23:11:29 UTC (rev 13841)
@@ -5,7 +5,7 @@
# For CalendarServer development, don't try to get these projects from PyPI; use svn.
-e .
--e svn+http://svn.calendarserver.org/repository/calendarserver/twext/trunk@13835#egg=twextpy
+-e svn+http://svn.calendarserver.org/repository/calendarserver/twext/trunk@13840#egg=twextpy
-e svn+http://svn.calendarserver.org/repository/calendarserver/PyKerberos/trunk@13420#egg=kerberos
-e svn+http://svn.calendarserver.org/repository/calendarserver/PyCalendar/trunk@13802#egg=pycalendar
Modified: CalendarServer/trunk/twistedcaldav/stdconfig.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/stdconfig.py 2014-08-05 22:49:28 UTC (rev 13840)
+++ CalendarServer/trunk/twistedcaldav/stdconfig.py 2014-08-05 23:11:29 UTC (rev 13841)
@@ -49,133 +49,48 @@
DEFAULT_CONFIG_FILE = "/etc/caldavd/caldavd.plist"
DEFAULT_SERVICE_PARAMS = {
- "twistedcaldav.directory.xmlfile.XMLDirectoryService": {
- "xmlFile": "accounts.xml",
+ "xml": {
"recordTypes": ("users", "groups"),
- "statSeconds": 15,
+ "xmlFile": "accounts.xml",
},
- "twistedcaldav.directory.appleopendirectory.OpenDirectoryService": {
- "node": "/Search",
- "cacheTimeout": 1, # Minutes
- "batchSize": 100, # for splitting up large queries
- "negativeCaching": False,
- "restrictEnabledRecords": False,
- "restrictToGroup": "",
+ "opendirectory": {
"recordTypes": ("users", "groups"),
+ "node": "/Search",
},
- "twistedcaldav.directory.ldapdirectory.LdapDirectoryService": {
- "cacheTimeout": 1, # Minutes
- "negativeCaching": False,
- "warningThresholdSeconds": 3,
- "batchSize": 500, # for splitting up large queries
- "requestTimeoutSeconds": 10,
- "requestResultsLimit": 200,
- "optimizeMultiName": False,
- "queryLocationsImplicitly": True,
- "restrictEnabledRecords": False,
- "restrictToGroup": "",
+ "ldap": {
"recordTypes": ("users", "groups"),
"uri": "ldap://localhost/",
- "tls": False,
- "tlsCACertFile": None,
- "tlsCACertDir": None,
- "tlsRequireCert": None, # never, allow, try, demand, hard
"credentials": {
"dn": None,
"password": None,
},
- "authMethod": "LDAP",
"rdnSchema": {
"base": "dc=example,dc=com",
- "guidAttr": "entryUUID",
- "users": {
- "rdn": "ou=People",
- "attr": "uid", # used only to synthesize email address
- "emailSuffix": None, # used only to synthesize email address
- "filter": None, # additional filter for this type
- "loginEnabledAttr": "", # attribute controlling login
- "loginEnabledValue": "yes", # "True" value of above attribute
- "calendarEnabledAttr": "", # attribute controlling enabledForCalendaring
- "calendarEnabledValue": "yes", # "True" value of above attribute
- "mapping": { # maps internal record names to LDAP
- "recordName": "uid",
- "fullName": "cn",
- "emailAddresses": ["mail"],
- "firstName": "givenName",
- "lastName": "sn",
- },
- },
- "groups": {
- "rdn": "ou=Group",
- "attr": "cn", # used only to synthesize email address
- "emailSuffix": None, # used only to synthesize email address
- "filter": None, # additional filter for this type
- "mapping": { # maps internal record names to LDAP
- "recordName": "cn",
- "fullName": "cn",
- "emailAddresses": ["mail"],
- "firstName": "givenName",
- "lastName": "sn",
- },
- },
- "locations": {
- "rdn": "ou=Places",
- "attr": "cn", # used only to synthesize email address
- "emailSuffix": None, # used only to synthesize email address
- "filter": None, # additional filter for this type
- "calendarEnabledAttr": "", # attribute controlling enabledForCalendaring
- "calendarEnabledValue": "yes", # "True" value of above attribute
- "mapping": { # maps internal record names to LDAP
- "recordName": "cn",
- "fullName": "cn",
- "emailAddresses": ["mail"],
- "firstName": "givenName",
- "lastName": "sn",
- },
- },
- "resources": {
- "rdn": "ou=Resources",
- "attr": "cn", # used only to synthesize email address
- "emailSuffix": None, # used only to synthesize email address
- "filter": None, # additional filter for this type
- "calendarEnabledAttr": "", # attribute controlling enabledForCalendaring
- "calendarEnabledValue": "yes", # "True" value of above attribute
- "mapping": { # maps internal record names to LDAP
- "recordName": "cn",
- "fullName": "cn",
- "emailAddresses": ["mail"],
- "firstName": "givenName",
- "lastName": "sn",
- },
- },
+ "users": "cn=users",
+ "groups": "cn=groups",
+ "locations": "cn=locations",
+ "resources": "cn=resources",
+ "addresses": "cn=addresses",
},
- "groupSchema": {
- "membersAttr": "member", # how members are specified
- "nestedGroupsAttr": None, # how nested groups are specified
- "memberIdAttr": None, # which attribute the above refer to
- },
- "resourceSchema": {
- "resourceInfoAttr": None, # contains location/resource info
- "autoAcceptGroupAttr": None, # auto accept group
- },
- "poddingSchema": {
- "serverIdAttr": None, # maps to augments server-id
- },
+ "mapping": {
+ "uid": ["apple-generateduid", ],
+ "guid": ["apple-generateduid", ],
+ "shortNames": ["uid", ],
+ "fullNames": ["cn", ],
+ "emailAddresses": ["mail", ],
+ "memberDNs": ["uniqueMember", ],
+ }
},
}
DEFAULT_RESOURCE_PARAMS = {
- "twistedcaldav.directory.xmlfile.XMLDirectoryService": {
- "xmlFile": "resources.xml",
+ "xml": {
"recordTypes": ("locations", "resources", "addresses"),
+ "xmlFile": "resources.xml",
},
- "twistedcaldav.directory.appleopendirectory.OpenDirectoryService": {
+ "opendirectory": {
+ "recordTypes": ("locations", "resources", "addresses"),
"node": "/Search",
- "cacheTimeout": 1, # Minutes
- "negativeCaching": False,
- "restrictEnabledRecords": False,
- "restrictToGroup": "",
- "recordTypes": ("locations", "resources"),
},
}
@@ -195,20 +110,7 @@
},
}
-DEFAULT_PROXYDB_PARAMS = {
- "twistedcaldav.directory.calendaruserproxy.ProxySqliteDB": {
- "dbpath": "proxies.sqlite",
- },
- "twistedcaldav.directory.calendaruserproxy.ProxyPostgreSQLDB": {
- "host": "localhost",
- "database": "proxies",
- "user": "",
- "password": "",
- "dbtype": "",
- },
-}
-
directoryAddressBookBackingServiceDefaultParams = {
"twistedcaldav.directory.xmlfile.XMLDirectoryService": {
"xmlFile": "/etc/carddavd/accounts.xml",
@@ -371,7 +273,7 @@
# Set to URL path of wiki authentication service, e.g. "/auth", in order
# to use javascript authentication dialog. Empty string indicates standard
# browser authentication dialog should be used.
- "WebCalendarAuthPath" : "",
+ "WebCalendarAuthPath": "",
# Define mappings of URLs to file system objects (directories or files)
"Aliases": [],
@@ -384,8 +286,8 @@
#
"DirectoryService": {
"Enabled": True,
- "type": "twistedcaldav.directory.xmlfile.XMLDirectoryService",
- "params": DEFAULT_SERVICE_PARAMS["twistedcaldav.directory.xmlfile.XMLDirectoryService"],
+ "type": "xml",
+ "params": DEFAULT_SERVICE_PARAMS["xml"],
},
"DirectoryRealmName": "",
@@ -398,8 +300,8 @@
#
"ResourceService": {
"Enabled": True,
- "type": "twistedcaldav.directory.xmlfile.XMLDirectoryService",
- "params": DEFAULT_RESOURCE_PARAMS["twistedcaldav.directory.xmlfile.XMLDirectoryService"],
+ "type": "xml",
+ "params": DEFAULT_RESOURCE_PARAMS["xml"],
},
#
@@ -409,16 +311,12 @@
#
"AugmentService": {
"type": "twistedcaldav.directory.augment.AugmentXMLDB",
- "params" : DEFAULT_AUGMENT_PARAMS["twistedcaldav.directory.augment.AugmentXMLDB"],
+ "params": DEFAULT_AUGMENT_PARAMS["twistedcaldav.directory.augment.AugmentXMLDB"],
},
#
# Proxies
#
- "ProxyDBService": {
- "type": "twistedcaldav.directory.calendaruserproxy.ProxySqliteDB",
- "params": DEFAULT_PROXYDB_PARAMS["twistedcaldav.directory.calendaruserproxy.ProxySqliteDB"],
- },
"ProxyLoadFromFile": "", # Allows for initialization of the proxy database from an XML file
#
@@ -1472,15 +1370,6 @@
-def _postUpdateProxyDBService(configDict, reloading=False):
- if configDict.ProxyDBService.type in DEFAULT_PROXYDB_PARAMS:
- for param in tuple(configDict.ProxyDBService.params):
- if param not in DEFAULT_PROXYDB_PARAMS[configDict.ProxyDBService.type]:
- log.warn("Parameter %s is not supported by service %s" % (param, configDict.ProxyDBService.type))
- del configDict.ProxyDBService.params[param]
-
-
-
def _updateACLs(configDict, reloading=False):
#
# Base resource ACLs
@@ -1766,7 +1655,6 @@
_postUpdateDirectoryService,
_postUpdateResourceService,
_postUpdateAugmentService,
- _postUpdateProxyDBService,
_updateACLs,
_updateRejectClients,
_updateLogLevels,
Modified: CalendarServer/trunk/twistedcaldav/test/test_config.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/test/test_config.py 2014-08-05 22:49:28 UTC (rev 13840)
+++ CalendarServer/trunk/twistedcaldav/test/test_config.py 2014-08-05 23:11:29 UTC (rev 13841)
@@ -230,51 +230,51 @@
def testDirectoryService_noChange(self):
- self.assertEquals(config.DirectoryService.type, "twistedcaldav.directory.xmlfile.XMLDirectoryService")
+ self.assertEquals(config.DirectoryService.type, "xml")
self.assertEquals(config.DirectoryService.params.xmlFile, "accounts.xml")
config.update({"DirectoryService": {}})
- self.assertEquals(config.DirectoryService.type, "twistedcaldav.directory.xmlfile.XMLDirectoryService")
+ self.assertEquals(config.DirectoryService.type, "xml")
self.assertEquals(config.DirectoryService.params.xmlFile, "accounts.xml")
def testDirectoryService_sameType(self):
- self.assertEquals(config.DirectoryService.type, "twistedcaldav.directory.xmlfile.XMLDirectoryService")
+ self.assertEquals(config.DirectoryService.type, "xml")
self.assertEquals(config.DirectoryService.params.xmlFile, "accounts.xml")
- config.update({"DirectoryService": {"type": "twistedcaldav.directory.xmlfile.XMLDirectoryService"}})
+ config.update({"DirectoryService": {"type": "xml"}})
- self.assertEquals(config.DirectoryService.type, "twistedcaldav.directory.xmlfile.XMLDirectoryService")
+ self.assertEquals(config.DirectoryService.type, "xml")
self.assertEquals(config.DirectoryService.params.xmlFile, "accounts.xml")
def testDirectoryService_newType(self):
- self.assertEquals(config.DirectoryService.type, "twistedcaldav.directory.xmlfile.XMLDirectoryService")
+ self.assertEquals(config.DirectoryService.type, "xml")
self.assertEquals(config.DirectoryService.params.xmlFile, "accounts.xml")
- config.update({"DirectoryService": {"type": "twistedcaldav.directory.appleopendirectory.OpenDirectoryService"}})
+ config.update({"DirectoryService": {"type": "opendirectory"}})
- self.assertEquals(config.DirectoryService.type, "twistedcaldav.directory.appleopendirectory.OpenDirectoryService")
+ self.assertEquals(config.DirectoryService.type, "opendirectory")
self.assertNotIn("xmlFile", config.DirectoryService.params)
self.assertEquals(config.DirectoryService.params.node, "/Search")
def testDirectoryService_newParam(self):
- self.assertEquals(config.DirectoryService.type, "twistedcaldav.directory.xmlfile.XMLDirectoryService")
+ self.assertEquals(config.DirectoryService.type, "xml")
self.assertEquals(config.DirectoryService.params.xmlFile, "accounts.xml")
- config.update({"DirectoryService": {"type": "twistedcaldav.directory.appleopendirectory.OpenDirectoryService"}})
+ config.update({"DirectoryService": {"type": "opendirectory"}})
- self.assertEquals(config.DirectoryService.type, "twistedcaldav.directory.appleopendirectory.OpenDirectoryService")
+ self.assertEquals(config.DirectoryService.type, "opendirectory")
self.assertEquals(config.DirectoryService.params.node, "/Search")
def testDirectoryService_unknownType(self):
- self.assertEquals(config.DirectoryService.type, "twistedcaldav.directory.xmlfile.XMLDirectoryService")
+ self.assertEquals(config.DirectoryService.type, "xml")
self.assertEquals(config.DirectoryService.params.xmlFile, "accounts.xml")
- config.update({"DirectoryService": {"type": "twistedcaldav.test.test_config.SuperDuperAwesomeService"}})
+ config.update({"DirectoryService": {"type": "unknown"}})
# self.assertEquals(
# config.DirectoryService.params,
Modified: CalendarServer/trunk/twistedcaldav/upgrade.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/upgrade.py 2014-08-05 22:49:28 UTC (rev 13840)
+++ CalendarServer/trunk/twistedcaldav/upgrade.py 2014-08-05 23:11:29 UTC (rev 13841)
@@ -1149,25 +1149,6 @@
# Write stub file as indicator loading is done
FilePath(loadDoneFilePath).touch()
-
- # # Populate the group membership cache
- # if (self.config.GroupCaching.Enabled and
- # self.config.GroupCaching.EnableUpdater):
- # proxydb = calendaruserproxy.ProxyDBService
- # if proxydb is None:
- # proxydbClass = namedClass(self.config.ProxyDBService.type)
- # proxydb = proxydbClass(**self.config.ProxyDBService.params)
-
- # # MOVE2WHO FIXME: port to new group cacher
- # updater = GroupMembershipCacheUpdater(proxydb,
- # directory,
- # self.config.GroupCaching.UpdateSeconds,
- # self.config.GroupCaching.ExpireSeconds,
- # self.config.GroupCaching.LockSeconds,
- # namespace=self.config.GroupCaching.MemcachedPool,
- # useExternalProxies=self.config.GroupCaching.UseExternalProxies)
- # yield updater.updateCache(fast=True)
-
# Process old inbox items
self.store.setMigrating(True)
yield self.processInboxItems()
Modified: CalendarServer/trunk/txdav/who/groups.py
===================================================================
--- CalendarServer/trunk/txdav/who/groups.py 2014-08-05 22:49:28 UTC (rev 13840)
+++ CalendarServer/trunk/txdav/who/groups.py 2014-08-05 23:11:29 UTC (rev 13841)
@@ -67,7 +67,6 @@
groupCacher = getattr(self.transaction, "_groupCacher", None)
if groupCacher is not None:
- # New implementation
try:
yield groupCacher.update(self.transaction)
except Exception, e:
Modified: CalendarServer/trunk/txdav/who/util.py
===================================================================
--- CalendarServer/trunk/txdav/who/util.py 2014-08-05 22:49:28 UTC (rev 13840)
+++ CalendarServer/trunk/txdav/who/util.py 2014-08-05 23:11:29 UTC (rev 13841)
@@ -23,9 +23,9 @@
FieldName as BaseFieldName, RecordType, DirectoryConfigurationError
)
from twext.who.ldap import (
- DirectoryService as LDAPDirectoryService, LDAPAttribute,
+ DirectoryService as LDAPDirectoryService,
FieldName as LDAPFieldName,
- RecordTypeSchema, LDAPObjectClass
+ RecordTypeSchema
)
from twext.who.util import ConstantsContainer
from twisted.cred.credentials import UsernamePassword
@@ -131,62 +131,40 @@
)
else:
creds = None
+ mapping = params.mapping
directory = LDAPDirectoryService(
params.uri,
params.rdnSchema.base,
credentials=creds,
fieldNameToAttributesMap=MappingProxyType({
- 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,),
- LDAPFieldName.memberDNs: (LDAPAttribute.uniqueMember.value,),
+ BaseFieldName.uid: mapping.uid,
+ BaseFieldName.guid: mapping.guid,
+ BaseFieldName.shortNames: mapping.shortNames,
+ BaseFieldName.fullNames: mapping.fullNames,
+ BaseFieldName.emailAddresses: mapping.emailAddresses,
+ LDAPFieldName.memberDNs: mapping.memberDNs,
}),
recordTypeSchemas=MappingProxyType({
RecordType.user: RecordTypeSchema(
- relativeDN=u"ou=People",
-
- # (objectClass=inetOrgPerson)
- attributes=(
- (
- LDAPAttribute.objectClass.value,
- LDAPObjectClass.inetOrgPerson.value,
- ),
- ),
+ relativeDN=params.rdnSchema.users,
+ attributes=(),
),
-
RecordType.group: RecordTypeSchema(
- relativeDN=u"ou=Groups",
-
- # (objectClass=groupOfNames)
- attributes=(
- (
- LDAPAttribute.objectClass.value,
- LDAPObjectClass.groupOfUniqueNames.value,
- ),
- ),
+ relativeDN=params.rdnSchema.groups,
+ attributes=(),
),
-
CalRecordType.location: RecordTypeSchema(
- relativeDN=u"ou=places",
-
+ relativeDN=params.rdnSchema.locations,
attributes=(),
),
-
CalRecordType.resource: RecordTypeSchema(
- relativeDN=u"ou=resources",
-
+ relativeDN=params.rdnSchema.resources,
attributes=(),
),
-
CalRecordType.address: RecordTypeSchema(
- relativeDN=u"ou=buildings",
-
+ relativeDN=params.rdnSchema.addresses,
attributes=(),
),
-
})
)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20140805/2d690760/attachment-0001.html>
More information about the calendarserver-changes
mailing list