[CalendarServer-changes] [625] CalendarServer/branches/users/wsanchez/provisioning-2/twistedcaldav

source_changes at macosforge.org source_changes at macosforge.org
Thu Nov 30 18:44:36 PST 2006


Revision: 625
          http://trac.macosforge.org/projects/calendarserver/changeset/625
Author:   wsanchez at apple.com
Date:     2006-11-30 18:44:36 -0800 (Thu, 30 Nov 2006)

Log Message:
-----------
Comment out provisionCalendarAccount(); don't think we're going to need it.

Modified Paths:
--------------
    CalendarServer/branches/users/wsanchez/provisioning-2/twistedcaldav/repository.py
    CalendarServer/branches/users/wsanchez/provisioning-2/twistedcaldav/static.py

Modified: CalendarServer/branches/users/wsanchez/provisioning-2/twistedcaldav/repository.py
===================================================================
--- CalendarServer/branches/users/wsanchez/provisioning-2/twistedcaldav/repository.py	2006-12-01 02:32:01 UTC (rev 624)
+++ CalendarServer/branches/users/wsanchez/provisioning-2/twistedcaldav/repository.py	2006-12-01 02:44:36 UTC (rev 625)
@@ -738,44 +738,6 @@
                 for ctr in range(1, repeat+1):
                     self.provisionOne(principal.repeat(ctr), resetACLs)
     
-    def provisionOne(self, item, resetACLs):
-        """
-        Provision one user account/
-        @param item:      The account to provision.
-        @param resetACLs: if True, ACL privileges on all resources related to the
-            accounts being created are reset, if False no ACL privileges are changed.
-        """
-        principalURL = joinURL(self.accountCollection.uri, item.uid)
-
-        # Create principal resource
-        principal = FilePath(os.path.join(self.accountCollection.resource.fp.path, item.uid))
-        principal_exists = principal.exists()
-        if not principal_exists:
-            principal.open("w").close()
-            log.msg("Created principal: %s" % principalURL)
-        principal = CalendarPrincipalFile(principal.path, principalURL)
-        
-        # Special case: if we have an explicit cuhome URL, we will use that,
-        # otherwise we fall back to the inferred home and resource
-        if item.cuhome:
-            cuhome = (item.cuhome, None)
-        else:
-            cuhome = (self.calendarHome.uri, self.calendarHome.resource)
-            
-        # Principal knows how to provision itself in the appropriate manner
-        principal.provisionCalendarAccount(
-            item.name,
-            item.pswd,
-            resetACLs or not principal_exists,
-            item.cuaddrs,
-            cuhome,
-            item.acl,
-            item.quota,
-            item.calendars,
-            item.autorespond,
-            True
-            )
-
 class ProvisionPrincipal (object):
     """
     Contains provision information for one user.

Modified: CalendarServer/branches/users/wsanchez/provisioning-2/twistedcaldav/static.py
===================================================================
--- CalendarServer/branches/users/wsanchez/provisioning-2/twistedcaldav/static.py	2006-12-01 02:32:01 UTC (rev 624)
+++ CalendarServer/branches/users/wsanchez/provisioning-2/twistedcaldav/static.py	2006-12-01 02:44:36 UTC (rev 625)
@@ -774,146 +774,146 @@
         """
         return self.fp.basename()
 
