[CalendarServer-changes] [530]
CalendarServer/branches/users/wsanchez/provisioning-2
source_changes at macosforge.org
source_changes at macosforge.org
Mon Nov 20 20:09:57 PST 2006
Revision: 530
http://trac.macosforge.org/projects/calendarserver/changeset/530
Author: cdaboo at apple.com
Date: 2006-11-20 20:09:56 -0800 (Mon, 20 Nov 2006)
Log Message:
-----------
Allow selection of directory service via caldavd.plist.
Modified Paths:
--------------
CalendarServer/branches/users/wsanchez/provisioning-2/bin/caldavd
CalendarServer/branches/users/wsanchez/provisioning-2/conf/caldavd-dev.plist
CalendarServer/branches/users/wsanchez/provisioning-2/conf/caldavd.plist
CalendarServer/branches/users/wsanchez/provisioning-2/twistedcaldav/repository.py
Added Paths:
-----------
CalendarServer/branches/users/wsanchez/provisioning-2/conf/accounts.dtd
CalendarServer/branches/users/wsanchez/provisioning-2/conf/accounts.xml
Modified: CalendarServer/branches/users/wsanchez/provisioning-2/bin/caldavd
===================================================================
--- CalendarServer/branches/users/wsanchez/provisioning-2/bin/caldavd 2006-11-21 04:00:22 UTC (rev 529)
+++ CalendarServer/branches/users/wsanchez/provisioning-2/bin/caldavd 2006-11-21 04:09:56 UTC (rev 530)
@@ -65,6 +65,8 @@
self.certfile = "/etc/certificates/Default.crt"
self.manhole = 0
+ self.directoryservice = {"type":"OpenDirectoryService", "params":{"node":"/Search"},}
+
self.dropbox = True
self.dropboxName = "dropbox"
self.dropboxACLs = True
@@ -102,6 +104,8 @@
print "Only Use SSL: %s" % (self.onlyssl,)
print "SSL Private Key File: %s" % (self.keyfile,)
print "SSL Certificate File: %s" % (self.certfile,)
+ print "Directory Service: %s" % (self.directoryservice["type"],)
+ print "Directory Service Parameters: %r" % (self.directoryservice["params"],)
print "Drop Box Enabled: %s" % (self.dropbox,)
print "Drop Box Name: %s" % (self.dropboxName,)
print "Drop Box ACLs are Inherited %s" % (self.dropboxACLs,)
@@ -270,7 +274,7 @@
self.action = args[0]
def parsePlist(self):
- print "Reading configuration file %s." % (self.plistfile,)
+ print "Reading configuration file %s." % (self.plistfile,)
root = readPlist(self.plistfile)
@@ -286,6 +290,7 @@
"SSLPrivateKey": "keyfile",
"SSLCertificate": "certfile",
"ManholePort": "manhole",
+ "DirectoryService": "directoryservice",
"DropBoxEnabled": "dropbox",
"DropBoxName": "dropboxName",
"DropBoxInheritedACLs": "dropboxACLs",
@@ -355,24 +360,25 @@
def generateTAC(self):
return """
docroot = "%(docroot)s"
-repo = "%(repo)s"
-doacct = %(doacct)s
-doacl = %(doacl)s
-dossl = %(dossl)s
-keyfile = "%(keyfile)s"
-certfile = "%(certfile)s"
-onlyssl = %(onlyssl)s
-port = %(port)d
-sslport = %(sslport)d
-maxsize = %(maxsize)d
-quota = %(quota)d
-serverlogfile = "%(serverlogfile)s"
-dropbox = "%(dropbox)s"
-dropboxName = "%(dropboxName)s"
-dropboxACLs = "%(dropboxACLs)s"
-notifications = "%(notifications)s"
-notifcationName = "%(notifcationName)s"
-manhole = %(manhole)d
+repo = "%(repo)s"
+doacct = %(doacct)s
+doacl = %(doacl)s
+dossl = %(dossl)s
+keyfile = "%(keyfile)s"
+certfile = "%(certfile)s"
+onlyssl = %(onlyssl)s
+port = %(port)d
+sslport = %(sslport)d
+maxsize = %(maxsize)d
+quota = %(quota)d
+serverlogfile = "%(serverlogfile)s"
+directoryService = "%(directoryservice)s"
+dropbox = "%(dropbox)s"
+dropboxName = "%(dropboxName)s"
+dropboxACLs = "%(dropboxACLs)s"
+notifications = "%(notifications)s"
+notifcationName = "%(notifcationName)s"
+manhole = %(manhole)d
from twistedcaldav.repository import startServer
@@ -389,6 +395,7 @@
maxsize,
quota,
serverlogfile,
+ directoryservice,
dropbox,
dropboxName,
dropboxACLs,
@@ -410,6 +417,7 @@
"maxsize": self.maxsize,
"quota": self.quota,
"serverlogfile": self.serverlogfile,
+ "directoryservice":self.directoryservice,
"dropbox": self.dropbox,
"dropboxName": self.dropboxName,
"dropboxACLs": self.dropboxACLs,
Added: CalendarServer/branches/users/wsanchez/provisioning-2/conf/accounts.dtd
===================================================================
--- CalendarServer/branches/users/wsanchez/provisioning-2/conf/accounts.dtd (rev 0)
+++ CalendarServer/branches/users/wsanchez/provisioning-2/conf/accounts.dtd 2006-11-21 04:09:56 UTC (rev 530)
@@ -0,0 +1,40 @@
+<!--
+Copyright (c) 2006 Apple Computer, 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.
+
+DRI: Cyrus Daboo, cdaboo at apple.com
+ -->
+
+<!ELEMENT accounts (user*, group*, resource*) >
+ <!ATTLIST accounts realm CDATA "">
+
+ <!ELEMENT user (uid, pswd, name, cuaddr*, calendar*, quota?, autorespond?, canproxy?)>
+ <!ATTLIST user repeat CDATA "1">
+
+ <!ELEMENT group (uid, pswd, name, members, cuaddr*, calendar*, quota?)>
+ <!ATTLIST group repeat CDATA "1">
+
+ <!ELEMENT resource (uid, pswd, name, cuaddr*, calendar*, quota?, autorespond?, canproxy?)>
+ <!ATTLIST resource repeat CDATA "1">
+
+ <!ELEMENT uid (#PCDATA)>
+ <!ELEMENT pswd (#PCDATA)>
+ <!ELEMENT name (#PCDATA)>
+ <!ELEMENT cuaddr (#PCDATA)>
+ <!ELEMENT calendar (#PCDATA)>
+ <!ELEMENT quota (#PCDATA)>
+ <!ELEMENT autorespond EMPTY>
+ <!ELEMENT canproxy EMPTY>
+ <!ELEMENT members (uid*)>
+
\ No newline at end of file
Added: CalendarServer/branches/users/wsanchez/provisioning-2/conf/accounts.xml
===================================================================
--- CalendarServer/branches/users/wsanchez/provisioning-2/conf/accounts.xml (rev 0)
+++ CalendarServer/branches/users/wsanchez/provisioning-2/conf/accounts.xml 2006-11-21 04:09:56 UTC (rev 530)
@@ -0,0 +1,43 @@
+<?xml version="1.0" encoding="utf-8"?>
+
+<!--
+Copyright (c) 2006 Apple Computer, 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>
+ <uid>admin</uid>
+ <pswd>admin</pswd>
+ <name>Super User</name>
+ </user>
+ <user>
+ <uid>proxy</uid>
+ <pswd>proxy</pswd>
+ <name>User who can authorize as someone else</name>
+ <canproxy/> <!-- FIXME: Is the directory the right place to configure this bit? -->
+ </user>
+ <user repeat="100">
+ <uid>user%02d</uid>
+ <pswd>%02duser</pswd>
+ <name>User %02d</name>
+ </user>
+ <resource repeat="10">
+ <uid>resource%02d</uid>
+ <pswd>resource%02d</pswd>
+ <name>Room %02d</name>
+ </resource>
+</accounts>
Modified: CalendarServer/branches/users/wsanchez/provisioning-2/conf/caldavd-dev.plist
===================================================================
--- CalendarServer/branches/users/wsanchez/provisioning-2/conf/caldavd-dev.plist 2006-11-21 04:00:22 UTC (rev 529)
+++ CalendarServer/branches/users/wsanchez/provisioning-2/conf/caldavd-dev.plist 2006-11-21 04:09:56 UTC (rev 530)
@@ -65,6 +65,51 @@
<key>ResetAccountACLs</key>
<true/>
+ <!-- Open Directory Service -->
+ <!--
+ <key>DirectoryService</key>
+ <dict>
+ <key>type</key>
+ <string>OpenDirectoryService</string>
+
+ <key>params</key>
+ <dict>
+ <key>node</key>
+ <string>/Search</string>
+ </dict>
+ </dict>
+ -->
+
+ <!-- XML File Directory Service -->
+ <key>DirectoryService</key>
+ <dict>
+ <key>type</key>
+ <string>XMLDirectoryService</string>
+
+ <key>params</key>
+ <dict>
+ <key>xmlFile</key>
+ <string>conf/accounts.xml</string>
+ </dict>
+ </dict>
+
+ <!-- SQL Directory Service -->
+ <!--
+ <key>DirectoryService</key>
+ <dict>
+ <key>type</key>
+ <string>SQLDirectoryService</string>
+
+ <key>params</key>
+ <dict>
+ <key>dbParentPath</key>
+ <string>/Library/CalendarServer/Documents</string>
+ <key>xmlFile</key>
+ <string>conf/accounts.xml</string>
+ </dict>
+ </dict>
+ -->
+
<key>DropBoxEnabled</key>
<true/>
Modified: CalendarServer/branches/users/wsanchez/provisioning-2/conf/caldavd.plist
===================================================================
--- CalendarServer/branches/users/wsanchez/provisioning-2/conf/caldavd.plist 2006-11-21 04:00:22 UTC (rev 529)
+++ CalendarServer/branches/users/wsanchez/provisioning-2/conf/caldavd.plist 2006-11-21 04:09:56 UTC (rev 530)
@@ -65,6 +65,51 @@
<key>ResetAccountACLs</key>
<true/>
+ <!-- Open Directory Service -->
+ <key>DirectoryService</key>
+ <dict>
+ <key>type</key>
+ <string>OpenDirectoryService</string>
+
+ <key>params</key>
+ <dict>
+ <key>node</key>
+ <string>/Search</string>
+ </dict>
+ </dict>
+
+ <!-- XML File Directory Service -->
+ <!--
+ <key>DirectoryService</key>
+ <dict>
+ <key>type</key>
+ <string>XMLDirectoryService</string>
+
+ <key>params</key>
+ <dict>
+ <key>xmlFile</key>
+ <string>conf/accounts.xml</string>
+ </dict>
+ </dict>
+ -->
+
+ <!-- SQL Directory Service -->
+ <!--
+ <key>DirectoryService</key>
+ <dict>
+ <key>type</key>
+ <string>SQLDirectoryService</string>
+
+ <key>params</key>
+ <dict>
+ <key>dbParentPath</key>
+ <string>/Library/CalendarServer/Documents</string>
+ <key>xmlFile</key>
+ <string>conf/accounts.xml</string>
+ </dict>
+ </dict>
+ -->
+
<key>DropBoxEnabled</key>
<true/>
Modified: CalendarServer/branches/users/wsanchez/provisioning-2/twistedcaldav/repository.py
===================================================================
--- CalendarServer/branches/users/wsanchez/provisioning-2/twistedcaldav/repository.py 2006-11-21 04:00:22 UTC (rev 529)
+++ CalendarServer/branches/users/wsanchez/provisioning-2/twistedcaldav/repository.py 2006-11-21 04:09:56 UTC (rev 530)
@@ -55,7 +55,6 @@
from twistedcaldav.resource import CalDAVResource
from twistedcaldav.static import CalendarHomeFile, CalendarPrincipalFile
from twistedcaldav.directory.idirectory import IDirectoryService
-from twistedcaldav.directory.appleopendirectory import OpenDirectoryService
ELEMENT_REPOSITORY = "repository"
@@ -109,7 +108,6 @@
ATTRIBUTE_ENABLE = "enable"
ATTRIBUTE_ONLYSSL = "onlyssl"
ATTRIBUTE_CREDENTIALS = "credentials"
-ATTRIBUTE_DIRECTORY_NODE = "node"
ATTRIBUTE_VALUE_PROPERTY = "property"
ATTRIBUTE_VALUE_DIRECTORY = "directory"
@@ -131,6 +129,7 @@
def startServer(docroot, repo, doacct, doacl, dossl,
keyfile, certfile, onlyssl, port, sslport, maxsize,
quota, serverlogfile,
+ directoryservice,
dropbox, dropboxName, dropboxACLs,
notifications, notifcationName,
manhole):
@@ -223,6 +222,20 @@
directory = DirectoryServiceProxy()
+ dirname = directoryservice["type"]
+ dirparams = directoryservice["params"]
+ try:
+ resource_class = namedObject(dirname)
+ except:
+ log.err("Unable to locate Python class %r" % (dirname,))
+ raise
+ try:
+ service = resource_class(**dirparams)
+ except Exception:
+ log.err("Unable to instantiate Python class %r with arguments %r" % (resource_class, dirparams))
+ raise
+ directory.service=service
+
# Build the server
builder = RepositoryBuilder(docroot,
doAccounts=doacct,
@@ -246,8 +259,6 @@
portal.registerChecker(auth.TwistedPropertyChecker())
print "Using property-based password checker."
elif authenticator.credentials == ATTRIBUTE_VALUE_DIRECTORY:
- service = OpenDirectoryService(authenticator.directoryNode)
- directory.service = service
portal.registerChecker(service)
print "Using directory-based password checker."
elif authenticator.credentials == ATTRIBUTE_VALUE_KERBEROS:
@@ -548,7 +559,7 @@
kwargs["params"] = self.params
try:
self.resource = resource_class(**kwargs)
- except Exception, e:
+ except Exception:
log.err("Unable to instantiate Python class %r with arguments %r" % (resource_class, kwargs))
raise
@@ -926,8 +937,6 @@
self.onlyssl = node.getAttribute(ATTRIBUTE_ONLYSSL) == ATTRIBUTE_VALUE_YES
if node.hasAttribute(ATTRIBUTE_CREDENTIALS):
self.credentials = node.getAttribute(ATTRIBUTE_CREDENTIALS)
- if node.hasAttribute(ATTRIBUTE_DIRECTORY_NODE):
- self.directoryNode = node.getAttribute(ATTRIBUTE_DIRECTORY_NODE)
for child in node._get_childNodes():
if child._get_localName() == ELEMENT_REALM:
if child.firstChild is not None:
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20061120/32b57fed/attachment.html
More information about the calendarserver-changes
mailing list