[CalendarServer-changes] [12890] CalendarServer/branches/users/sagen/move2who-2

source_changes at macosforge.org source_changes at macosforge.org
Wed Mar 12 17:50:55 PDT 2014


Revision: 12890
          http://trac.calendarserver.org//changeset/12890
Author:   sagen at apple.com
Date:     2014-03-12 17:50:55 -0700 (Wed, 12 Mar 2014)
Log Message:
-----------
Aggregated directory services now get their recordTypes assigned from config.  Started work on locations/resources.

Modified Paths:
--------------
    CalendarServer/branches/users/sagen/move2who-2/conf/auth/resources-test.xml
    CalendarServer/branches/users/sagen/move2who-2/twistedcaldav/directory/principal.py
    CalendarServer/branches/users/sagen/move2who-2/txdav/dps/server.py
    CalendarServer/branches/users/sagen/move2who-2/txdav/who/augment.py
    CalendarServer/branches/users/sagen/move2who-2/txdav/who/directory.py

Modified: CalendarServer/branches/users/sagen/move2who-2/conf/auth/resources-test.xml
===================================================================
--- CalendarServer/branches/users/sagen/move2who-2/conf/auth/resources-test.xml	2014-03-12 21:57:40 UTC (rev 12889)
+++ CalendarServer/branches/users/sagen/move2who-2/conf/auth/resources-test.xml	2014-03-13 00:50:55 UTC (rev 12890)
@@ -1,273 +1,273 @@
-<accounts realm="Test Realm">
-  <location>
-    <uid>fantastic</uid>
-    <guid>4D66A20A-1437-437D-8069-2F14E8322234</guid>
-    <name>Fantastic Conference Room</name>
+<directory realm="Test Realm">
+  <record type="location">
+    <short-name>fantastic</short-name>
+    <uid>4D66A20A-1437-437D-8069-2F14E8322234</uid>
+    <full-name>Fantastic Conference Room</full-name>
     <extras>
       <associatedAddress>63A2F949-2D8D-4C8D-B8A5-DCF2A94610F3</associatedAddress>
     </extras>
-  </location>
-  <location>
+  </record>
+  <record type="location">
+    <short-name>jupiter</short-name>
     <uid>jupiter</uid>
-    <guid>jupiter</guid>
-    <name>Jupiter Conference Room, Building 2, 1st Floor</name>
-  </location>
-  <location>
+    <full-name>Jupiter Conference Room, Building 2, 1st Floor</full-name>
+  </record>
+  <record type="location">
+    <short-name>uranus</short-name>
     <uid>uranus</uid>
-    <guid>uranus</guid>
-    <name>Uranus Conference Room, Building 3, 1st Floor</name>
-  </location>
-  <location>
-    <uid>morgensroom</uid>
-    <guid>03DFF660-8BCC-4198-8588-DD77F776F518</guid>
-    <name>Morgen's Room</name>
-  </location>
-  <location>
+    <full-name>Uranus Conference Room, Building 3, 1st Floor</full-name>
+  </record>
+  <record type="location">
+    <short-name>morgensroom</short-name>
+    <uid>03DFF660-8BCC-4198-8588-DD77F776F518</uid>
+    <full-name>Morgen's Room</full-name>
+  </record>
+  <record type="location">
+    <short-name>mercury</short-name>
     <uid>mercury</uid>
-    <guid>mercury</guid>
-    <name>Mercury Conference Room, Building 1, 2nd Floor</name>
-  </location>
-  <location>
+    <full-name>Mercury Conference Room, Building 1, 2nd Floor</full-name>
+  </record>
+  <record type="location">
+    <short-name>location09</short-name>
     <uid>location09</uid>
-    <guid>location09</guid>
-    <name>Room 09</name>
-  </location>
-  <location>
+    <full-name>Room 09</full-name>
+  </record>
+  <record type="location">
+    <short-name>location08</short-name>
     <uid>location08</uid>