-    def provisionCalendarAccount(self, name, pswd, resetacl, cuaddrs, cuhome, cuhomeacls, quota, cals, autorespond, allowdropbox):
-        """
-        Provision the principal and a calendar account for it.
-        
-        @param name: C{str} name (uid) of principal.
-        @param pswd: C{str} password for BASIC authentication, or C{None}.
-        @param resetacl: C{True} if ACLs on the principal resource should be reset.
-        @param cuaddrs: C{list} list of calendar user addresses, or C{None}
-        @param cuhome: C{tuple} of (C{str} - URI of calendar home root, L{DAVResource} - resource of home root)
-        @param cuhomeacls: L{ACL} acls to use on calendar home when resetting ACLs, or C{None} to use default set.
-        @param cals: C{list} list of calendar names to create in the calendar home for this prinicpal.
-        @param autorespond: C{True} if iTIP auto-response is required, C{False} otherwise.
-        @param allowdropbox: C{True} if drop box should be enabled for this user is drop box is supproted, C{False} otherwise.
-        """
-        
-        if pswd:
-            self.writeDeadProperty(TwistedPasswordProperty.fromString(pswd))
-        else:
-            self.removeDeadProperty(TwistedPasswordProperty())
-        if name:
-            self.writeDeadProperty(davxml.DisplayName.fromString(name))
-        else:
-            self.removeDeadProperty(davxml.DisplayName())
-        if cuaddrs:
-            self.writeDeadProperty(caldavxml.CalendarUserAddressSet(*[davxml.HRef(addr) for addr in cuaddrs]))
-        else:
-            self.removeDeadProperty(caldavxml.CalendarUserAddressSet())
+    # def provisionCalendarAccount(self, name, pswd, resetacl, cuaddrs, cuhome, cuhomeacls, quota, cals, autorespond, allowdropbox):
+    #     """
+    #     Provision the principal and a calendar account for it.
+    #     
+    #     @param name: C{str} name (uid) of principal.
+    #     @param pswd: C{str} password for BASIC authentication, or C{None}.
+    #     @param resetacl: C{True} if ACLs on the principal resource should be reset.
+    #     @param cuaddrs: C{list} list of calendar user addresses, or C{None}
+    #     @param cuhome: C{tuple} of (C{str} - URI of calendar home root, L{DAVResource} - resource of home root)
+    #     @param cuhomeacls: L{ACL} acls to use on calendar home when resetting ACLs, or C{None} to use default set.
+    #     @param cals: C{list} list of calendar names to create in the calendar home for this prinicpal.
+    #     @param autorespond: C{True} if iTIP auto-response is required, C{False} otherwise.
+    #     @param allowdropbox: C{True} if drop box should be enabled for this user is drop box is supproted, C{False} otherwise.
+    #     """
+    #     
+    #     if pswd:
+    #         self.writeDeadProperty(TwistedPasswordProperty.fromString(pswd))
+    #     else:
+    #         self.removeDeadProperty(TwistedPasswordProperty())
+    #     if name:
+    #         self.writeDeadProperty(davxml.DisplayName.fromString(name))
+    #     else:
+    #         self.removeDeadProperty(davxml.DisplayName())
+    #     if cuaddrs:
+    #         self.writeDeadProperty(caldavxml.CalendarUserAddressSet(*[davxml.HRef(addr) for addr in cuaddrs]))
+    #     else:
+    #         self.removeDeadProperty(caldavxml.CalendarUserAddressSet())
+    # 
+    #     if resetacl:
+    #         self.setAccessControlList(
+    #             davxml.ACL(
+    #                 davxml.ACE(
+    #                     davxml.Principal(davxml.HRef.fromString(self._url)),
+    #                     davxml.Grant(
+    #                         davxml.Privilege(davxml.Read()),
+    #                     ),
+    #                 ),
+    #             )
+    #         )
+    # 
+    #     # If the user does not have any calendar user addresses we do not create a calendar home for them
+    #     if not cuaddrs and not cals:
+    #         return
+    # 
+    #     # Create calendar home if we already have the resource, otherwise simply record
+    #     # the URL as the calendar-home-set
+    #     if cuhome[1] is None:
+    #         self.writeDeadProperty(caldavxml.CalendarHomeSet(davxml.HRef.fromString(cuhome[0])))
+    #     else:
+    #         homeURL = joinURL(cuhome[0], self.principalUID())
+    #         home = FilePath(os.path.join(cuhome[1].fp.path, self.principalUID()))
+    #         home_exists = home.exists()
+    #         if not home_exists:
+    #             home.createDirectory()
+    #         home = CalendarHomeFile(home.path)
+    # 
+    #         if resetacl or not home_exists:
+    #             if cuhomeacls:
+    #                 home.setAccessControlList(cuhomeacls.acl)
+    #             else:
+    #                 home.setAccessControlList(
+    #                     davxml.ACL(
+    #                         davxml.ACE(
+    #                             davxml.Principal(davxml.Authenticated()),
+    #                             davxml.Grant(
+    #                                 davxml.Privilege(davxml.Read()),
+    #                             ),
+    #                         ),
+    #                         davxml.ACE(
+    #                             davxml.Principal(davxml.HRef.fromString(self._url)),
+    #                             davxml.Grant(
+    #                                 davxml.Privilege(davxml.All()),
+    #                             ),
+    #                             TwistedACLInheritable(),
+    #                         ),
+    #                     )
+    #                 )
+    #         
+    #         # Handle quota on calendar home
+    #         home.setQuotaRoot(None, quota)
+    #     
+    #         # Save the calendar-home-set, schedule-inbox and schedule-outbox properties
+    #         self.writeDeadProperty(caldavxml.CalendarHomeSet(davxml.HRef.fromString(homeURL + "/")))
+    #         self.writeDeadProperty(caldavxml.ScheduleInboxURL(davxml.HRef.fromString(joinURL(homeURL, "inbox/"))))
+    #         self.writeDeadProperty(caldavxml.ScheduleOutboxURL(davxml.HRef.fromString(joinURL(homeURL, "outbox/"))))
+    #         
+    #         # Set ACLs on inbox and outbox
+    #         if resetacl or not home_exists:
+    #             inbox = home.getChild("inbox")
+    #             inbox.setAccessControlList(
+    #                 davxml.ACL(
+    #                     davxml.ACE(
+    #                         davxml.Principal(davxml.Authenticated()),
+    #                         davxml.Grant(
+    #                             davxml.Privilege(caldavxml.Schedule()),
+    #                         ),
+    #                     ),
+    #                 )
+    #             )
+    #             if autorespond:
+    #                 inbox.writeDeadProperty(customxml.TwistedScheduleAutoRespond())
+    # 
+    #             outbox = home.getChild("outbox")
+    #             if outbox.hasDeadProperty(davxml.ACL()):
+    #                 outbox.removeDeadProperty(davxml.ACL())
+    # 
+    #         calendars = []
+    #         for calendar in cals:
+    #             childURL = joinURL(homeURL, calendar)
+    #             child = CalDAVFile(os.path.join(home.fp.path, calendar))
+    #             child_exists = child.exists()
+    #             if not child_exists:
+    #                 c = child.createCalendarCollection()
+    #                 assert c.called
+    #                 c = c.result
+    #             calendars.append(childURL)
+    #             if (resetacl or not child_exists):
+    #                 child.setAccessControlList(
+    #                     davxml.ACL(
+    #                         davxml.ACE(
+    #                             davxml.Principal(davxml.Authenticated()),
+    #                             davxml.Grant(
+    #                                 davxml.Privilege(caldavxml.ReadFreeBusy()),
+    #                             ),
+    #                             TwistedACLInheritable(),
+    #                         ),
+    #                     )
+    #                 )
+    #         
+    #         # Set calendar-free-busy-set on Inbox if not already present
+    #         inbox = home.getChild("inbox")
+    #         if not inbox.hasDeadProperty(caldavxml.CalendarFreeBusySet()):
+    #             fbset = caldavxml.CalendarFreeBusySet(*[davxml.HRef.fromString(uri) for uri in calendars])
+    #             inbox.writeDeadProperty(fbset)
+    #             
+    #         # Do drop box if requested
+    #         if allowdropbox:
+    #             from twistedcaldav.dropbox import DropBox
+    #             DropBox.provision(self, (homeURL, home))
 
