[CalendarServer-changes] [1058]
CalendarServer/branches/users/cdaboo/od-schema-1044/twistedcaldav/
directory/appleopendirectory.py
source_changes at macosforge.org
source_changes at macosforge.org
Thu Jan 18 08:57:31 PST 2007
Revision: 1058
http://trac.macosforge.org/projects/calendarserver/changeset/1058
Author: cdaboo at apple.com
Date: 2007-01-18 08:57:31 -0800 (Thu, 18 Jan 2007)
Log Message:
-----------
Make sure only users who have this calendar server's service enabled are returned as valid principals.
Modified Paths:
--------------
CalendarServer/branches/users/cdaboo/od-schema-1044/twistedcaldav/directory/appleopendirectory.py
Modified: CalendarServer/branches/users/cdaboo/od-schema-1044/twistedcaldav/directory/appleopendirectory.py
===================================================================
--- CalendarServer/branches/users/cdaboo/od-schema-1044/twistedcaldav/directory/appleopendirectory.py 2007-01-18 16:52:48 UTC (rev 1057)
+++ CalendarServer/branches/users/cdaboo/od-schema-1044/twistedcaldav/directory/appleopendirectory.py 2007-01-18 16:57:31 UTC (rev 1058)
@@ -291,10 +291,15 @@
def reloadCache():
log.msg("Reloading %s record cache" % (recordType,))
+ query = {
+ dsattributes.kDSNAttrCalendarPrincipalURI: self.servicetag,
+ }
+
attrs = [
dsattributes.kDS1AttrGeneratedUID,
dsattributes.kDS1AttrDistinguishedName,
dsattributes.kDSNAttrEMailAddress,
+ dsattributes.kDSNAttrCalendarPrincipalURI,
]
if recordType == DirectoryService.recordType_users:
@@ -312,12 +317,33 @@
records = {}
try:
- results = opendirectory.listAllRecordsWithAttributes(self.directory, listRecordType, attrs)
+ results = opendirectory.queryRecordsWithAttributes(
+ self.directory,
+ query,
+ dsattributes.eDSStartsWith,
+ False,
+ False,
+ listRecordType,
+ attrs)
except opendirectory.ODError, ex:
log.msg("Open Directory (node=%s) error: %s" % (self.realmName, str(ex)))
raise
for (key, value) in results.iteritems():
+ # Make sure this user has service enabled.
+ enabled = True
+ service = value.get(dsattributes.kDSNAttrCalendarPrincipalURI)
+ if isinstance(service, str):
+ service = [service]
+ for item in service:
+ if item.startswith(self.servicetag):
+ if item.endswith(":disabled"):
+ enabled = False
+ break
+ if not enabled:
+ continue
+
+ # Now get useful record info.
shortName = key
guid = value.get(dsattributes.kDS1AttrGeneratedUID)
if not guid:
@@ -327,6 +353,7 @@
# Get calendar user addresses expanded from service record templates.
cuaddrset = self._templateExpandCalendarUserAddresses(recordType, key, value)
+ # Special case for groups.
if recordType == DirectoryService.recordType_groups:
memberGUIDs = value.get(dsattributes.kDSNAttrGroupMembers)
if memberGUIDs is None:
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20070118/026b45be/attachment.html
More information about the calendarserver-changes
mailing list