-    <guid>location08</guid>
-    <name>Room 08</name>
-  </location>
-  <location>
+    <full-name>Room 08</full-name>
+  </record>
+  <record type="location">
+    <short-name>location07</short-name>
     <uid>location07</uid>
-    <guid>location07</guid>
-    <name>Room 07</name>
-  </location>
-  <location>
+    <full-name>Room 07</full-name>
+  </record>
+  <record type="location">
+    <short-name>location06</short-name>
     <uid>location06</uid>
-    <guid>location06</guid>
-    <name>Room 06</name>
-  </location>
-  <location>
+    <full-name>Room 06</full-name>
+  </record>
+  <record type="location">
+    <short-name>location05</short-name>
     <uid>location05</uid>
-    <guid>location05</guid>
-    <name>Room 05</name>
-  </location>
-  <location>
+    <full-name>Room 05</full-name>
+  </record>
+  <record type="location">
+    <short-name>location04</short-name>
     <uid>location04</uid>
-    <guid>location04</guid>
-    <name>Room 04</name>
-  </location>
-  <location>
+    <full-name>Room 04</full-name>
+  </record>
+  <record type="location">
+    <short-name>location03</short-name>
     <uid>location03</uid>
-    <guid>location03</guid>
-    <name>Room 03</name>
-  </location>
-  <location>
+    <full-name>Room 03</full-name>
+  </record>
+  <record type="location">
+    <short-name>location02</short-name>
     <uid>location02</uid>
-    <guid>location02</guid>
-    <name>Room 02</name>
-  </location>
-  <location>
+    <full-name>Room 02</full-name>
+  </record>
+  <record type="location">
+    <short-name>location01</short-name>
     <uid>location01</uid>
-    <guid>location01</guid>
-    <name>Room 01</name>
-  </location>
-  <location>
+    <full-name>Room 01</full-name>
+  </record>
+  <record type="location">
+    <short-name>delegatedroom</short-name>
     <uid>delegatedroom</uid>
-    <guid>delegatedroom</guid>
-    <name>Delegated Conference Room</name>
-  </location>
-  <location>
-    <uid>mars</uid>
-    <guid>redplanet</guid>
-    <name>Mars Conference Room, Building 1, 1st Floor</name>
-  </location>
-  <location>
-    <uid>sharissroom</uid>
-    <guid>80689D41-DAF8-4189-909C-DB017B271892</guid>
-    <name>Shari's Room</name>
+    <full-name>Delegated Conference Room</full-name>
+  </record>
+  <record type="location">
+    <short-name>mars</short-name>
+    <uid>redplanet</uid>
+    <full-name>Mars Conference Room, Building 1, 1st Floor</full-name>
+  </record>
+  <record type="location">
+    <short-name>sharissroom</short-name>
+    <uid>80689D41-DAF8-4189-909C-DB017B271892</uid>
+    <full-name>Shari's Room</full-name>
     <extras>
       <associatedAddress>6F9EE33B-78F6-481B-9289-3D0812FF0D64</associatedAddress>
     </extras>
-  </location>
-  <location>
+  </record>
+  <record type="location">
+    <short-name>pluto</short-name>
     <uid>pluto</uid>
-    <guid>pluto</guid>
-    <name>Pluto Conference Room, Building 2, 1st Floor</name>
-  </location>
-  <location>
+    <full-name>Pluto Conference Room, Building 2, 1st Floor</full-name>
+  </record>
+  <record type="location">
+    <short-name>saturn</short-name>
     <uid>saturn</uid>
-    <guid>saturn</guid>
-    <name>Saturn Conference Room, Building 2, 1st Floor</name>
-  </location>
-  <location>
+    <full-name>Saturn Conference Room, Building 2, 1st Floor</full-name>
+  </record>
+  <record type="location">
+    <short-name>location10</short-name>
     <uid>location10</uid>
