[CalendarServer-changes] [5043] CalendarServer/branches/users/sagen/locations-resources
source_changes at macosforge.org
source_changes at macosforge.org
Thu Feb 4 11:52:36 PST 2010
Revision: 5043
http://trac.macosforge.org/projects/calendarserver/changeset/5043
Author: sagen at apple.com
Date: 2010-02-04 11:52:33 -0800 (Thu, 04 Feb 2010)
Log Message:
-----------
A supplemental directory service for a subset of recordTypes can now be configured, allowing -- for example -- users and groups records to come from OD while locations and resources come from XML.
Modified Paths:
--------------
CalendarServer/branches/users/sagen/locations-resources/calendarserver/tap/caldav.py
CalendarServer/branches/users/sagen/locations-resources/calendarserver/tools/util.py
CalendarServer/branches/users/sagen/locations-resources/twistedcaldav/directory/appleopendirectory.py
CalendarServer/branches/users/sagen/locations-resources/twistedcaldav/directory/principal.py
CalendarServer/branches/users/sagen/locations-resources/twistedcaldav/directory/test/test_aggregate.py
CalendarServer/branches/users/sagen/locations-resources/twistedcaldav/directory/test/test_opendirectory.py
CalendarServer/branches/users/sagen/locations-resources/twistedcaldav/directory/test/test_xmlfile.py
CalendarServer/branches/users/sagen/locations-resources/twistedcaldav/directory/xmlfile.py
CalendarServer/branches/users/sagen/locations-resources/twistedcaldav/stdconfig.py
Added Paths:
-----------
CalendarServer/branches/users/sagen/locations-resources/twistedcaldav/directory/test/resources/
CalendarServer/branches/users/sagen/locations-resources/twistedcaldav/directory/test/resources/augments.xml
CalendarServer/branches/users/sagen/locations-resources/twistedcaldav/directory/test/resources/caldavd.plist
CalendarServer/branches/users/sagen/locations-resources/twistedcaldav/directory/test/resources/resources-locations.xml
CalendarServer/branches/users/sagen/locations-resources/twistedcaldav/directory/test/resources/users-groups.xml
CalendarServer/branches/users/sagen/locations-resources/twistedcaldav/directory/test/test_resources.py
Modified: CalendarServer/branches/users/sagen/locations-resources/calendarserver/tap/caldav.py
===================================================================
--- CalendarServer/branches/users/sagen/locations-resources/calendarserver/tap/caldav.py 2010-02-04 00:20:43 UTC (rev 5042)
+++ CalendarServer/branches/users/sagen/locations-resources/calendarserver/tap/caldav.py 2010-02-04 19:52:33 UTC (rev 5043)
@@ -487,6 +487,20 @@
directories.append(baseDirectory)
+ #
+ # Setup the Locations and Resources Service
+ #
+ if config.ResourceService.Enabled:
+ resourceClass = namedClass(config.ResourceService.type)
+
+ self.log_info("Configuring resource service of type: %s" % (resourceClass,))
+
+ resourceDirectory = resourceClass(**config.ResourceService.params)
+ directories.append(resourceDirectory)
+
+ #
+ # Add sudoers directory
+ #
sudoDirectory = None
if config.SudoersFile and os.path.exists(config.SudoersFile):
Modified: CalendarServer/branches/users/sagen/locations-resources/calendarserver/tools/util.py
===================================================================
--- CalendarServer/branches/users/sagen/locations-resources/calendarserver/tools/util.py 2010-02-04 00:20:43 UTC (rev 5042)
+++ CalendarServer/branches/users/sagen/locations-resources/calendarserver/tools/util.py 2010-02-04 19:52:33 UTC (rev 5043)
@@ -32,7 +32,9 @@
from twistedcaldav.directory import augment, calendaruserproxy
from twistedcaldav.directory.directory import DirectoryService, DirectoryRecord
from twistedcaldav.stdconfig import DEFAULT_CONFIG_FILE
+from twistedcaldav.directory.aggregate import AggregateDirectoryService
+
def loadConfig(configFileName):
if configFileName is None:
configFileName = DEFAULT_CONFIG_FILE
@@ -101,6 +103,13 @@
while not directory.isAvailable():
sleep(5)
+
+ if config.ResourceService.Enabled:
+ resourceClass = namedClass(config.ResourceService.type)
+ resourceDirectory = resourceClass(config.ResourceService.params)
+ directories = (directory, resourceDirectory)
+ directory = AggregateDirectoryService(directories)
+
return directory
class DummyDirectoryService (DirectoryService):
Modified: CalendarServer/branches/users/sagen/locations-resources/twistedcaldav/directory/appleopendirectory.py
===================================================================
--- CalendarServer/branches/users/sagen/locations-resources/twistedcaldav/directory/appleopendirectory.py 2010-02-04 00:20:43 UTC (rev 5042)
+++ CalendarServer/branches/users/sagen/locations-resources/twistedcaldav/directory/appleopendirectory.py 2010-02-04 19:52:33 UTC (rev 5043)
@@ -64,6 +64,12 @@
defaults = {
'node' : '/Search',
'cacheTimeout' : 30,
+ 'recordTypes' : (
+ self.recordType_users,
+ self.recordType_groups,
+ self.recordType_locations,
+ self.recordType_resources,
+ ),
}
ignored = (
'requireComputerRecord',
@@ -72,6 +78,8 @@
)
params = self.getParams(params, defaults, ignored)
+ self._recordTypes = params['recordTypes']
+
super(OpenDirectoryService, self).__init__(params['cacheTimeout'])
try:
@@ -161,12 +169,7 @@
yield GUID
def recordTypes(self):
- return (
- self.recordType_users,
- self.recordType_groups,
- self.recordType_locations,
- self.recordType_resources,
- )
+ return self._recordTypes
def groupsForGUID(self, guid):
Modified: CalendarServer/branches/users/sagen/locations-resources/twistedcaldav/directory/principal.py
===================================================================
--- CalendarServer/branches/users/sagen/locations-resources/twistedcaldav/directory/principal.py 2010-02-04 00:20:43 UTC (rev 5042)
+++ CalendarServer/branches/users/sagen/locations-resources/twistedcaldav/directory/principal.py 2010-02-04 19:52:33 UTC (rev 5043)
@@ -535,10 +535,11 @@
assert record is not None, "Principal must have a directory record"
- url = joinURL(parent.principalCollectionURL(), record.guid) + slash
self.record = record
self.parent = parent
+
+ url = joinURL(parent.principalCollectionURL(), self.principalUID()) + slash
self._url = url
self._alternate_urls = tuple([
Added: CalendarServer/branches/users/sagen/locations-resources/twistedcaldav/directory/test/resources/augments.xml
===================================================================
--- CalendarServer/branches/users/sagen/locations-resources/twistedcaldav/directory/test/resources/augments.xml (rev 0)
+++ CalendarServer/branches/users/sagen/locations-resources/twistedcaldav/directory/test/resources/augments.xml 2010-02-04 19:52:33 UTC (rev 5043)
@@ -0,0 +1,44 @@
+<?xml version="1.0" encoding="utf-8"?>
+
+<!--
+Copyright (c) 2009-2010 Apple Inc. All rights reserved.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+ -->
+
+<!DOCTYPE accounts SYSTEM "../../../conf/auth/augments.dtd">
+
+<augments>
+ <record>
+ <guid>user01</guid>
+ <enable>true</enable>
+ <enable-calendar>true</enable-calendar>
+ </record>
+ <record>
+ <guid>user02</guid>
+ <enable>false</enable>
+ <enable-calendar>false</enable-calendar>
+ </record>
+ <record>
+ <guid>resource01</guid>
+ <enable>true</enable>
+ <enable-calendar>true</enable-calendar>
+ <auto-schedule>true</auto-schedule>
+ </record>
+ <record>
+ <guid>resource02</guid>
+ <enable>false</enable>
+ <enable-calendar>false</enable-calendar>
+ <auto-schedule>false</auto-schedule>
+ </record>
+</augments>
Added: CalendarServer/branches/users/sagen/locations-resources/twistedcaldav/directory/test/resources/caldavd.plist
===================================================================
--- CalendarServer/branches/users/sagen/locations-resources/twistedcaldav/directory/test/resources/caldavd.plist (rev 0)
+++ CalendarServer/branches/users/sagen/locations-resources/twistedcaldav/directory/test/resources/caldavd.plist 2010-02-04 19:52:33 UTC (rev 5043)
@@ -0,0 +1,748 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+ Copyright (c) 2006-2010 Apple Inc. All rights reserved.
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ -->
+
+<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+ <dict>
+
+ <!--
+ Public network address information
+
+ This is the server's public network address, which is provided to
+ clients in URLs and the like. It may or may not be the network
+ address that the server is listening to directly, though it is by
+ default. For example, it may be the address of a load balancer or
+ proxy which forwards connections to the server.
+ -->
+
+ <!-- Network host name [empty = system host name] -->
+ <key>ServerHostName</key>
+ <string></string> <!-- The hostname clients use when connecting -->
+
+ <!-- HTTP port [0 = disable HTTP] -->
+ <key>HTTPPort</key>
+ <integer>8008</integer>
+
+ <!-- SSL port [0 = disable HTTPS] -->
+ <!-- (Must also configure SSLCertificate and SSLPrivateKey below) -->
+ <key>SSLPort</key>
+ <integer>8443</integer>
+
+ <!-- Redirect non-SSL ports to an SSL port -->
+ <key>RedirectHTTPToHTTPS</key>
+ <false/>
+
+ <!--
+ Network address configuration information
+
+ This configures the actual network address that the server binds to.
+ -->
+
+ <!-- List of IP addresses to bind to [empty = all] -->
+ <key>BindAddresses</key>
+ <array>
+ </array>
+
+ <!-- List of port numbers to bind to for HTTP [empty = same as "Port"] -->
+ <key>BindHTTPPorts</key>
+ <array>
+ </array>
+
+ <!-- List of port numbers to bind to for SSL [empty = same as "SSLPort"] -->
+ <key>BindSSLPorts</key>
+ <array>
+ </array>
+
+
+ <!--
+ Data Store
+ -->
+
+ <!-- Data root -->
+ <key>DataRoot</key>
+ <string>data/</string>
+
+ <!-- Document root -->
+ <key>DocumentRoot</key>
+ <string>twistedcaldav/test/data/</string>
+
+ <!-- Child aliases -->
+ <key>Aliases</key>
+ <dict>
+ <!--
+ <key>foo</key>
+ <dict>
+ <key>path</key>
+ <string>/path/to/foo</string>
+ </dict>
+ -->
+ </dict>
+
+ <!-- User quota (in bytes) -->
+ <key>UserQuota</key>
+ <integer>104857600</integer><!-- 100Mb -->
+
+ <!-- Attachment size limit (in bytes) -->
+ <key>MaximumAttachmentSize</key>
+ <integer>1048576</integer><!-- 1Mb -->
+
+ <!-- Maximum number of unique attendees per entire event -->
+ <!-- 0 for no limit -->
+ <key>MaxAttendeesPerInstance</key>
+ <integer>100</integer>
+
+ <!-- Maximum number of instances allowed for a single RRULE -->
+ <!-- 0 for no limit -->
+ <key>MaxInstancesForRRULE</key>
+ <integer>400</integer>
+
+
+ <!--
+ Directory service
+
+ A directory service provides information about principals (eg.
+ users, groups, locations and resources) to the server.
+
+ A variety of directory services are available for use.
+ -->
+
+ <!-- XML File Directory Service -->
+ <key>DirectoryService</key>
+ <dict>
+ <key>type</key>
+ <string>twistedcaldav.directory.xmlfile.XMLDirectoryService</string>
+
+ <key>params</key>
+ <dict>
+ <key>xmlFile</key>
+ <string>SET IN TEST</string>
+ <key>recordTypes</key>
+ <array>
+ <string>users</string>
+ <string>groups</string>
+ </array>
+ </dict>
+ </dict>
+
+ <!-- XML File Resource Service -->
+ <key>ResourceService</key>
+ <dict>
+ <key>Enabled</key>
+ <true/>
+ <key>type</key>
+ <string>twistedcaldav.directory.xmlfile.XMLDirectoryService</string>
+
+ <key>params</key>
+ <dict>
+ <key>xmlFile</key>
+ <string>SET IN TEST</string>
+ <key>recordTypes</key>
+ <array>
+ <string>resources</string>
+ <string>locations</string>
+ </array>
+ </dict>
+ </dict>
+
+ <!-- Open Directory Service (Mac OS X) -->
+ <!--
+ <key>DirectoryService</key>
+ <dict>
+ <key>type</key>
+ <string>twistedcaldav.directory.appleopendirectory.OpenDirectoryService</string>
+
+ <key>params</key>
+ <dict>
+ <key>node</key>
+ <string>/Search</string>
+ <key>cacheTimeout</key>
+ <integer>30</integer>
+ </dict>
+ </dict>
+ -->
+
+ <!--
+ Augment service
+
+ Augments for the directory service records to add calendar specific attributes.
+
+ A variety of augment services are available for use.
+ When using a partitioned server, a service that can be accessed from each host will be needed.
+ -->
+
+ <!-- XML File Augment Service -->
+ <key>AugmentService</key>
+ <dict>
+ <key>type</key>
+ <string>twistedcaldav.directory.augment.AugmentXMLDB</string>
+
+ <key>params</key>
+ <dict>
+ <key>xmlFiles</key>
+ <array>
+ <string>SET IN TEST</string>
+ </array>
+ </dict>
+ </dict>
+
+ <!-- Sqlite Augment Service -->
+ <!--
+ <key>AugmentService</key>
+ <dict>
+ <key>type</key>
+ <string>twistedcaldav.directory.augment.AugmentSqliteDB</string>
+
+ <key>params</key>
+ <dict>
+ <key>dbpath</key>
+ <string>/etc/caldavd/augments.sqlite</string>
+ </dict>
+ </dict>
+ -->
+
+ <!-- PostgreSQL Augment Service -->
+ <!--
+ <key>AugmentService</key>
+ <dict>
+ <key>type</key>
+ <string>twistedcaldav.directory.augment.AugmentPostgreSQLDB</string>
+
+ <key>params</key>
+ <dict>
+ <key>host</key>
+ <string>localhost</string>
+ <key>database</key>
+ <string>augments</string>
+ </dict>
+ </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>data/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>
+
+ <!--
+ Special principals
+
+ These principals are granted special access and/or perform
+ special roles on the server.
+ -->
+
+ <!-- Principals with "DAV:all" access (relative URLs) -->
+ <key>AdminPrincipals</key>
+ <array>
+ <string>/principals/__uids__/admin/</string>
+ </array>
+
+ <!-- Principals with "DAV:read" access (relative URLs) -->
+ <key>ReadPrincipals</key>
+ <array>
+ <!-- <string>/principals/__uids__/983C8238-FB6B-4D92-9242-89C0A39E5F81/</string> -->
+ </array>
+
+ <!-- Principals that can pose as other principals -->
+ <key>SudoersFile</key>
+ <string>conf/sudoers.plist</string>
+
+ <!-- Create "proxy access" principals -->
+ <key>EnableProxyPrincipals</key>
+ <true/>
+
+
+ <!--
+ Permissions
+ -->
+
+ <!-- Anonymous read access for root resource -->
+ <key>EnableAnonymousReadRoot</key>
+ <true/>
+
+ <!-- Anonymous read access for resource hierarchy -->
+ <key>EnableAnonymousReadNav</key>
+ <false/>
+
+ <!-- Enables directory listings for principals -->
+ <key>EnablePrincipalListings</key>
+ <true/>
+
+ <!-- Render calendar collections as a monolithic iCalendar object -->
+ <key>EnableMonolithicCalendars</key>
+ <true/>
+
+
+ <!--
+ Authentication
+ -->
+
+ <key>Authentication</key>
+ <dict>
+
+ <!-- Clear text; best avoided -->
+ <key>Basic</key>
+ <dict>
+ <key>Enabled</key>
+ <true/>
+ </dict>
+
+ <!-- Digest challenge/response -->
+ <key>Digest</key>
+ <dict>
+ <key>Enabled</key>
+ <true/>
+ <key>Algorithm</key>
+ <string>md5</string>
+ <key>Qop</key>
+ <string></string>
+ </dict>
+
+ <!-- Kerberos/SPNEGO -->
+ <key>Kerberos</key>
+ <dict>
+ <key>Enabled</key>
+ <false/>
+ <key>ServicePrincipal</key>
+ <string></string>
+ </dict>
+
+ <!-- Wikiserver authentication (Mac OS X) -->
+ <key>Wiki</key>
+ <dict>
+ <key>Enabled</key>
+ <true/>
+ <key>Cookie</key>
+ <string>sessionID</string>
+ <key>URL</key>
+ <string>http://127.0.0.1/RPC2</string>
+ <key>UserMethod</key>
+ <string>userForSession</string>
+ <key>WikiMethod</key>
+ <string>accessLevelForUserWikiCalendar</string>
+ </dict>
+
+ </dict>
+
+
+ <!--
+ Logging
+ -->
+
+ <!-- Apache-style access log -->
+ <key>AccessLogFile</key>
+ <string>logs/access.log</string>
+ <key>RotateAccessLog</key>
+ <false/>
+
+ <!-- Server activity log -->
+ <key>ErrorLogFile</key>
+ <string>logs/error.log</string>
+
+ <!-- Log levels -->
+ <key>DefaultLogLevel</key>
+ <string>info</string> <!-- debug, info, warn, error -->
+
+ <!-- Log level overrides for specific functionality -->
+ <key>LogLevels</key>
+ <dict>
+ <!--
+ <key>twistedcaldav.directory.appleopendirectory.OpenDirectoryService</key>
+ <string>debug</string>
+ -->
+ </dict>
+
+ <!-- Global server stats -->
+ <key>GlobalStatsSocket</key>
+ <string>logs/caldavd-stats.sock</string>
+
+ <!-- Global server stats logging period -->
+ <key>GlobalStatsLoggingPeriod</key>
+ <integer>60</integer>
+
+ <!-- Global server stats logging frequency [0 = disable stats] -->
+ <key>GlobalStatsLoggingFrequency</key>
+ <integer>12</integer>
+
+ <!-- Server statistics file -->
+ <key>ServerStatsFile</key>
+ <string>logs/stats.plist</string>
+
+ <!-- Server process ID file -->
+ <key>PIDFile</key>
+ <string>logs/caldavd.pid</string>
+
+
+ <!--
+ Accounting
+ -->
+
+ <!-- Enable accounting for certain operations -->
+ <key>AccountingCategories</key>
+ <dict>
+ <key>iTIP</key>
+ <false/>
+ <key>HTTP</key>
+ <false/>
+ </dict>
+ <!-- Enable accounting for specific principals -->
+ <key>AccountingPrincipals</key>
+ <array>
+ <!-- <string>/principals/__uids__/454D85C0-09F0-4DC6-A3C6-97DFEB4622CD/</string> -->
+ </array>
+
+
+ <!--
+ SSL/TLS
+ -->
+
+ <!-- Public key -->
+ <key>SSLCertificate</key>
+ <string>twistedcaldav/test/data/server.pem</string>
+
+ <!-- SSL authority chain (for intermediate certs) -->
+ <key>SSLAuthorityChain</key>
+ <string></string>
+
+ <!-- Private key -->
+ <key>SSLPrivateKey</key>
+ <string>twistedcaldav/test/data/server.pem</string>
+
+
+ <!--
+ Process management
+ -->
+
+ <key>UserName</key>
+ <string></string>
+
+ <key>GroupName</key>
+ <string></string>
+
+ <key>ProcessType</key>
+ <string>Combined</string>
+
+ <key>MultiProcess</key>
+ <dict>
+ <key>ProcessCount</key>
+ <integer>2</integer> <!-- 0 = larger of: 4 or (2 * CPU count) -->
+ </dict>
+
+
+ <!--
+ Notifications
+ -->
+
+ <key>Notifications</key>
+ <dict>
+ <!-- Time spent coalescing notifications before delivery -->
+ <key>CoalesceSeconds</key>
+ <integer>3</integer>
+
+ <key>InternalNotificationHost</key>
+ <string>localhost</string>
+
+ <key>InternalNotificationPort</key>
+ <integer>62309</integer>
+
+ <key>Services</key>
+ <dict>
+ <key>SimpleLineNotifier</key>
+ <dict>
+ <!-- Simple line notification service (for testing) -->
+ <key>Service</key>
+ <string>twistedcaldav.notify.SimpleLineNotifierService</string>
+ <key>Enabled</key>
+ <false/>
+ <key>Port</key>
+ <integer>62308</integer>
+ </dict>
+
+ <key>XMPPNotifier</key>
+ <dict>
+ <!-- XMPP notification service -->
+ <key>Service</key>
+ <string>twistedcaldav.notify.XMPPNotifierService</string>
+ <key>Enabled</key>
+ <false/>
+
+ <!-- XMPP host and port to contact -->
+ <key>Host</key>
+ <string>xmpp.host.name</string>
+ <key>Port</key>
+ <integer>5222</integer>
+
+ <!-- Jabber ID and password for the server -->
+ <key>JID</key>
+ <string>jid at xmpp.host.name/resource</string>
+ <key>Password</key>
+ <string>password_goes_here</string>
+
+ <!-- PubSub service address -->
+ <key>ServiceAddress</key>
+ <string>pubsub.xmpp.host.name</string>
+
+ <key>NodeConfiguration</key>
+ <dict>
+ <key>pubsub#deliver_payloads</key>
+ <string>1</string>
+ <key>pubsub#persist_items</key>
+ <string>1</string>
+ </dict>
+
+ <!-- Sends a presence notification to XMPP server at this interval (prevents disconnect) -->
+ <key>KeepAliveSeconds</key>
+ <integer>120</integer>
+
+ <!-- Sends a pubsub publish to a particular heartbeat node at this interval -->
+ <key>HeartbeatMinutes</key>
+ <integer>30</integer>
+
+ <!-- List of glob-like expressions defining which XMPP JIDs can converse with the server (for debugging) -->
+ <key>AllowedJIDs</key>
+ <array>
+ <!--
+ <string>*.example.com</string>
+ -->
+ </array>
+ </dict>
+ </dict>
+ </dict>
+
+
+ <!--
+ Server-to-server protocol
+ -->
+
+ <key>Scheduling</key>
+ <dict>
+
+ <!-- CalDAV protocol options -->
+ <key>CalDAV</key>
+ <dict>
+ <key>EmailDomain</key>
+ <string></string>
+ <key>HTTPDomain</key>
+ <string></string>
+ <key>AddressPatterns</key>
+ <array>
+ </array>
+ <key>OldDraftCompatibility</key>
+ <true/>
+ <key>ScheduleTagCompatibility</key>
+ <true/>
+ <key>EnablePrivateComments</key>
+ <true/>
+ </dict>
+
+ <!-- iSchedule protocol options -->
+ <key>iSchedule</key>
+ <dict>
+ <key>Enabled</key>
+ <false/>
+ <key>AddressPatterns</key>
+ <array>
+ </array>
+ <key>Servers</key>
+ <string>conf/servertoserver-test.xml</string>
+ </dict>
+
+ <!-- iMIP protocol options -->
+ <key>iMIP</key>
+ <dict>
+ <key>Enabled</key>
+ <false/>
+ <key>MailGatewayServer</key>
+ <string>localhost</string>
+ <key>MailGatewayPort</key>
+ <integer>62310</integer>
+ <key>Sending</key>
+ <dict>
+ <key>Server</key>
+ <string></string>
+ <key>Port</key>
+ <integer>587</integer>
+ <key>UseSSL</key>
+ <true/>
+ <key>Username</key>
+ <string></string>
+ <key>Password</key>
+ <string></string>
+ <key>Address</key>
+ <string></string> <!-- Address email will be sent from -->
+ </dict>
+ <key>Receiving</key>
+ <dict>
+ <key>Server</key>
+ <string></string>
+ <key>Port</key>
+ <integer>995</integer>
+ <key>Type</key>
+ <string></string> <!-- Either "pop" or "imap" -->
+ <key>UseSSL</key>
+ <true/>
+ <key>Username</key>
+ <string></string>
+ <key>Password</key>
+ <string></string>
+ <key>PollingSeconds</key>
+ <integer>30</integer>
+ </dict>
+ <key>AddressPatterns</key>
+ <array>
+ <string>mailto:.*</string>
+ </array>
+ </dict>
+
+ <!-- General options for scheduling -->
+ <key>Options</key>
+ <dict>
+ <key>AllowGroupAsOrganizer</key>
+ <false/>
+ <key>AllowLocationAsOrganizer</key>
+ <false/>
+ <key>AllowResourceAsOrganizer</key>
+ <false/>
+ </dict>
+
+ </dict>
+
+
+ <!--
+ Free-busy URL protocol
+ -->
+
+ <key>FreeBusyURL</key>
+ <dict>
+ <key>Enabled</key>
+ <true/>
+ <key>TimePeriod</key>
+ <integer>14</integer>
+ <key>AnonymousAccess</key>
+ <false/>
+ </dict>
+
+
+ <!--
+ Non-standard CalDAV extensions
+ -->
+
+ <!-- Calendar Drop Box -->
+ <key>EnableDropBox</key>
+ <true/>
+
+ <!-- Private Events -->
+ <key>EnablePrivateEvents</key>
+ <true/>
+
+ <!-- Timezone Service -->
+ <key>EnableTimezoneService</key>
+ <true/>
+
+
+ <!--
+ Miscellaneous items
+ -->
+
+ <!-- Service ACLs (Mac OS X) -->
+ <key>EnableSACLs</key>
+ <false/>
+
+ <!-- Web-based administration -->
+ <key>EnableWebAdmin</key>
+ <true/>
+
+ <!-- Support for Content-Encoding compression options as specified in RFC2616 Section 3.5 -->
+ <key>ResponseCompression</key>
+ <false/>
+
+ <!-- The retry-after value (in seconds) to return with a 503 error. -->
+ <key>HTTPRetryAfter</key>
+ <integer>180</integer>
+
+ <!-- A unix socket used for communication between the child and master processes.
+ An empty value tells the server to use a tcp socket instead. -->
+ <key>ControlSocket</key>
+ <string>logs/caldavd.sock</string>
+
+ <!-- Support for Memcached -->
+ <key>Memcached</key>
+ <dict>
+ <key>MaxClients</key>
+ <integer>5</integer>
+ <key>memcached</key>
+ <string>memcached</string> <!-- Find in PATH -->
+ <key>Options</key>
+ <array>
+ <!--<string>-vv</string>-->
+ </array>
+ </dict>
+
+ <!-- Response Caching -->
+ <key>ResponseCacheTimeout</key>
+ <integer>30</integer> <!-- in minutes -->
+
+
+ <!--
+ Twisted
+ -->
+
+ <key>Twisted</key>
+ <dict>
+ <key>twistd</key>
+ <string>../Twisted/bin/twistd</string>
+ </dict>
+
+
+ <key>Localization</key>
+ <dict>
+ <key>LocalesDirectory</key>
+ <string>locales</string>
+ <key>Language</key>
+ <string>English</string>
+ </dict>
+
+
+ </dict>
+</plist>
Added: CalendarServer/branches/users/sagen/locations-resources/twistedcaldav/directory/test/resources/resources-locations.xml
===================================================================
--- CalendarServer/branches/users/sagen/locations-resources/twistedcaldav/directory/test/resources/resources-locations.xml (rev 0)
+++ CalendarServer/branches/users/sagen/locations-resources/twistedcaldav/directory/test/resources/resources-locations.xml 2010-02-04 19:52:33 UTC (rev 5043)
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="utf-8"?>
+
+<!--
+Copyright (c) 2006-2010 Apple Inc. All rights reserved.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+ -->
+
+<!DOCTYPE accounts SYSTEM "accounts.dtd">
+
+<accounts realm="Test Realm">
+ <location repeat="10">
+ <uid>location%02d</uid>
+ <guid>location%02d</guid>
+ <password>location%02d</password>
+ <name>Room %02d</name>
+ </location>
+ <resource repeat="10">
+ <uid>resource%02d</uid>
+ <guid>resource%02d</guid>
+ <password>resource%02d</password>
+ <name>Resource %02d</name>
+ </resource>
+</accounts>
Added: CalendarServer/branches/users/sagen/locations-resources/twistedcaldav/directory/test/resources/users-groups.xml
===================================================================
--- CalendarServer/branches/users/sagen/locations-resources/twistedcaldav/directory/test/resources/users-groups.xml (rev 0)
+++ CalendarServer/branches/users/sagen/locations-resources/twistedcaldav/directory/test/resources/users-groups.xml 2010-02-04 19:52:33 UTC (rev 5043)
@@ -0,0 +1,40 @@
+<?xml version="1.0" encoding="utf-8"?>
+
+<!--
+Copyright (c) 2006-2010 Apple Inc. All rights reserved.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+ -->
+
+<!DOCTYPE accounts SYSTEM "accounts.dtd">
+
+<accounts realm="Test Realm">
+ <user repeat="10">
+ <uid>user%02d</uid>
+ <guid>user%02d</guid>
+ <password>test</password>
+ <name>Test User %02d</name>
+ <first-name>Test</first-name>
+ <last-name>User %02d</last-name>
+ </user>
+ <group>
+ <uid>testgroup1</uid>
+ <guid>e5a6142c-4189-4e9e-90b0-9cd0268b314b</guid>
+ <password>test</password>
+ <name>Group 01</name>
+ <members>
+ <member type="users">user01</member>
+ <member type="users">user02</member>
+ </members>
+ </group>
+</accounts>
Modified: CalendarServer/branches/users/sagen/locations-resources/twistedcaldav/directory/test/test_aggregate.py
===================================================================
--- CalendarServer/branches/users/sagen/locations-resources/twistedcaldav/directory/test/test_aggregate.py 2010-02-04 00:20:43 UTC (rev 5042)
+++ CalendarServer/branches/users/sagen/locations-resources/twistedcaldav/directory/test/test_aggregate.py 2010-02-04 19:52:33 UTC (rev 5043)
@@ -22,7 +22,6 @@
import twistedcaldav.directory.test.util
from twistedcaldav.directory import augment
-apache_prefix = "apache:"
xml_prefix = "xml:"
testServices = (
Modified: CalendarServer/branches/users/sagen/locations-resources/twistedcaldav/directory/test/test_opendirectory.py
===================================================================
--- CalendarServer/branches/users/sagen/locations-resources/twistedcaldav/directory/test/test_opendirectory.py 2010-02-04 00:20:43 UTC (rev 5042)
+++ CalendarServer/branches/users/sagen/locations-resources/twistedcaldav/directory/test/test_opendirectory.py 2010-02-04 19:52:33 UTC (rev 5043)
@@ -261,3 +261,18 @@
self.assertEquals(len(results), 2)
for record in results:
self.assertTrue(isinstance(record, OpenDirectoryRecord))
+
+
+ class OpenDirectorySubset (OpenDirectory):
+ """
+ Test the recordTypes subset feature of Apple OpenDirectoryService.
+ """
+ recordTypes = set((
+ DirectoryService.recordType_users,
+ DirectoryService.recordType_groups,
+ ))
+
+ def setUp(self):
+ super(OpenDirectorySubset, self).setUp()
+ self._service = OpenDirectoryService({'node' : "/Search", 'recordTypes' : (DirectoryService.recordType_users, DirectoryService.recordType_groups)}, dosetup=False)
+ augment.AugmentService = augment.AugmentXMLDB(xmlFiles=())
Added: CalendarServer/branches/users/sagen/locations-resources/twistedcaldav/directory/test/test_resources.py
===================================================================
--- CalendarServer/branches/users/sagen/locations-resources/twistedcaldav/directory/test/test_resources.py (rev 0)
+++ CalendarServer/branches/users/sagen/locations-resources/twistedcaldav/directory/test/test_resources.py 2010-02-04 19:52:33 UTC (rev 5043)
@@ -0,0 +1,76 @@
+##
+# Copyright (c) 2005-2010 Apple Inc. All rights reserved.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+##
+
+import os
+from twistedcaldav.config import config
+from twistedcaldav.test.util import TestCase
+from calendarserver.tools.util import getDirectory
+
+class ResourcesTestCase(TestCase):
+
+ def setUp(self):
+ testRoot = os.path.join(os.path.dirname(__file__), "resources")
+ configFileName = os.path.join(testRoot, "caldavd.plist")
+ config.load(configFileName)
+
+ xmlFile = os.path.join(testRoot, "users-groups.xml")
+ config.DirectoryService.params.xmlFile = xmlFile
+
+ xmlFile = os.path.join(testRoot, "resources-locations.xml")
+ config.ResourceService.params.xmlFile = xmlFile
+
+ xmlFile = os.path.join(testRoot, "augments.xml")
+ config.AugmentService.params.xmlFiles = (xmlFile,)
+
+ super(ResourcesTestCase, self).setUp()
+
+ def test_loadConfig(self):
+ directory = getDirectory()
+
+ def test_recordInPrimaryDirectory(self):
+ directory = getDirectory()
+
+ # Look up a user, which comes out of primary directory service
+ record = directory.recordWithUID("user01")
+ self.assertNotEquals(record, None)
+
+ def test_recordInSupplementalDirectory(self):
+ directory = getDirectory()
+
+ # Look up a resource, which comes out of locations/resources service
+ record = directory.recordWithUID("resource01")
+ self.assertNotEquals(record, None)
+
+ def test_augments(self):
+ directory = getDirectory()
+
+ # Primary directory
+ record = directory.recordWithUID("user01")
+ self.assertEquals(record.enabled, True)
+ self.assertEquals(record.enabledForCalendaring, True)
+ record = directory.recordWithUID("user02")
+ self.assertEquals(record.enabled, False)
+ self.assertEquals(record.enabledForCalendaring, False)
+
+ # Supplemental directory
+ record = directory.recordWithUID("resource01")
+ self.assertEquals(record.enabled, True)
+ self.assertEquals(record.enabledForCalendaring, True)
+ self.assertEquals(record.autoSchedule, True)
+ record = directory.recordWithUID("resource02")
+ self.assertEquals(record.enabled, False)
+ self.assertEquals(record.enabledForCalendaring, False)
+ self.assertEquals(record.autoSchedule, False)
Modified: CalendarServer/branches/users/sagen/locations-resources/twistedcaldav/directory/test/test_xmlfile.py
===================================================================
--- CalendarServer/branches/users/sagen/locations-resources/twistedcaldav/directory/test/test_xmlfile.py 2010-02-04 00:20:43 UTC (rev 5042)
+++ CalendarServer/branches/users/sagen/locations-resources/twistedcaldav/directory/test/test_xmlfile.py 2010-02-04 19:52:33 UTC (rev 5043)
@@ -18,6 +18,7 @@
from twisted.python.filepath import FilePath
+from twistedcaldav.test.util import TestCase
from twistedcaldav.directory import augment
from twistedcaldav.directory.directory import DirectoryService
import twistedcaldav.directory.test.util
@@ -225,3 +226,16 @@
self.assertFalse(service.recordWithShortName(DirectoryService.recordType_groups, "enabled").enabledForCalendaring)
self.assertFalse(service.recordWithShortName(DirectoryService.recordType_groups, "disabled").enabledForCalendaring)
+
+class XMLFileSubset (XMLFileBase, TestCase):
+ """
+ Test the recordTypes subset feature of XMLFile service.
+ """
+ recordTypes = set((
+ DirectoryService.recordType_users,
+ DirectoryService.recordType_groups,
+ ))
+
+ def test_recordTypesSubset(self):
+ directory = XMLDirectoryService({'xmlFile' : self.xmlFile(), 'recordTypes' : (DirectoryService.recordType_users, DirectoryService.recordType_groups)}, alwaysStat=True)
+ self.assertEquals(set(("users", "groups")), set(directory.recordTypes()))
Modified: CalendarServer/branches/users/sagen/locations-resources/twistedcaldav/directory/xmlfile.py
===================================================================
--- CalendarServer/branches/users/sagen/locations-resources/twistedcaldav/directory/xmlfile.py 2010-02-04 00:20:43 UTC (rev 5042)
+++ CalendarServer/branches/users/sagen/locations-resources/twistedcaldav/directory/xmlfile.py 2010-02-04 19:52:33 UTC (rev 5043)
@@ -50,10 +50,18 @@
defaults = {
'xmlFile' : None,
+ 'recordTypes' : (
+ self.recordType_users,
+ self.recordType_groups,
+ self.recordType_locations,
+ self.recordType_resources,
+ ),
}
ignored = None
params = self.getParams(params, defaults, ignored)
+ self._recordTypes = params['recordTypes']
+
super(XMLDirectoryService, self).__init__()
xmlFile = params.get("xmlFile")
@@ -67,13 +75,7 @@
self._accounts()
def recordTypes(self):
- recordTypes = (
- DirectoryService.recordType_users,
- DirectoryService.recordType_groups,
- DirectoryService.recordType_locations,
- DirectoryService.recordType_resources
- )
- return recordTypes
+ return self._recordTypes
def queryDirectory(self, recordTypes, indexType, indexKey):
Modified: CalendarServer/branches/users/sagen/locations-resources/twistedcaldav/stdconfig.py
===================================================================
--- CalendarServer/branches/users/sagen/locations-resources/twistedcaldav/stdconfig.py 2010-02-04 00:20:43 UTC (rev 5042)
+++ CalendarServer/branches/users/sagen/locations-resources/twistedcaldav/stdconfig.py 2010-02-04 19:52:33 UTC (rev 5043)
@@ -39,13 +39,22 @@
DEFAULT_SERVICE_PARAMS = {
"twistedcaldav.directory.xmlfile.XMLDirectoryService": {
"xmlFile": "/etc/caldavd/accounts.xml",
+ "recordTypes": ("users", "groups", "locations", "resources"),
},
"twistedcaldav.directory.appleopendirectory.OpenDirectoryService": {
"node": "/Search",
"cacheTimeout": 30,
+ "recordTypes": ("users", "groups", "locations", "resources"),
},
}
+DEFAULT_RESOURCE_PARAMS = {
+ "twistedcaldav.directory.xmlfile.XMLDirectoryService": {
+ "xmlFile": "/etc/caldavd/resources.xml",
+ "recordTypes" : ("locations", "resources"),
+ },
+}
+
DEFAULT_AUGMENT_PARAMS = {
"twistedcaldav.directory.augment.AugmentXMLDB": {
"xmlFiles": ["/etc/caldavd/augments.xml",],
@@ -127,6 +136,18 @@
},
#
+ # Locations and Resources service
+ #
+ # Supplements the directory service with information about locations
+ # and resources.
+ #
+ "ResourceService": {
+ "Enabled" : False,
+ "type": "twistedcaldav.directory.xmlfile.XMLDirectoryService",
+ "params": DEFAULT_RESOURCE_PARAMS["twistedcaldav.directory.xmlfile.XMLDirectoryService"],
+ },
+
+ #
# Augment service
#
# Augments for the directory service records to add calendar specific attributes.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20100204/a716d082/attachment-0001.html>
More information about the calendarserver-changes
mailing list