-        if resetacl:
-            self.setAccessControlList(
-                davxml.ACL(
-                    davxml.ACE(
-                        davxml.Principal(davxml.HRef.fromString(self._url)),
-                        davxml.Grant(
-                            davxml.Privilege(davxml.Read()),
-                        ),
-                    ),
-                )
-            )
-
-        # If the user does not have any calendar user addresses we do not create a calendar home for them
-        if not cuaddrs and not cals:
-            return
-
-        # Create calendar home if we already have the resource, otherwise simply record
-        # the URL as the calendar-home-set
-        if cuhome[1] is None:
-            self.writeDeadProperty(caldavxml.CalendarHomeSet(davxml.HRef.fromString(cuhome[0])))
-        else:
-            homeURL = joinURL(cuhome[0], self.principalUID())
-            home = FilePath(os.path.join(cuhome[1].fp.path, self.principalUID()))
-            home_exists = home.exists()
-            if not home_exists:
-                home.createDirectory()
-            home = CalendarHomeFile(home.path)
-    
-            if resetacl or not home_exists:
-                if cuhomeacls:
-                    home.setAccessControlList(cuhomeacls.acl)
-                else:
-                    home.setAccessControlList(
-                        davxml.ACL(
-                            davxml.ACE(
-                                davxml.Principal(davxml.Authenticated()),
-                                davxml.Grant(
-                                    davxml.Privilege(davxml.Read()),
-                                ),
-                            ),
-                            davxml.ACE(
-                                davxml.Principal(davxml.HRef.fromString(self._url)),
-                                davxml.Grant(
-                                    davxml.Privilege(davxml.All()),
-                                ),
-                                TwistedACLInheritable(),
-                            ),
-                        )
-                    )
-            
-            # Handle quota on calendar home
-            home.setQuotaRoot(None, quota)
-        
-            # Save the calendar-home-set, schedule-inbox and schedule-outbox properties
-            self.writeDeadProperty(caldavxml.CalendarHomeSet(davxml.HRef.fromString(homeURL + "/")))
-            self.writeDeadProperty(caldavxml.ScheduleInboxURL(davxml.HRef.fromString(joinURL(homeURL, "inbox/"))))
-            self.writeDeadProperty(caldavxml.ScheduleOutboxURL(davxml.HRef.fromString(joinURL(homeURL, "outbox/"))))
-            
-            # Set ACLs on inbox and outbox
-            if resetacl or not home_exists:
-                inbox = home.getChild("inbox")
-                inbox.setAccessControlList(
-                    davxml.ACL(
-                        davxml.ACE(
-                            davxml.Principal(davxml.Authenticated()),
-                            davxml.Grant(
-                                davxml.Privilege(caldavxml.Schedule()),
-                            ),
-                        ),
-                    )
-                )
-                if autorespond:
-                    inbox.writeDeadProperty(customxml.TwistedScheduleAutoRespond())
-    
-                outbox = home.getChild("outbox")
-                if outbox.hasDeadProperty(davxml.ACL()):
-                    outbox.removeDeadProperty(davxml.ACL())
-    
-            calendars = []
-            for calendar in cals:
-                childURL = joinURL(homeURL, calendar)
-                child = CalDAVFile(os.path.join(home.fp.path, calendar))
-                child_exists = child.exists()
-                if not child_exists:
-                    c = child.createCalendarCollection()
-                    assert c.called
-                    c = c.result
-                calendars.append(childURL)
-                if (resetacl or not child_exists):
-                    child.setAccessControlList(
-                        davxml.ACL(
-                            davxml.ACE(
-                                davxml.Principal(davxml.Authenticated()),
-                                davxml.Grant(
-                                    davxml.Privilege(caldavxml.ReadFreeBusy()),
-                                ),
-                                TwistedACLInheritable(),
-                            ),
-                        )
-                    )
-            
-            # Set calendar-free-busy-set on Inbox if not already present
-            inbox = home.getChild("inbox")
-            if not inbox.hasDeadProperty(caldavxml.CalendarFreeBusySet()):
-                fbset = caldavxml.CalendarFreeBusySet(*[davxml.HRef.fromString(uri) for uri in calendars])
-                inbox.writeDeadProperty(fbset)
-                
-            # Do drop box if requested
-            if allowdropbox:
-                from twistedcaldav.dropbox import DropBox
-                DropBox.provision(self, (homeURL, home))
-
 ##
 # Utilities
 ##

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20061130/d1006c12/attachment.html


More information about the calendarserver-changes mailing list