-    <guid>location10</guid>
-    <name>Room 10</name>
-  </location>
-  <location>
-    <uid>pretend</uid>
-    <guid>06E3BDCB-9C19-485A-B14E-F146A80ADDC6</guid>
-    <name>Pretend Conference Room</name>
+    <full-name>Room 10</full-name>
+  </record>
+  <record type="location">
+    <short-name>pretend</short-name>
+    <uid>06E3BDCB-9C19-485A-B14E-F146A80ADDC6</uid>
+    <full-name>Pretend Conference Room</full-name>
     <extras>
       <associatedAddress>76E7ECA6-08BC-4AE7-930D-F2E7453993A5</associatedAddress>
     </extras>
-  </location>
-  <location>
+  </record>
+  <record type="location">
+    <short-name>neptune</short-name>
     <uid>neptune</uid>
-    <guid>neptune</guid>
-    <name>Neptune Conference Room, Building 2, 1st Floor</name>
-  </location>
-  <location>
+    <full-name>Neptune Conference Room, Building 2, 1st Floor</full-name>
+  </record>
+  <record type="location">
+    <short-name>Earth</short-name>
     <uid>Earth</uid>
-    <guid>Earth</guid>
-    <name>Earth Conference Room, Building 1, 1st Floor</name>
-  </location>
-  <location>
+    <full-name>Earth Conference Room, Building 1, 1st Floor</full-name>
+  </record>
+  <record type="location">
+    <short-name>venus</short-name>
     <uid>venus</uid>
-    <guid>venus</guid>
-    <name>Venus Conference Room, Building 1, 2nd Floor</name>
-  </location>
-  <resource>
-    <uid>sharisotherresource</uid>
-    <guid>CCE95217-A57B-481A-AC3D-FEC9AB6CE3A9</guid>
-    <name>Shari's Other Resource</name>
-  </resource>
-  <resource>
+    <full-name>Venus Conference Room, Building 1, 2nd Floor</full-name>
+  </record>
+  <record type="resource">
+    <short-name>sharisotherresource</short-name>
+    <uid>CCE95217-A57B-481A-AC3D-FEC9AB6CE3A9</uid>
+    <full-name>Shari's Other Resource</full-name>
+  </record>
+  <record type="resource">
+    <short-name>resource15</short-name>
     <uid>resource15</uid>
-    <guid>resource15</guid>
-    <name>Resource 15</name>
-  </resource>
-  <resource>
+    <full-name>Resource 15</full-name>
+  </record>
+  <record type="resource">
+    <short-name>resource14</short-name>
     <uid>resource14</uid>
-    <guid>resource14</guid>
-    <name>Resource 14</name>
-  </resource>
-  <resource>
+    <full-name>Resource 14</full-name>
+  </record>
+  <record type="resource">
+    <short-name>resource17</short-name>
     <uid>resource17</uid>
-    <guid>resource17</guid>
-    <name>Resource 17</name>
-  </resource>
-  <resource>
+    <full-name>Resource 17</full-name>
+  </record>
+  <record type="resource">
+    <short-name>resource16</short-name>
     <uid>resource16</uid>
-    <guid>resource16</guid>
-    <name>Resource 16</name>
-  </resource>
-  <resource>
+    <full-name>Resource 16</full-name>
+  </record>
+  <record type="resource">
+    <short-name>resource11</short-name>
     <uid>resource11</uid>
-    <guid>resource11</guid>
-    <name>Resource 11</name>
-  </resource>
-  <resource>
+    <full-name>Resource 11</full-name>
+  </record>
+  <record type="resource">
+    <short-name>resource10</short-name>
     <uid>resource10</uid>
-    <guid>resource10</guid>
-    <name>Resource 10</name>
-  </resource>
-  <resource>
+    <full-name>Resource 10</full-name>
+  </record>
+  <record type="resource">
+    <short-name>resource13</short-name>
     <uid>resource13</uid>
-    <guid>resource13</guid>
-    <name>Resource 13</name>
-  </resource>
-  <resource>
+    <full-name>Resource 13</full-name>
+  </record>
+  <record type="resource">
+    <short-name>resource12</short-name>
     <uid>resource12</uid>
-    <guid>resource12</guid>
-    <name>Resource 12</name>
-  </resource>
-  <resource>
+    <full-name>Resource 12</full-name>
+  </record>
+  <record type="resource">
+    <short-name>resource19</short-name>
     <uid>resource19</uid>
-    <guid>resource19</guid>
-    <name>Resource 19</name>
-  </resource>
-  <resource>
+    <full-name>Resource 19</full-name>
+  </record>
+  <record type="resource">
+    <short-name>resource18</short-name>
     <uid>resource18</uid>
-    <guid>resource18</guid>
-    <name>Resource 18</name>
-  </resource>
-  <resource>
-    <uid>sharisresource</uid>
-    <guid>C38BEE7A-36EE-478C-9DCB-CBF4612AFE65</guid>
-    <name>Shari's Resource</name>
-  </resource>
-  <resource>
+    <full-name>Resource 18</full-name>
+  </record>
+  <record type="resource">
+    <short-name>sharisresource</short-name>
+    <uid>C38BEE7A-36EE-478C-9DCB-CBF4612AFE65</uid>
+    <full-name>Shari's Resource</full-name>
+  </record>
+  <record type="resource">
+    <short-name>resource20</short-name>
     <uid>resource20</uid>
-    <guid>resource20</guid>
-    <name>Resource 20</name>
-  </resource>
-  <resource>
+    <full-name>Resource 20</full-name>
+  </record>
+  <record type="resource">
+    <short-name>resource06</short-name>
     <uid>resource06</uid>
-    <guid>resource06</guid>
-    <name>Resource 06</name>
-  </resource>
-  <resource>
+    <full-name>Resource 06</full-name>
+  </record>
+  <record type="resource">
+    <short-name>resource07</short-name>
     <uid>resource07</uid>
-    <guid>resource07</guid>
-    <name>Resource 07</name>
-  </resource>
-  <resource>
+    <full-name>Resource 07</full-name>
+  </record>
+  <record type="resource">
+    <short-name>resource04</short-name>
     <uid>resource04</uid>
-    <guid>resource04</guid>
-    <name>Resource 04</name>
-  </resource>
-  <resource>
+    <full-name>Resource 04</full-name>
+  </record>
+  <record type="resource">
+    <short-name>resource05</short-name>
     <uid>resource05</uid>
-    <guid>resource05</guid>
-    <name>Resource 05</name>
-  </resource>
-  <resource>
+    <full-name>Resource 05</full-name>
+  </record>
+  <record type="resource">
+    <short-name>resource02</short-name>
     <uid>resource02</uid>
-    <guid>resource02</guid>
-    <name>Resource 02</name>
-  </resource>
-  <resource>
+    <full-name>Resource 02</full-name>
+  </record>
+  <record type="resource">
+    <short-name>resource03</short-name>
     <uid>resource03</uid>
-    <guid>resource03</guid>
-    <name>Resource 03</name>
-  </resource>
-  <resource>
+    <full-name>Resource 03</full-name>
+  </record>
+  <record type="resource">
+    <short-name>resource01</short-name>
     <uid>resource01</uid>
-    <guid>resource01</guid>
-    <name>Resource 01</name>
-  </resource>
-  <resource>
-    <uid>sharisotherresource1</uid>
-    <guid>0CE0BF31-5F9E-4801-A489-8C70CF287F5F</guid>
-    <name>Shari's Other Resource1</name>
-  </resource>
-  <resource>
+    <full-name>Resource 01</full-name>
+  </record>
+  <record type="resource">
+    <short-name>sharisotherresource1</short-name>
+    <uid>0CE0BF31-5F9E-4801-A489-8C70CF287F5F</uid>
+    <full-name>Shari's Other Resource1</full-name>
+  </record>
+  <record type="resource">
+    <short-name>resource08</short-name>
     <uid>resource08</uid>
-    <guid>resource08</guid>
-    <name>Resource 08</name>
-  </resource>
-  <resource>
+    <full-name>Resource 08</full-name>
+  </record>
+  <record type="resource">
+    <short-name>resource09</short-name>
     <uid>resource09</uid>
