aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Sokolovsky <paul.sokolovsky@linaro.org>2013-12-15 10:54:39 +0200
committerPaul Sokolovsky <paul.sokolovsky@linaro.org>2013-12-15 10:54:39 +0200
commit15037aec0c74bcb343a23f8ed83d0c0b4cceb699 (patch)
tree77dc6c1e335c749d7e0ad898824669a06ff43819
parent35d5026934a75958c491c0eff2a0c01efe259879 (diff)
downloadcrowd-tool-15037aec0c74bcb343a23f8ed83d0c0b4cceb699.tar.gz
Add "groupgroups" command.
-rwxr-xr-xcrowd-tool13
1 files changed, 12 insertions, 1 deletions
diff --git a/crowd-tool b/crowd-tool
index 39da261..2429e25 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|groupusers")
+ optparser = optparse.OptionParser(usage="%prog user|alises|group|usergroups|ismember|groupusers|groupgroups")
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")
@@ -94,6 +94,17 @@ if __name__ == "__main__":
for n in names:
print n
+ elif args[0] == "groupgroups":
+ url = "/group/child-group/nested.json" if options.nested else "/group/child-group/direct.json"
+ data = rest(url, {"groupname": args[1]})
+ if options.raw:
+ pprint(data)
+ else:
+ names = [x["name"] for x in data["groups"]]
+ 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: