Revision: 15475 http://trac.calendarserver.org//changeset/15475 Author: sagen@apple.com Date: 2016-03-16 14:42:01 -0700 (Wed, 16 Mar 2016) Log Message: ----------- AugmentService is ever present; if you don't want to use it just feed it an empty xmlFiles list. Also, loginAllowed is mappable for LDAP Modified Paths: -------------- CalendarServer/trunk/conf/caldavd-apple.plist CalendarServer/trunk/conf/caldavd-stdconfig.plist CalendarServer/trunk/conf/caldavd-test.plist CalendarServer/trunk/twistedcaldav/stdconfig.py CalendarServer/trunk/twistedcaldav/test/test_upgrade.py CalendarServer/trunk/twistedcaldav/upgrade.py CalendarServer/trunk/txdav/who/test/test_util.py CalendarServer/trunk/txdav/who/util.py Modified: CalendarServer/trunk/conf/caldavd-apple.plist =================================================================== --- CalendarServer/trunk/conf/caldavd-apple.plist 2016-03-14 19:41:46 UTC (rev 15474) +++ CalendarServer/trunk/conf/caldavd-apple.plist 2016-03-16 21:42:01 UTC (rev 15475) @@ -230,6 +230,21 @@ </dict> </dict> + <!-- XML File Augment Service --> + <key>AugmentService</key> + <dict> + <key>type</key> + <string>xml</string> + + <key>params</key> + <dict> + <key>xmlFiles</key> + <array> + <string>augments.xml</string> + </array> + </dict> + </dict> + <key>DirectoryFilterStartsWith</key> <true/> Modified: CalendarServer/trunk/conf/caldavd-stdconfig.plist =================================================================== --- CalendarServer/trunk/conf/caldavd-stdconfig.plist 2016-03-14 19:41:46 UTC (rev 15474) +++ CalendarServer/trunk/conf/caldavd-stdconfig.plist 2016-03-16 21:42:01 UTC (rev 15475) @@ -405,9 +405,6 @@ <key>AugmentService</key> <dict> - <key>Enabled</key> - <true/> - <key>type</key> <string>xml</string> @@ -415,7 +412,6 @@ <dict> <key>xmlFiles</key> <array> - <string>augments.xml</string> </array> <key>statSeconds</key> Modified: CalendarServer/trunk/conf/caldavd-test.plist =================================================================== --- CalendarServer/trunk/conf/caldavd-test.plist 2016-03-14 19:41:46 UTC (rev 15474) +++ CalendarServer/trunk/conf/caldavd-test.plist 2016-03-16 21:42:01 UTC (rev 15475) @@ -329,8 +329,6 @@ <!-- XML File Augment Service --> <key>AugmentService</key> <dict> - <key>Enabled</key> - <true/> <key>type</key> <string>xml</string> Modified: CalendarServer/trunk/twistedcaldav/stdconfig.py =================================================================== --- CalendarServer/trunk/twistedcaldav/stdconfig.py 2016-03-14 19:41:46 UTC (rev 15474) +++ CalendarServer/trunk/twistedcaldav/stdconfig.py 2016-03-16 21:42:01 UTC (rev 15475) @@ -117,7 +117,7 @@ DEFAULT_AUGMENT_PARAMS = { "xml": { - "xmlFiles": ["augments.xml"], + "xmlFiles": [], "statSeconds": 15, }, } @@ -342,7 +342,6 @@ # Augments for the directory service records to add calendar specific attributes. # "AugmentService": { - "Enabled": True, "type": "xml", "params": DEFAULT_AUGMENT_PARAMS["xml"], }, @@ -1490,22 +1489,21 @@ def _postUpdateAugmentService(configDict, reloading=False): - if configDict.AugmentService.Enabled: - if configDict.AugmentService.type in DEFAULT_AUGMENT_PARAMS: - for param in tuple(configDict.AugmentService.params): - if param not in DEFAULT_AUGMENT_PARAMS[configDict.AugmentService.type]: - log.warn("Parameter {p} is not supported by service {t}", p=param, t=configDict.AugmentService.type) - del configDict.AugmentService.params[param] + if configDict.AugmentService.type in DEFAULT_AUGMENT_PARAMS: + for param in tuple(configDict.AugmentService.params): + if param not in DEFAULT_AUGMENT_PARAMS[configDict.AugmentService.type]: + log.warn("Parameter {p} is not supported by service {t}", p=param, t=configDict.AugmentService.type) + del configDict.AugmentService.params[param] - # Upgrading augments.xml must be done prior to using the store/directory - if configDict.AugmentService.type == "xml": - for fileName in configDict.AugmentService.params.xmlFiles: - if fileName[0] not in ("/", "."): - fileName = os.path.join(configDict.DataRoot, fileName) - filePath = FilePath(fileName) - if filePath.exists(): - from twistedcaldav.upgrade import upgradeAugmentsXML - upgradeAugmentsXML(filePath) + # Upgrading augments.xml must be done prior to using the store/directory + if configDict.AugmentService.type == "xml": + for fileName in configDict.AugmentService.params.xmlFiles: + if fileName[0] not in ("/", "."): + fileName = os.path.join(configDict.DataRoot, fileName) + filePath = FilePath(fileName) + if filePath.exists(): + from twistedcaldav.upgrade import upgradeAugmentsXML + upgradeAugmentsXML(filePath) Modified: CalendarServer/trunk/twistedcaldav/test/test_upgrade.py =================================================================== --- CalendarServer/trunk/twistedcaldav/test/test_upgrade.py 2016-03-14 19:41:46 UTC (rev 15474) +++ CalendarServer/trunk/twistedcaldav/test/test_upgrade.py 2016-03-16 21:42:01 UTC (rev 15475) @@ -1511,6 +1511,7 @@ @inlineCallbacks def test_migrateAutoSchedule(self): + self.patch(config.AugmentService, "params", {"xmlFiles":["augments.xml"]}) serviceClass = { "xml": "twistedcaldav.directory.augment.AugmentXMLDB", } Modified: CalendarServer/trunk/twistedcaldav/upgrade.py =================================================================== --- CalendarServer/trunk/twistedcaldav/upgrade.py 2016-03-14 19:41:46 UTC (rev 15474) +++ CalendarServer/trunk/twistedcaldav/upgrade.py 2016-03-16 21:42:01 UTC (rev 15475) @@ -991,15 +991,14 @@ # Fetch the autoSchedule assignments from resourceinfo.sqlite and store # the values in augments augmentService = None - if config.AugmentService.Enabled: - serviceClass = { - "xml": "twistedcaldav.directory.augment.AugmentXMLDB", - } - augmentClass = namedClass(serviceClass[config.AugmentService.type]) - try: - augmentService = augmentClass(**config.AugmentService.params) - except: - log.error("Could not start augment service") + serviceClass = { + "xml": "twistedcaldav.directory.augment.AugmentXMLDB", + } + augmentClass = namedClass(serviceClass[config.AugmentService.type]) + try: + augmentService = augmentClass(**config.AugmentService.params) + except: + log.error("Could not start augment service") if augmentService: augmentRecords = [] Modified: CalendarServer/trunk/txdav/who/test/test_util.py =================================================================== --- CalendarServer/trunk/txdav/who/test/test_util.py 2016-03-14 19:41:46 UTC (rev 15474) +++ CalendarServer/trunk/txdav/who/test/test_util.py 2016-03-16 21:42:01 UTC (rev 15475) @@ -99,7 +99,6 @@ }, }, "AugmentService": { - "Enabled": True, "type": "xml", "params": { "xmlFiles": ["augments.xml"], Modified: CalendarServer/trunk/txdav/who/util.py =================================================================== --- CalendarServer/trunk/txdav/who/util.py 2016-03-14 19:41:46 UTC (rev 15474) +++ CalendarServer/trunk/txdav/who/util.py 2016-03-16 21:42:01 UTC (rev 15475) @@ -154,6 +154,7 @@ LDAPFieldName.memberDNs: mapping.memberDNs, CalFieldName.readOnlyProxy: mapping.readOnlyProxy, CalFieldName.readWriteProxy: mapping.readWriteProxy, + CalFieldName.loginAllowed: mapping.loginAllowed, CalFieldName.hasCalendars: mapping.hasCalendars, CalFieldName.autoScheduleMode: mapping.autoScheduleMode, CalFieldName.autoAcceptGroup: mapping.autoAcceptGroup, @@ -240,29 +241,26 @@ # # Setup the Augment Service # - if augmentServiceInfo.Enabled: - serviceClass = { - "xml": "twistedcaldav.directory.augment.AugmentXMLDB", - } + serviceClass = { + "xml": "twistedcaldav.directory.augment.AugmentXMLDB", + } - for augmentFile in augmentServiceInfo.params.xmlFiles: - augmentFile = fullServerPath(dataRoot, augmentFile) - augmentFilePath = FilePath(augmentFile) - if not augmentFilePath.exists(): - augmentFilePath.setContent(DEFAULT_AUGMENT_CONTENT) + for augmentFile in augmentServiceInfo.params.xmlFiles: + augmentFile = fullServerPath(dataRoot, augmentFile) + augmentFilePath = FilePath(augmentFile) + if not augmentFilePath.exists(): + augmentFilePath.setContent(DEFAULT_AUGMENT_CONTENT) - augmentClass = namedClass(serviceClass[augmentServiceInfo.type]) - log.info( - "Configuring augment service of type: {augmentClass}", - augmentClass=augmentClass - ) - try: - augmentService = augmentClass(**augmentServiceInfo.params) - except IOError: - log.error("Could not start augment service") - raise - else: - augmentService = None + augmentClass = namedClass(serviceClass[augmentServiceInfo.type]) + log.info( + "Configuring augment service of type: {augmentClass}", + augmentClass=augmentClass + ) + try: + augmentService = augmentClass(**augmentServiceInfo.params) + except IOError: + log.error("Could not start augment service") + raise userDirectory = None for directory in aggregatedServices:
participants (1)
-
source_changes@macosforge.org