-    <guid>resource09</guid>
-    <name>Resource 09</name>
-  </resource>
-  <address>
-    <uid>testaddress1</uid>
-    <guid>6F9EE33B-78F6-481B-9289-3D0812FF0D64</guid>
-    <name>Test Address One</name>
+    <full-name>Resource 09</full-name>
+  </record>
+  <record type="address">
+    <short-name>testaddress1</short-name>
+    <uid>6F9EE33B-78F6-481B-9289-3D0812FF0D64</uid>
+    <full-name>Test Address One</full-name>
     <extras>
       <streetAddress>20300 Stevens Creek Blvd, Cupertino, CA 95014</streetAddress>
       <geo>37.322281,-122.028345</geo>
     </extras>
-  </address>
-  <address>
-    <uid>il2</uid>
-    <guid>63A2F949-2D8D-4C8D-B8A5-DCF2A94610F3</guid>
-    <name>IL2</name>
+  </record>
+  <record type="address">
+    <short-name>il2</short-name>
+    <uid>63A2F949-2D8D-4C8D-B8A5-DCF2A94610F3</uid>
+    <full-name>IL2</full-name>
     <extras>
       <streetAddress>2 Infinite Loop, Cupertino, CA 95014</streetAddress>
       <geo>37.332633,-122.030502</geo>
     </extras>
-  </address>
-  <address>
-    <uid>il1</uid>
-    <guid>76E7ECA6-08BC-4AE7-930D-F2E7453993A5</guid>
-    <name>IL1</name>
+  </record>
+  <record type="address">
+    <short-name>il1</short-name>
+    <uid>76E7ECA6-08BC-4AE7-930D-F2E7453993A5</uid>
+    <full-name>IL1</full-name>
     <extras>
       <streetAddress>1 Infinite Loop, Cupertino, CA 95014</streetAddress>
       <geo>37.331741,-122.030333</geo>
     </extras>
-  </address>
-</accounts>
+  </record>
+</directory>

Modified: CalendarServer/branches/users/sagen/move2who-2/twistedcaldav/directory/principal.py
===================================================================
--- CalendarServer/branches/users/sagen/move2who-2/twistedcaldav/directory/principal.py	2014-03-12 21:57:40 UTC (rev 12889)
+++ CalendarServer/branches/users/sagen/move2who-2/twistedcaldav/directory/principal.py	2014-03-13 00:50:55 UTC (rev 12890)
@@ -486,17 +486,19 @@
             return self.principalForShortName(self.recordType, name)
 
 
+    @inlineCallbacks
     def listChildren(self):
+        children = []
         if config.EnablePrincipalListings:
+            try:
+                for record in (yield self.directory.listRecords(self.recordType)):
+                    for shortName in record.shortNames:
+                        children.append(shortName)
+            except AttributeError:
+                log.warn("Cannot list children of record type {rt}",
+                         rt=self.recordType.name)
+            returnValue(children)
 
-
-            def _recordShortnameExpand():
-                for record in self.directory.listRecords(self.recordType):
-                    if record.enabled:
-                        for shortName in record.shortNames:
-                            yield shortName
-
-            return _recordShortnameExpand()
         else:
             # Not a listable collection
             raise HTTPError(responsecode.FORBIDDEN)

Modified: CalendarServer/branches/users/sagen/move2who-2/txdav/dps/server.py
===================================================================
--- CalendarServer/branches/users/sagen/move2who-2/txdav/dps/server.py	2014-03-12 21:57:40 UTC (rev 12889)
+++ CalendarServer/branches/users/sagen/move2who-2/txdav/dps/server.py	2014-03-13 00:50:55 UTC (rev 12890)
@@ -24,6 +24,7 @@
 from twext.who.expression import MatchType, MatchFlags, Operand
 from twext.who.idirectory import RecordType, DirectoryConfigurationError
 from twext.who.ldap import DirectoryService as LDAPDirectoryService
