aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Sokolovsky <paul.sokolovsky@linaro.org>2013-12-15 10:47:21 +0200
committerPaul Sokolovsky <paul.sokolovsky@linaro.org>2013-12-15 10:47:21 +0200
commit35d5026934a75958c491c0eff2a0c01efe259879 (patch)
treed8cb2f5e2907c3152c1c480c7fdb8c1ad94c8334
parent310f9f22bf4965dfe921ccbf7d4ebaabd030aa98 (diff)
downloadcrowd-tool-35d5026934a75958c491c0eff2a0c01efe259879.tar.gz
Add "groupusers" command.
-rwxr-xr-xcrowd-tool13
1 files changed, 12 insertions, 1 deletions
diff --git a/crowd-tool b/crowd-tool
index e45386f..39da261 100755
--- a/crowd-tool
+++ b/crowd-tool
@@ -48,7 +48,7 @@ def rest(uri, params):
if __name__ == "__main__":
logging.basicConfig()
- optparser = optparse.OptionParser(usage="%prog user|alises|group|usergroups|ismember")
+ optparser = optparse.OptionParser(usage="%prog user|alises|group|usergroups|ismember|groupusers")
optparser.add_option("-u", "--user", default="rest-test", help="Crowd username")
optparser.add_option("-p", "--passwd", help="Crowd password")
optparser.add_option("-P", "--ask-passwd", action="store_true", help="Ask Crowd password")
@@ -83,6 +83,17 @@ if __name__ == "__main__":
for n in names:
print n
+ elif args[0] == "groupusers":
+ url = "/group/user/nested.json" if options.nested else "/group/user/direct.json"
+ data = rest(url, {"groupname": args[1]})
+ if options.raw:
+ pprint(data)
+ else:
+ names = [x["name"] for x in data["users"]]
+ names.sort()
+ for n in names:
+ print n
+
elif args[0] == "ismember":
url = "/user/group/nested.json" if options.nested else "/user/group/direct.json"
try: