[CalendarServer-changes] [6180] CalendarServer/trunk
source_changes at macosforge.org
source_changes at macosforge.org
Wed Aug 25 13:28:58 PDT 2010
Revision: 6180
http://trac.macosforge.org/projects/calendarserver/changeset/6180
Author: sagen at apple.com
Date: 2010-08-25 13:28:57 -0700 (Wed, 25 Aug 2010)
Log Message:
-----------
Use system-wide realm when available, in order to obviate the need to store recoverable passwords.
Modified Paths:
--------------
CalendarServer/trunk/calendarserver/tap/util.py
CalendarServer/trunk/twistedcaldav/directory/aggregate.py
CalendarServer/trunk/twistedcaldav/directory/directory.py
CalendarServer/trunk/twistedcaldav/directory/idirectory.py
CalendarServer/trunk/twistedcaldav/directory/test/test_aggregate.py
Modified: CalendarServer/trunk/calendarserver/tap/util.py
===================================================================
--- CalendarServer/trunk/calendarserver/tap/util.py 2010-08-25 19:15:19 UTC (rev 6179)
+++ CalendarServer/trunk/calendarserver/tap/util.py 2010-08-25 20:28:57 UTC (rev 6180)
@@ -174,7 +174,18 @@
directory.userRecordTypes.insert(0,
SudoDirectoryService.recordType_sudoers)
+
#
+ # Use system-wide realm on OSX
+ #
+ try:
+ import ServerFoundation
+ realmName = ServerFoundation.XSAuthenticator.defaultRealm().encode("utf-8")
+ directory.setRealm(realmName)
+ except ImportError:
+ pass
+
+ #
# Setup the Augment Service
#
augmentClass = namedClass(config.AugmentService.type)
Modified: CalendarServer/trunk/twistedcaldav/directory/aggregate.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/directory/aggregate.py 2010-08-25 19:15:19 UTC (rev 6179)
+++ CalendarServer/trunk/twistedcaldav/directory/aggregate.py 2010-08-25 20:28:57 UTC (rev 6180)
@@ -236,6 +236,14 @@
service = self.serviceForRecordType(recordType)
return service.destroyRecord(recordType, guid=guid)
+ def setRealm(self, realmName):
+ """
+ Set a new realm name for this and nested services
+ """
+ self.realmName = realmName
+ for service in self._recordTypes.values():
+ service.setRealm(realmName)
+
class DuplicateRecordTypeError(DirectoryError):
"""
Duplicate record type.
Modified: CalendarServer/trunk/twistedcaldav/directory/directory.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/directory/directory.py 2010-08-25 19:15:19 UTC (rev 6179)
+++ CalendarServer/trunk/twistedcaldav/directory/directory.py 2010-08-25 20:28:57 UTC (rev 6180)
@@ -83,6 +83,9 @@
# Needed by twistedcaldav.directorybackedaddressbook
liveQuery = False
+ def setRealm(self, realmName):
+ self.realmName = realmName
+
def available(self):
"""
By default, the directory is available. This may return a boolean or a
Modified: CalendarServer/trunk/twistedcaldav/directory/idirectory.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/directory/idirectory.py 2010-08-25 19:15:19 UTC (rev 6179)
+++ CalendarServer/trunk/twistedcaldav/directory/idirectory.py 2010-08-25 20:28:57 UTC (rev 6180)
@@ -87,7 +87,13 @@
match the given fields.
"""
+ def setRealm(realmName):
+ """
+ Set a new realm name for this (and nested services if any)
+ @param realmName: the realm name this service should use.
+ """
+
class IDirectoryRecord(Interface):
"""
Directory Record
Modified: CalendarServer/trunk/twistedcaldav/directory/test/test_aggregate.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/directory/test/test_aggregate.py 2010-08-25 19:15:19 UTC (rev 6179)
+++ CalendarServer/trunk/twistedcaldav/directory/test/test_aggregate.py 2010-08-25 20:28:57 UTC (rev 6180)
@@ -68,3 +68,13 @@
augment.AugmentService = augment.AugmentXMLDB(xmlFiles=(augmentsFile.path,))
return AggregateDirectoryService((xmlService,))
+
+ def test_setRealm(self):
+ """
+ setRealm gets propagated to nested services
+ """
+ aggregatedService = self.service()
+ aggregatedService.setRealm("foo.example.com")
+ for service in aggregatedService._recordTypes.values():
+ self.assertEquals("foo.example.com", service.realmName)
+
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20100825/a57bc33b/attachment-0001.html>
More information about the calendarserver-changes
mailing list