[CalendarServer-changes] [5395] CalendarServer/trunk

source_changes at macosforge.org source_changes at macosforge.org
Wed Mar 24 20:37:43 PDT 2010


Revision: 5395
          http://trac.macosforge.org/projects/calendarserver/changeset/5395
Author:   sagen at apple.com
Date:     2010-03-24 20:37:42 -0700 (Wed, 24 Mar 2010)
Log Message:
-----------
Enable --list-principals in calendarserver_manage_principals

Modified Paths:
--------------
    CalendarServer/trunk/calendarserver/tools/principals.py
    CalendarServer/trunk/calendarserver/tools/test/test_principals.py
    CalendarServer/trunk/doc/calendarserver_manage_principals.8

Modified: CalendarServer/trunk/calendarserver/tools/principals.py
===================================================================
--- CalendarServer/trunk/calendarserver/tools/principals.py	2010-03-25 03:29:38 UTC (rev 5394)
+++ CalendarServer/trunk/calendarserver/tools/principals.py	2010-03-25 03:37:42 UTC (rev 5395)
@@ -51,7 +51,7 @@
     name = os.path.basename(sys.argv[0])
     print "usage: %s [options] action_flags principal [principal ...]" % (name,)
     print "       %s [options] --list-principal-types" % (name,)
-   #print "       %s [options] --list-principals type" % (name,)
+    print "       %s [options] --list-principals type" % (name,)
     print ""
     print "  Performs the given actions against the giving principals."
     print ""
@@ -67,7 +67,7 @@
     print "actions:"
    #print "  --search <search-string>: search for matching resources"
     print "  --list-principal-types: list all of the known principal types"
-   #print "  --list-principals=type: list all principals of the given type"
+    print "  --list-principals type: list all principals of the given type"
     print "  --read-property=property: read DAV property (eg.: {DAV:}group-member-set)"
     print "  --list-read-proxies: list proxies with read-only access"
     print "  --list-write-proxies: list proxies with read-write access"
@@ -228,8 +228,10 @@
             usage("Too many arguments")
 
         try:
-            for record in config.directory.listRecords(listPrincipals):
-                print record
+            results = [(record.fullName, record.guid) for record in config.directory.listRecords(listPrincipals)]
+            results.sort()
+            for name, guid in results:
+                print '%s %s' % (name, guid)
         except UnknownRecordTypeError, e:
             usage(e)
 

Modified: CalendarServer/trunk/calendarserver/tools/test/test_principals.py
===================================================================
--- CalendarServer/trunk/calendarserver/tools/test/test_principals.py	2010-03-25 03:29:38 UTC (rev 5394)
+++ CalendarServer/trunk/calendarserver/tools/test/test_principals.py	2010-03-25 03:37:42 UTC (rev 5395)
@@ -99,6 +99,12 @@
         self.assertTrue("resources" in results)
 
     @inlineCallbacks
+    def test_listPrincipals(self):
+        results = yield self.runCommand("--list-principals=users")
+        for i in xrange(1, 10):
+            self.assertTrue("user%02d" % (i,) in results)
+
+    @inlineCallbacks
     def test_modifyWriteProxies(self):
         results = yield self.runCommand("--add-write-proxy=users:user01",
             "locations:location01")

Modified: CalendarServer/trunk/doc/calendarserver_manage_principals.8
===================================================================
--- CalendarServer/trunk/doc/calendarserver_manage_principals.8	2010-03-25 03:29:38 UTC (rev 5394)
+++ CalendarServer/trunk/doc/calendarserver_manage_principals.8	2010-03-25 03:37:42 UTC (rev 5395)
@@ -24,6 +24,8 @@
 .Nm
 .Op Fl -config Ar file
 .Op Fl -read-property Ar property
+.Op Fl -list-principal-types
+.Op Fl -list-principals Ar type
 .Op Fl -list-read-proxies
 .Op Fl -list-write-proxies
 .Op Fl -list-proxies
@@ -83,6 +85,10 @@
 .Ar {namespace}name ,
 for example:
 .Ar {DAV:}displayname .
+.It Fl -list-principal-types
+List all of the known principals types.
+.It Fl -list-principals Ar type
+List all of the principals of the given type.
 .It Fl -list-read-proxies
 List the read proxies.
 .It Fl -list-write-proxies
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20100324/ff3751d8/attachment.html>


More information about the calendarserver-changes mailing list