[CalendarServer-changes] [4883] CalendarServer/trunk/calendarserver/tools/principals.py

source_changes at macosforge.org source_changes at macosforge.org
Fri Dec 18 11:28:32 PST 2009


Revision: 4883
          http://trac.macosforge.org/projects/calendarserver/changeset/4883
Author:   wsanchez at apple.com
Date:     2009-12-18 11:28:31 -0800 (Fri, 18 Dec 2009)
Log Message:
-----------
Add --list-principal-types

Modified Paths:
--------------
    CalendarServer/trunk/calendarserver/tools/principals.py

Modified: CalendarServer/trunk/calendarserver/tools/principals.py
===================================================================
--- CalendarServer/trunk/calendarserver/tools/principals.py	2009-12-17 22:07:20 UTC (rev 4882)
+++ CalendarServer/trunk/calendarserver/tools/principals.py	2009-12-18 19:28:31 UTC (rev 4883)
@@ -56,6 +56,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 ""
     print "  Performs the given actions against the giving principals."
@@ -71,6 +72,7 @@
     print ""
     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 "  --read-property=property: read DAV property (eg.: {DAV:}group-member-set)"
     print "  --list-read-proxies: list proxies with read-only access"
@@ -100,6 +102,7 @@
                 "help",
                 "config=",
                #"search=",
+                "list-principal-types",
                 "list-principals=",
                 "read-property=",
                 "list-read-proxies",
@@ -119,6 +122,7 @@
     # Get configuration
     #
     configFileName = None
+    listPrincipalTypes = False
     listPrincipals = None
     principalActions = []
 
@@ -129,6 +133,9 @@
         elif opt in ("-f", "--config"):
             configFileName = arg
 
+        elif opt in ("", "--list-principal-types"):
+            listPrincipalTypes = True
+
         elif opt in ("", "--list-principals"):
             listPrincipals = arg
 
@@ -211,6 +218,15 @@
     #
     # List principals
     #
+    if listPrincipalTypes:
+        if args:
+            usage("Too many arguments")
+
+        for recordType in config.directory.recordTypes():
+            print recordType
+
+        return
+
     if listPrincipals:
         if args:
             usage("Too many arguments")
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20091218/8e7ec956/attachment.html>


More information about the calendarserver-changes mailing list