[CalendarServer-changes] [5600] CalendarServer/branches/users/cdaboo/more-sharing-5591/twistedcaldav
source_changes at macosforge.org
source_changes at macosforge.org
Fri May 14 09:19:06 PDT 2010
Revision: 5600
http://trac.macosforge.org/projects/calendarserver/changeset/5600
Author: cdaboo at apple.com
Date: 2010-05-14 09:19:04 -0700 (Fri, 14 May 2010)
Log Message:
-----------
Enabling full sharing for address books as well as calendars. Currently "breaks" the global address book support.
Modified Paths:
--------------
CalendarServer/branches/users/cdaboo/more-sharing-5591/twistedcaldav/customxml.py
CalendarServer/branches/users/cdaboo/more-sharing-5591/twistedcaldav/directory/addressbook.py
CalendarServer/branches/users/cdaboo/more-sharing-5591/twistedcaldav/method/delete_common.py
CalendarServer/branches/users/cdaboo/more-sharing-5591/twistedcaldav/resource.py
CalendarServer/branches/users/cdaboo/more-sharing-5591/twistedcaldav/sharing.py
CalendarServer/branches/users/cdaboo/more-sharing-5591/twistedcaldav/static.py
CalendarServer/branches/users/cdaboo/more-sharing-5591/twistedcaldav/stdconfig.py
Added Paths:
-----------
CalendarServer/branches/users/cdaboo/more-sharing-5591/twistedcaldav/sharedcollection.py
Removed Paths:
-------------
CalendarServer/branches/users/cdaboo/more-sharing-5591/twistedcaldav/sharedcalendar.py
Modified: CalendarServer/branches/users/cdaboo/more-sharing-5591/twistedcaldav/customxml.py
===================================================================
--- CalendarServer/branches/users/cdaboo/more-sharing-5591/twistedcaldav/customxml.py 2010-05-14 16:12:27 UTC (rev 5599)
+++ CalendarServer/branches/users/cdaboo/more-sharing-5591/twistedcaldav/customxml.py 2010-05-14 16:19:04 UTC (rev 5600)
@@ -641,12 +641,12 @@
namespace = calendarserver_namespace
name = "shared-url"
-class SharedCalendar (davxml.WebDAVElement):
+class SharedAs (davxml.WebDAVElement):
"""
The url for a shared calendar.
"""
namespace = calendarserver_namespace
- name = "shared-calendar"
+ name = "shared-as"
allowed_children = {
(dav_namespace, "href") : (1, 1),
Modified: CalendarServer/branches/users/cdaboo/more-sharing-5591/twistedcaldav/directory/addressbook.py
===================================================================
--- CalendarServer/branches/users/cdaboo/more-sharing-5591/twistedcaldav/directory/addressbook.py 2010-05-14 16:12:27 UTC (rev 5599)
+++ CalendarServer/branches/users/cdaboo/more-sharing-5591/twistedcaldav/directory/addressbook.py 2010-05-14 16:19:04 UTC (rev 5600)
@@ -263,7 +263,7 @@
self.parent = parent
childlist = ()
- if config.Sharing.Enabled and config.Sharing.Calendars.Enabled:
+ if config.Sharing.Enabled and config.Sharing.AddressBooks.Enabled and not config.Sharing.Calendars.Enabled:
childlist += (
("notification", NotificationCollectionResource),
)
Modified: CalendarServer/branches/users/cdaboo/more-sharing-5591/twistedcaldav/method/delete_common.py
===================================================================
--- CalendarServer/branches/users/cdaboo/more-sharing-5591/twistedcaldav/method/delete_common.py 2010-05-14 16:12:27 UTC (rev 5599)
+++ CalendarServer/branches/users/cdaboo/more-sharing-5591/twistedcaldav/method/delete_common.py 2010-05-14 16:19:04 UTC (rev 5600)
@@ -343,6 +343,13 @@
log.err(msg)
raise HTTPError(StatusResponse(responsecode.BAD_REQUEST, msg))
+ # Check virtual share first
+ isVirtual = yield delresource.isVirtualShare(self.request)
+ if isVirtual:
+ log.debug("Removing shared address book %s" % (delresource,))
+ yield delresource.removeVirtualShare(self.request)
+ returnValue(responsecode.NO_CONTENT)
+
log.debug("Deleting addressbook %s" % (delresource.fp.path,))
errors = ResponseQueue(deluri, "DELETE", responsecode.NO_CONTENT)
Modified: CalendarServer/branches/users/cdaboo/more-sharing-5591/twistedcaldav/resource.py
===================================================================
--- CalendarServer/branches/users/cdaboo/more-sharing-5591/twistedcaldav/resource.py 2010-05-14 16:12:27 UTC (rev 5599)
+++ CalendarServer/branches/users/cdaboo/more-sharing-5591/twistedcaldav/resource.py 2010-05-14 16:19:04 UTC (rev 5600)
@@ -194,7 +194,10 @@
)
elif config.Sharing.AddressBooks.Enabled and self.isAddressBookCollection():
- baseProperties += (customxml.Invite.qname(),)
+ baseProperties += (
+ customxml.Invite.qname(),
+ customxml.AllowedSharingModes.qname(),
+ )
return super(CalDAVResource, self).liveProperties() + baseProperties
@@ -210,6 +213,7 @@
return qname in (
caldavxml.CalendarDescription.qname(),
caldavxml.CalendarTimeZone.qname(),
+ carddavxml.AddressBookDescription.qname(),
)
def isGlobalProperty(self, qname):
@@ -372,13 +376,18 @@
))
elif qname == customxml.Invite.qname():
- if config.Sharing.Enabled and config.Sharing.Calendars.Enabled and self.isCalendarCollection():
+ if config.Sharing.Enabled and (
+ config.Sharing.Calendars.Enabled and self.isCalendarCollection() or
+ config.Sharing.AddressBooks.Enabled and self.isAddressBookCollection()
+ ):
result = (yield self.inviteProperty(request))
returnValue(result)
elif qname == customxml.AllowedSharingModes.qname():
if config.Sharing.Enabled and config.Sharing.Calendars.Enabled and self.isCalendarCollection():
returnValue(customxml.AllowedSharingModes(customxml.CanBeShared()))
+ elif config.Sharing.Enabled and config.Sharing.AddressBooks.Enabled and self.isAddressBookCollection():
+ returnValue(customxml.AllowedSharingModes(customxml.CanBeShared()))
result = (yield super(CalDAVResource, self).readProperty(property, request))
returnValue(result)
@@ -455,13 +464,19 @@
yield self._preProcessWriteProperty(property, request)
if property.qname() == davxml.ResourceType.qname():
- if self.isCalendarCollection():
+ if self.isCalendarCollection() or self.isAddressBookCollection():
sawShare = [child for child in property.children if child.qname() == (calendarserver_namespace, "shared-owner")]
- if not (config.Sharing.Enabled and config.Sharing.Calendars.Enabled):
- raise HTTPError(StatusResponse(
- responsecode.FORBIDDEN,
- "Cannot create shared calendars on this server.",
- ))
+ if sawShare:
+ if self.isCalendarCollection() and not (config.Sharing.Enabled and config.Sharing.Calendars.Enabled):
+ raise HTTPError(StatusResponse(
+ responsecode.FORBIDDEN,
+ "Cannot create shared calendars on this server.",
+ ))
+ elif self.isAddressBookCollection() and not (config.Sharing.Enabled and config.Sharing.AddressBooks.Enabled):
+ raise HTTPError(StatusResponse(
+ responsecode.FORBIDDEN,
+ "Cannot create shared address books on this server.",
+ ))
# Check if adding or removing share
shared = (yield self.isShared(request))
@@ -474,7 +489,8 @@
"Protected property %s may not be set." % (property.sname(),)
))
for child in property.children:
- if child.qname() == caldavxml.Calendar.qname():
+ if self.isCalendarCollection and child.qname() == caldavxml.Calendar.qname() or \
+ self.isAddressBookCollection and child.qname() == carddavxml.AddressBook.qname():
break
else:
raise HTTPError(StatusResponse(
Deleted: CalendarServer/branches/users/cdaboo/more-sharing-5591/twistedcaldav/sharedcalendar.py
===================================================================
--- CalendarServer/branches/users/cdaboo/more-sharing-5591/twistedcaldav/sharedcalendar.py 2010-05-14 16:12:27 UTC (rev 5599)
+++ CalendarServer/branches/users/cdaboo/more-sharing-5591/twistedcaldav/sharedcalendar.py 2010-05-14 16:19:04 UTC (rev 5600)
@@ -1,45 +0,0 @@
-##
-# Copyright (c) 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.
-##
-
-from twisted.internet.defer import inlineCallbacks, returnValue
-
-from twistedcaldav.linkresource import LinkResource
-
-__all__ = [
- "SharedCalendarResource",
-]
-
-"""
-Sharing behavior
-"""
-
-class SharedCalendarResource(LinkResource):
- """
- This is similar to a WrapperResource except that we locate our shared calendar resource dynamically.
- """
-
- def __init__(self, parent, share):
- self.share = share
- super(SharedCalendarResource, self).__init__(parent, None)
-
- @inlineCallbacks
- def linkedResource(self, request):
-
- if not hasattr(self, "_linkedResource"):
- self._linkedResource = (yield request.locateResource(self.share.hosturl))
- ownerPrincipal = (yield self.parent.ownerPrincipal(request))
- self._linkedResource.setVirtualShare(ownerPrincipal, self.share)
- returnValue(self._linkedResource)
Copied: CalendarServer/branches/users/cdaboo/more-sharing-5591/twistedcaldav/sharedcollection.py (from rev 5592, CalendarServer/branches/users/cdaboo/more-sharing-5591/twistedcaldav/sharedcalendar.py)
===================================================================
--- CalendarServer/branches/users/cdaboo/more-sharing-5591/twistedcaldav/sharedcollection.py (rev 0)
+++ CalendarServer/branches/users/cdaboo/more-sharing-5591/twistedcaldav/sharedcollection.py 2010-05-14 16:19:04 UTC (rev 5600)
@@ -0,0 +1,45 @@
+##
+# Copyright (c) 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.
+##
+
+from twisted.internet.defer import inlineCallbacks, returnValue
+
+from twistedcaldav.linkresource import LinkResource
+
+__all__ = [
+ "SharedCollectionResource",
+]
+
+"""
+Sharing behavior
+"""
+
+class SharedCollectionResource(LinkResource):
+ """
+ This is similar to a WrapperResource except that we locate our shared collection resource dynamically.
+ """
+
+ def __init__(self, parent, share):
+ self.share = share
+ super(SharedCollectionResource, self).__init__(parent, None)
+
+ @inlineCallbacks
+ def linkedResource(self, request):
+
+ if not hasattr(self, "_linkedResource"):
+ self._linkedResource = (yield request.locateResource(self.share.hosturl))
+ ownerPrincipal = (yield self.parent.ownerPrincipal(request))
+ self._linkedResource.setVirtualShare(ownerPrincipal, self.share)
+ returnValue(self._linkedResource)
Modified: CalendarServer/branches/users/cdaboo/more-sharing-5591/twistedcaldav/sharing.py
===================================================================
--- CalendarServer/branches/users/cdaboo/more-sharing-5591/twistedcaldav/sharing.py 2010-05-14 16:12:27 UTC (rev 5599)
+++ CalendarServer/branches/users/cdaboo/more-sharing-5591/twistedcaldav/sharing.py 2010-05-14 16:19:04 UTC (rev 5600)
@@ -29,7 +29,7 @@
returnValue
from twistedcaldav import customxml, caldavxml
from twistedcaldav.config import config
-from twistedcaldav.customxml import SharedCalendar, calendarserver_namespace
+from twistedcaldav.customxml import calendarserver_namespace
from twistedcaldav.sql import AbstractSQLDatabase, db_prefix
from uuid import uuid4
from vobject.icalendar import dateTimeToString, utc
@@ -219,8 +219,11 @@
def removeVirtualShare(self, request):
""" Return True if this is a shared calendar collection """
- # Remove from sharee's calendar home
- shareeHome = self._shareePrincipal.calendarHome()
+ # Remove from sharee's calendar/address book home
+ if self.isCalendarCollection():
+ shareeHome = self._shareePrincipal.calendarHome()
+ elif self.isAddressBookCollection():
+ shareeHome = self._shareePrincipal.addressBookHome()
return shareeHome.removeShare(request, self._share)
@inlineCallbacks
@@ -285,13 +288,17 @@
davxml.Protected(),
TwistedACLInheritable(),
),
- # Inheritable CALDAV:read-free-busy access for authenticated users.
- davxml.ACE(
- davxml.Principal(davxml.Authenticated()),
- davxml.Grant(davxml.Privilege(caldavxml.ReadFreeBusy())),
- TwistedACLInheritable(),
- ),
)
+
+ if self.isCalendarCollection():
+ aces += (
+ # Inheritable CALDAV:read-free-busy access for authenticated users.
+ davxml.ACE(
+ davxml.Principal(davxml.Authenticated()),
+ davxml.Grant(davxml.Privilege(caldavxml.ReadFreeBusy())),
+ TwistedACLInheritable(),
+ ),
+ )
# Give read access to config.ReadPrincipals
aces += config.ReadACEs
@@ -382,13 +389,6 @@
record.state = "INVALID"
self.invitesDB().addOrUpdateRecord(record)
- def getInviteUsers(self, request):
- return succeed(True)
-
- def sendNotificationOnChange(self, icalendarComponent, request, state="added"):
- """ Possibly send a push and or email notification on a change to a resource in a shared collection """
- return succeed(True)
-
def inviteUserToShare(self, userid, cn, ace, summary, request):
""" Send out in invite first, and then add this user to the share list
@param userid:
@@ -465,10 +465,13 @@
# Cancel invites
record = self.invitesDB().recordForUserID(userid)
- # Remove any shared calendar
+ # Remove any shared calendar or address book
sharee = self.principalForCalendarUserAddress(record.userid)
if sharee:
- shareeHome = sharee.calendarHome()
+ if self.isCalendarCollection():
+ shareeHome = sharee.calendarHome()
+ elif self.isAddressBookCollection():
+ shareeHome = sharee.addressBookHome()
yield shareeHome.removeShareByUID(request, record.inviteuid)
# If current user state is accepted then we send an invite with the new state, otherwise
@@ -887,21 +890,21 @@
class SharedHomeMixin(object):
"""
A mix-in for calendar/addressbook homes that defines the operations for manipulating a sharee's
- set of shared calendfars.
+ set of shared calendars.
"""
def sharesDB(self):
if not hasattr(self, "_sharesDB"):
- self._sharesDB = SharedCalendarsDatabase(self)
+ self._sharesDB = SharedCollectionsDatabase(self)
return self._sharesDB
def provisionShares(self):
if not hasattr(self, "_provisionedShares"):
- from twistedcaldav.sharedcalendar import SharedCalendarResource
+ from twistedcaldav.sharedcollection import SharedCollectionResource
for share in self.sharesDB().allRecords():
- child = SharedCalendarResource(self, share)
+ child = SharedCollectionResource(self, share)
self.putChild(share.localname, child)
self._provisionedShares = True
@@ -911,7 +914,8 @@
# Send the invite reply then add the link
yield self._changeShare(request, "ACCEPTED", hostUrl, inviteUID, displayname)
- yield self._acceptShare(request, SHARETYPE_INVITE, hostUrl, inviteUID, displayname)
+ response = (yield self._acceptShare(request, SHARETYPE_INVITE, hostUrl, inviteUID, displayname))
+ returnValue(response)
def acceptDirectShare(self, request, hostUrl, resourceUID, displayname=None):
@@ -924,39 +928,36 @@
# Add or update in DB
oldShare = self.sharesDB().recordForShareUID(shareUID)
if not oldShare:
- oldShare = share = SharedCalendarRecord(shareUID, sharetype, hostUrl, str(uuid4()), displayname)
+ oldShare = share = SharedCollectionRecord(shareUID, sharetype, hostUrl, str(uuid4()), displayname)
self.sharesDB().addOrUpdateRecord(share)
# Set per-user displayname to whatever was given
if displayname:
- sharedCalendar = (yield request.locateResource(hostUrl))
+ sharedCollection = (yield request.locateResource(hostUrl))
ownerPrincipal = (yield self.ownerPrincipal(request))
- sharedCalendar.setVirtualShare(ownerPrincipal, oldShare)
- yield sharedCalendar.writeProperty(davxml.DisplayName.fromString(displayname), request)
+ sharedCollection.setVirtualShare(ownerPrincipal, oldShare)
+ yield sharedCollection.writeProperty(davxml.DisplayName.fromString(displayname), request)
- # Return the URL of the shared calendar
+ # Return the URL of the shared collection
returnValue(XMLResponse(
code = responsecode.OK,
- element = SharedCalendar(
+ element = customxml.SharedAs(
davxml.HRef.fromString(joinURL(self.url(), oldShare.localname))
)
))
- def wouldAcceptShare(self, hostUrl, request):
- return succeed(True)
-
def removeShare(self, request, share):
- """ Remove a shared calendar named in resourceName and send a decline """
+ """ Remove a shared collection named in resourceName """
# Send a decline when an invite share is removed only
if share.sharetype == SHARETYPE_INVITE:
return self.declineShare(request, share.hosturl, share.shareuid)
else:
- self.removeDirectShare(request, share)
+ return self.removeDirectShare(request, share)
@inlineCallbacks
def removeShareByUID(self, request, shareUID):
- """ Remove a shared calendar but do not send a decline back """
+ """ Remove a shared collection but do not send a decline back """
share = self.sharesDB().recordForShareUID(shareUID)
if share:
@@ -966,16 +967,17 @@
@inlineCallbacks
def removeDirectShare(self, request, share):
- """ Remove a shared calendar but do not send a decline back """
+ """ Remove a shared collection but do not send a decline back """
shareURL = joinURL(self.url(), share.localname)
- # For backwards compatibility we need to sync this up with the calendar-free-busy-set on the inbox
- principal = (yield self.resourceOwnerPrincipal(request))
- inboxURL = principal.scheduleInboxURL()
- if inboxURL:
- inbox = (yield request.locateResource(inboxURL))
- inbox.processFreeBusyCalendar(shareURL, False)
+ if self.isCalendarCollection():
+ # For backwards compatibility we need to sync this up with the calendar-free-busy-set on the inbox
+ principal = (yield self.resourceOwnerPrincipal(request))
+ inboxURL = principal.scheduleInboxURL()
+ if inboxURL:
+ inbox = (yield request.locateResource(inboxURL))
+ inbox.processFreeBusyCalendar(shareURL, False)
self.sharesDB().removeRecordForShareUID(share.shareuid)
@@ -983,7 +985,7 @@
def declineShare(self, request, hostUrl, inviteUID):
# Remove it if its in the DB
- yield self.removeShareByUID(inviteUID)
+ yield self.removeShareByUID(request, inviteUID)
yield self._changeShare(request, "DECLINED", hostUrl, inviteUID)
@@ -991,31 +993,31 @@
@inlineCallbacks
def _changeShare(self, request, state, hostUrl, replytoUID, displayname=None):
- """ Accept an invite to a shared calendar """
+ """ Accept an invite to a shared collection """
# Change state in sharer invite
owner = (yield self.ownerPrincipal(request))
owner = owner.principalURL()
- sharedCalendar = (yield request.locateResource(hostUrl))
- if sharedCalendar is None:
- # Original shared calendar is gone - nothing we can do except ignore it
+ sharedCollection = (yield request.locateResource(hostUrl))
+ if sharedCollection is None:
+ # Original shared collection is gone - nothing we can do except ignore it
raise HTTPError(ErrorResponse(
responsecode.FORBIDDEN,
(customxml.calendarserver_namespace, "valid-request"),
- "invalid shared calendar",
+ "invalid shared collection",
))
# Change the record
- yield sharedCalendar.changeUserInviteState(request, replytoUID, owner, state, displayname)
+ yield sharedCollection.changeUserInviteState(request, replytoUID, owner, state, displayname)
- yield self.sendReply(request, owner, sharedCalendar, state, hostUrl, replytoUID, displayname)
+ yield self.sendReply(request, owner, sharedCollection, state, hostUrl, replytoUID, displayname)
@inlineCallbacks
- def sendReply(self, request, sharee, sharedCalendar, state, hostUrl, replytoUID, displayname=None):
+ def sendReply(self, request, sharee, sharedCollection, state, hostUrl, replytoUID, displayname=None):
# Locate notifications collection for sharer
- sharer = (yield sharedCalendar.ownerPrincipal(request))
+ sharer = (yield sharedCollection.ownerPrincipal(request))
notifications = (yield request.locateResource(sharer.notificationURL()))
# Generate invite XML
@@ -1097,7 +1099,7 @@
return allDataFromStream(request.stream).addCallback(_getData)
-class SharedCalendarRecord(object):
+class SharedCollectionRecord(object):
def __init__(self, shareuid, sharetype, hosturl, localname, summary):
self.shareuid = shareuid
@@ -1106,20 +1108,20 @@
self.localname = localname
self.summary = summary
-class SharedCalendarsDatabase(AbstractSQLDatabase, LoggingMixIn):
+class SharedCollectionsDatabase(AbstractSQLDatabase, LoggingMixIn):
db_basename = db_prefix + "shares"
schema_version = "1"
db_type = "shares"
- def __init__(self, resource):
+ def __init__(self, resource):
"""
@param resource: the L{twistedcaldav.static.CalDAVFile} resource for
the shared collection. C{resource} must be a calendar/addressbook home collection.)
"""
self.resource = resource
- db_filename = os.path.join(self.resource.fp.path, SharedCalendarsDatabase.db_basename)
- super(SharedCalendarsDatabase, self).__init__(db_filename, True, autocommit=True)
+ db_filename = os.path.join(self.resource.fp.path, SharedCollectionsDatabase.db_basename)
+ super(SharedCollectionsDatabase, self).__init__(db_filename, True, autocommit=True)
def create(self):
"""
@@ -1166,13 +1168,13 @@
"""
@return: the schema version assigned to this index.
"""
- return SharedCalendarsDatabase.schema_version
+ return SharedCollectionsDatabase.schema_version
def _db_type(self):
"""
@return: the collection type assigned to this index.
"""
- return SharedCalendarsDatabase.db_type
+ return SharedCollectionsDatabase.db_type
def _db_init_data_tables(self, q):
"""
@@ -1225,4 +1227,4 @@
def _makeRecord(self, row):
- return SharedCalendarRecord(*[str(item) if type(item) == types.UnicodeType else item for item in row])
+ return SharedCollectionRecord(*[str(item) if type(item) == types.UnicodeType else item for item in row])
Modified: CalendarServer/branches/users/cdaboo/more-sharing-5591/twistedcaldav/static.py
===================================================================
--- CalendarServer/branches/users/cdaboo/more-sharing-5591/twistedcaldav/static.py 2010-05-14 16:12:27 UTC (rev 5599)
+++ CalendarServer/branches/users/cdaboo/more-sharing-5591/twistedcaldav/static.py 2010-05-14 16:19:04 UTC (rev 5600)
@@ -972,7 +972,7 @@
def provision(self):
result = super(CalendarHomeFile, self).provision()
- if config.Sharing.Enabled:
+ if config.Sharing.Enabled and config.Sharing.Calendars.Enabled:
self.provisionShares()
return result
@@ -987,7 +987,7 @@
else:
FreeBusyURLFileClass = None
- if config.Sharing.Enabled:
+ if config.Sharing.Enabled and config.Sharing.Calendars.Enabled:
NotificationCollectionFileClass = NotificationCollectionFile
else:
NotificationCollectionFileClass = None
@@ -1450,7 +1450,7 @@
def createSimilarFile(self, path):
raise HTTPError(responsecode.NOT_FOUND)
-class AddressBookHomeFile (AutoProvisioningFileMixIn, DirectoryAddressBookHomeResource, CalDAVFile):
+class AddressBookHomeFile (AutoProvisioningFileMixIn, SharedHomeMixin, DirectoryAddressBookHomeResource, CalDAVFile):
"""
Address book home collection resource.
"""
@@ -1472,22 +1472,13 @@
def provision(self):
result = super(AddressBookHomeFile, self).provision()
- self.provisionLinks()
+ if config.Sharing.Enabled and config.Sharing.AddressBooks.Enabled:
+ self.provisionShares()
return result
- def provisionLinks(self):
-
- if not hasattr(self, "_provisionedLinks"):
- if config.GlobalAddressBook.Enabled:
- self.putChild(
- config.GlobalAddressBook.Name,
- LinkResource(self, joinURL("/", config.GlobalAddressBook.Name, "/")),
- )
- self._provisionedLinks = True
-
def provisionChild(self, name):
- if config.Sharing.Enabled:
+ if config.Sharing.Enabled and config.Sharing.AddressBooks.Enabled and not config.Sharing.Calendars.Enabled:
NotificationCollectionFileClass = NotificationCollectionFile
else:
NotificationCollectionFileClass = None
Modified: CalendarServer/branches/users/cdaboo/more-sharing-5591/twistedcaldav/stdconfig.py
===================================================================
--- CalendarServer/branches/users/cdaboo/more-sharing-5591/twistedcaldav/stdconfig.py 2010-05-14 16:12:27 UTC (rev 5599)
+++ CalendarServer/branches/users/cdaboo/more-sharing-5591/twistedcaldav/stdconfig.py 2010-05-14 16:19:04 UTC (rev 5600)
@@ -337,7 +337,7 @@
"AllowScheduling" : False, # Scheduling in shared calendars
},
"AddressBooks" : {
- "Enabled" : False, # Address Books on/off switch
+ "Enabled" : True, # Address Books on/off switch
}
},
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20100514/b789b9a8/attachment-0001.html>
More information about the calendarserver-changes
mailing list