[CalendarServer-changes] [14123] CalendarServer/trunk/calendarserver/tools
source_changes at macosforge.org
source_changes at macosforge.org
Thu Oct 30 08:42:58 PDT 2014
Revision: 14123
http://trac.calendarserver.org//changeset/14123
Author: sagen at apple.com
Date: 2014-10-30 08:42:58 -0700 (Thu, 30 Oct 2014)
Log Message:
-----------
csmp --print-group-info now takes args so you can inspect individual groups (no args means it will print info about all delegated-to groups)
Modified Paths:
--------------
CalendarServer/trunk/calendarserver/tools/principals.py
CalendarServer/trunk/calendarserver/tools/util.py
Modified: CalendarServer/trunk/calendarserver/tools/principals.py
===================================================================
--- CalendarServer/trunk/calendarserver/tools/principals.py 2014-10-29 20:28:29 UTC (rev 14122)
+++ CalendarServer/trunk/calendarserver/tools/principals.py 2014-10-30 15:42:58 UTC (rev 14123)
@@ -95,6 +95,7 @@
print(" --set-address=guid: associate principal with an address (by guid)")
print(" --get-address: get the associated address's guid")
print(" --refresh-groups: schedule a group membership refresh")
+ print(" --print-group-info <group principals>: prints group delegation and membership")
if e:
sys.exit(64)
@@ -308,7 +309,7 @@
elif printGroupInfo:
function = printGroupCacherInfo
- params = ()
+ params = (args,)
elif scheduleGroupRefresh:
function = scheduleGroupRefreshJob
@@ -757,14 +758,22 @@
@inlineCallbacks
-def printGroupCacherInfo(service, store):
+def printGroupCacherInfo(service, store, principalIDs):
"""
Print all groups that have been delegated to, their cached members, and
who delegated to those groups.
"""
directory = store.directoryService()
txn = store.newTransaction()
- groupUIDs = yield txn.allGroupDelegates()
+ if not principalIDs:
+ groupUIDs = yield txn.allGroupDelegates()
+ else:
+ groupUIDs = []
+ for principalID in principalIDs:
+ record = yield recordForPrincipalID(directory, principalID)
+ if record:
+ groupUIDs.append(record.uid)
+
for groupUID in groupUIDs:
(
groupID, name, _ignore_membershipHash, modified, _ignore_extant
Modified: CalendarServer/trunk/calendarserver/tools/util.py
===================================================================
--- CalendarServer/trunk/calendarserver/tools/util.py 2014-10-29 20:28:29 UTC (rev 14122)
+++ CalendarServer/trunk/calendarserver/tools/util.py 2014-10-30 15:42:58 UTC (rev 14123)
@@ -439,10 +439,10 @@
except AttributeError:
shortNames = []
return "\"{d}\" {uid} ({rt}) {sn}".format(
- d=record.displayName,
+ d=record.displayName.encode("utf-8"),
rt=record.recordType.name,
uid=record.uid,
- sn=(", ".join(shortNames))
+ sn=(", ".join([sn.encode("utf-8") for sn in shortNames]))
)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20141030/1d83c3d1/attachment-0001.html>
More information about the calendarserver-changes
mailing list