+from twext.who.util import ConstantsContainer
 from twisted.application import service
 from twisted.application.strports import service as strPortsService
 from twisted.cred.credentials import UsernamePassword
@@ -47,6 +48,7 @@
 )
 from txdav.who.augment import AugmentedDirectoryService
 from txdav.who.delegates import DirectoryService as DelegateDirectoryService
+from txdav.who.idirectory import RecordType as CalRecordType
 from txdav.who.xml import DirectoryService as XMLDirectoryService
 from zope.interface import implementer
 
@@ -461,45 +463,63 @@
     if store is None:
         store = storeFromConfig(config, txnFactory, None)
 
-    directoryType = config.DirectoryService.type.lower()
+    aggregatedServices = []
 
-    # MOVE2WHO FIXME:
-    # Set the appropriate record types on each service
+    for serviceKey in ("DirectoryService", "ResourceService"):
+        serviceValue = config.get(serviceKey, None)
+        directoryType = serviceValue.type.lower()
+        params = serviceValue.params
 
-    if "xml" in directoryType:
-        xmlFile = config.DirectoryService.params.xmlFile
-        xmlFile = fullServerPath(config.DataRoot, xmlFile)
-        # path = kwds.pop("path", "")
-        if not xmlFile or not os.path.exists(xmlFile):
-            log.error("Path not found for XML directory: {p}", p=xmlFile)
-        fp = FilePath(xmlFile)
-        primaryDirectory = XMLDirectoryService(fp)
-        log.debug(
-            "Using XML for {types}",
-            types=(", ".join([rt.name for rt in primaryDirectory.recordTypes()]))
-        )
+        if "xml" in directoryType:
+            xmlFile = params.xmlFile
+            xmlFile = fullServerPath(config.DataRoot, xmlFile)
+            # path = kwds.pop("path", "")
+            if not xmlFile or not os.path.exists(xmlFile):
+                log.error("Path not found for XML directory: {p}", p=xmlFile)
+            fp = FilePath(xmlFile)
+            directory = XMLDirectoryService(fp)
 
-    elif "opendirectory" in directoryType:
-        from twext.who.opendirectory import DirectoryService as ODDirectoryService
-        primaryDirectory = ODDirectoryService()
+        elif "opendirectory" in directoryType:
+            from twext.who.opendirectory import DirectoryService as ODDirectoryService
+            directory = ODDirectoryService()
 
-    elif "ldap" in directoryType:
-        params = config.DirectoryService.params
-        if params.credentials.dn and params.credentials.password:
-            creds = UsernamePassword(params.credentials.dn,
-                                     params.credentials.password)
+        elif "ldap" in directoryType:
+            if params.credentials.dn and params.credentials.password:
+                creds = UsernamePassword(params.credentials.dn,
+                                         params.credentials.password)
+            else:
+                creds = None
+            directory = LDAPDirectoryService(
+                params.uri,
+                params.rdnSchema.base,
+                creds=creds
+            )
+
         else:
-            creds = None
-        primaryDirectory = LDAPDirectoryService(
-            params.uri,
-            params.rdnSchema.base,
-            creds=creds
-        )
+            log.error("Invalid DirectoryType: {dt}", dt=directoryType)
+            raise DirectoryConfigurationError
 
-    else:
-        log.error("Invalid DirectoryType: {dt}", dt=directoryType)
-        raise DirectoryConfigurationError
+        # Set the appropriate record types on each service
+        types = []
+        for recordTypeName in params.recordTypes:
+            recordType = {
+                "users": RecordType.user,
+                "groups": RecordType.group,
+                "locations": CalRecordType.location,
+                "resources": CalRecordType.resource,
+                "addresses": CalRecordType.address,
+            }.get(recordTypeName, None)
+            if recordType is None:
+                log.error("Invalid Record Type: {rt}", rt=recordTypeName)
+                raise DirectoryConfigurationError
+            if recordType in types:
+                log.error("Duplicate Record Type: {rt}", rt=recordTypeName)
+                raise DirectoryConfigurationError
+            types.append(recordType)
 
