[CalendarServer-changes] [6880] CalendarServer/trunk

source_changes at macosforge.org source_changes at macosforge.org
Fri Feb 4 10:58:12 PST 2011


Revision: 6880
          http://trac.macosforge.org/projects/calendarserver/changeset/6880
Author:   sagen at apple.com
Date:     2011-02-04 10:58:10 -0800 (Fri, 04 Feb 2011)
Log Message:
-----------
Adds --admin to calendarserver_monitor_notifications so an administrator can monitor notifications on behalf of another user.

Modified Paths:
--------------
    CalendarServer/trunk/calendarserver/tools/notifications.py
    CalendarServer/trunk/doc/calendarserver_monitor_notifications.8

Modified: CalendarServer/trunk/calendarserver/tools/notifications.py
===================================================================
--- CalendarServer/trunk/calendarserver/tools/notifications.py	2011-02-04 18:24:18 UTC (rev 6879)
+++ CalendarServer/trunk/calendarserver/tools/notifications.py	2011-02-04 18:58:10 UTC (rev 6880)
@@ -43,6 +43,7 @@
     print " Monitor push notification events from calendar server"
     print ""
     print "options:"
+    print "  -a --admin <username>: Specify an administrator username"
     print "  -f --config <path>: Specify caldavd.plist configuration path"
     print "  -h --help: print this help and exit"
     print "  -H --host <hostname>: calendar server host name"
@@ -61,7 +62,8 @@
 def main():
     try:
         (optargs, args) = getopt(
-            sys.argv[1:], "f:hH:p:sv", [
+            sys.argv[1:], "a:f:hH:p:sv", [
+                "admin=",
                 "config=",
                 "help",
                 "host=",
@@ -73,6 +75,7 @@
     except GetoptError, e:
         usage(e)
 
+    admin = None
     configFileName = None
     host = None
     port = None
@@ -84,6 +87,8 @@
             usage()
         elif opt in ("-f", "--config"):
             configFileName = arg
+        elif opt in ("-a", "--admin"):
+            admin = arg
         elif opt in ("-H", "--host"):
             host = arg
         elif opt in ("-p", "--port"):
@@ -115,10 +120,14 @@
     if port is None:
         usage("Must specify a port number")
 
-    password = getpass("Password for %s: " % (username,))
+    if admin:
+        password = getpass("Password for administrator %s: " % (admin,))
+    else:
+        password = getpass("Password for %s: " % (username,))
+        admin = username
 
-    monitorService = PushMonitorService(useSSL, host, port, username, password,
-        verbose)
+    monitorService = PushMonitorService(useSSL, host, port, admin, username,
+        password, verbose)
     reactor.addSystemEventTrigger("during", "startup",
         monitorService.startService)
     reactor.addSystemEventTrigger("before", "shutdown",
@@ -296,10 +305,11 @@
     using XMPP and monitored for updates.
     """
 
-    def __init__(self, useSSL, host, port, username, password, verbose):
+    def __init__(self, useSSL, host, port, authname, username, password, verbose):
         self.useSSL = useSSL
         self.host = host
         self.port = port
+        self.authname = authname
         self.username = username
         self.password = password
         self.verbose = verbose
@@ -526,18 +536,19 @@
 
     def startMonitoring(self, host, port, nodes):
         service = "pubsub.%s" % (host,)
-        jid = "%s@%s" % (self.username, host)
+        jid = "%s@%s" % (self.authname, host)
 
         pubsubFactory = PubSubClientFactory(jid, self.password, service, nodes,
             self.verbose)
         reactor.connectTCP(host, port, pubsubFactory)
 
+
     def makeRequest(self, path, method, headers, body):
         scheme = "https:" if self.useSSL else "http:"
         url = "%s//%s:%d/%s/" % (scheme, self.host, self.port, path)
         caldavFactory = client.HTTPClientFactory(url, method=method,
             headers=headers, postdata=body, agent="Push Monitor")
-        caldavFactory.username = self.username
+        caldavFactory.username = self.authname
         caldavFactory.password = self.password
         caldavFactory.noisy = False
         caldavFactory.protocol = PropfindRequestor

Modified: CalendarServer/trunk/doc/calendarserver_monitor_notifications.8
===================================================================
--- CalendarServer/trunk/doc/calendarserver_monitor_notifications.8	2011-02-04 18:24:18 UTC (rev 6879)
+++ CalendarServer/trunk/doc/calendarserver_monitor_notifications.8	2011-02-04 18:58:10 UTC (rev 6880)
@@ -22,20 +22,24 @@
 .Nd Darwin Calendar Server push notification monitor
 .Sh SYNOPSIS
 .Nm
+.Op Fl -admin Ar username
 .Op Fl -config Ar file
-.Op Fl -host AH hostname
-.Op Fl -port Ap port number
+.Op Fl -host Ar hostname
+.Op Fl -port Ar port-number
 .Op Fl -ssl
 .Op Fl -verbose
 .Op Fl -help
+.Ar username
 .Sh DESCRIPTION
 .Nm
-is a tool for making sure XMPP push notifications are working properly.  Given a username and password it will connect to the calendar server and determine which pubsub node(s) correspond to that user's calendar home, as well as those of any user which has delegated calendar access.  Next it will subscribe to those nodes and await notifications, printing them to stdout.  Exit by hitting Control-C.
+is a tool for making sure XMPP push notifications are working properly.  Given a username and password it will connect to the calendar server and determine which pubsub node(s) correspond to that user's calendar home, as well as those of any user which has delegated calendar access.  Next it will subscribe to those nodes and await notifications, printing them to stdout.  An administrator can monitor the push notifications for another user by passing the --admin option.  Exit by hitting Control-C.
 .Pp
 .Sh OPTIONS
 .Bl -tag -width flag
+.It Fl a, -admin
+Authenticate using the credentials of the given administrator.
 .It Fl h, -help
-Display usage information
+Display usage information.
 .It Fl f, -config Ar FILE
 Use the Calendar Server configuration specified in the given file.  Defaults to /etc/caldavd/caldavd.plist.
 .It Fl H, -host Ar HOSTNAME
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20110204/69a508e0/attachment-0001.html>


More information about the calendarserver-changes mailing list