+        directory.recordType = ConstantsContainer(types)
+        aggregatedServices.append(directory)
+
     #
     # Setup the Augment Service
     #
@@ -517,14 +537,23 @@
     else:
         augmentService = None
 
+    userDirectory = None
+    for directory in aggregatedServices:
+        if RecordType.user in directory.recordTypes():
+            userDirectory = directory
+            break
+    else:
+        log.error("No directory service set up for users")
+        raise DirectoryConfigurationError
+
     delegateDirectory = DelegateDirectoryService(
-        primaryDirectory.realmName,
+        userDirectory.realmName,
         store
     )
+    aggregatedServices.append(delegateDirectory)
 
     aggregateDirectory = AggregateDirectoryService(
-        primaryDirectory.realmName,
-        (primaryDirectory, delegateDirectory)
+        userDirectory.realmName, aggregatedServices
     )
     try:
         augmented = AugmentedDirectoryService(
@@ -543,6 +572,7 @@
     return augmented
 
 
+
 @implementer(IPlugin, service.IServiceMaker)
 class DirectoryProxyServiceMaker(object):
 

Modified: CalendarServer/branches/users/sagen/move2who-2/txdav/who/augment.py
===================================================================
--- CalendarServer/branches/users/sagen/move2who-2/txdav/who/augment.py	2014-03-12 21:57:40 UTC (rev 12889)
+++ CalendarServer/branches/users/sagen/move2who-2/txdav/who/augment.py	2014-03-13 00:50:55 UTC (rev 12890)
@@ -26,12 +26,10 @@
 from twext.who.util import ConstantsContainer
 from twisted.internet.defer import inlineCallbacks, returnValue
 from txdav.common.idirectoryservice import IStoreDirectoryService
-from txdav.who.delegates import RecordType as DelegateRecordType
 from txdav.who.directory import (
     CalendarDirectoryRecordMixin, CalendarDirectoryServiceMixin
 )
 from txdav.who.idirectory import AutoScheduleMode, FieldName
-from txdav.who.idirectory import RecordType as CalRecordType
 from zope.interface import implementer
 
 
@@ -77,19 +75,15 @@
         FieldName,
     ))
 
-    recordType = ConstantsContainer((
-        RecordType.user,
-        RecordType.group,
-        CalRecordType.location,
-        CalRecordType.resource,
-        CalRecordType.address,
-        DelegateRecordType.readDelegateGroup,
-        DelegateRecordType.writeDelegateGroup,
-        DelegateRecordType.readDelegatorGroup,
-        DelegateRecordType.writeDelegatorGroup,
-    ))
 
+    @property
+    def recordType(self):
+        """
+        Defer to the directory service we're augmenting
+        """
+        return self._directory.recordType
 
+
     def __init__(self, directory, store, augmentDB):
         BaseDirectoryService.__init__(self, directory.realmName)
         self._directory = directory
@@ -192,6 +186,16 @@
 
 
     @inlineCallbacks
+    def listRecords(self, recordType):
+        records = yield self._directory.listRecords(recordType)
+        augmented = []
+        for record in records:
+            record = yield self.augment(record)
+            augmented.append(record)
+        returnValue(augmented)
+
+
+    @inlineCallbacks
     def updateRecords(self, records, create=False):
         return self._directory.updateRecords(records, create=create)
 

Modified: CalendarServer/branches/users/sagen/move2who-2/txdav/who/directory.py
===================================================================
--- CalendarServer/branches/users/sagen/move2who-2/txdav/who/directory.py	2014-03-12 21:57:40 UTC (rev 12889)
+++ CalendarServer/branches/users/sagen/move2who-2/txdav/who/directory.py	2014-03-13 00:50:55 UTC (rev 12890)
@@ -275,7 +275,7 @@
             self.service.realmName,
             self.recordType.name,
             self.shortNames,
-            self.guid,
+            self.uid,
             self.hasCalendars,
         ))
 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20140312/c303cab0/attachment-0001.html>


More information about the calendarserver-changes mailing list