Gitlab Community Edition Instance

Commit 70821c7e authored by Marcel Hellkamp's avatar Marcel Hellkamp
Browse files

Require "acl set" to have at least one parameter

parent cb8b97b4
......@@ -20,7 +20,7 @@ def register(subparsers):
pset.add_argument(
"ALLOW",
metavar="SUBJECT=ALLOW",
nargs="*",
nargs="+",
type=KvArgType("="),
help="Set archive level permissions for a subject. ALLOW can be a "
"comma-separated list of permission or permission-set names. Leave the "
......@@ -47,17 +47,14 @@ def acl_set(ctx, args):
changes = {}
for sub, allow in args.ALLOW:
all = changes.setdefault(sub, set())
if allow:
all.update(allow.split(","))
if sub:
changes.setdefault(sub, set()).update(filter(None, allow.split(",")))
update = FormUpdate()
for sub, allow in sorted(changes.items()):
update.acl(sub, *allow)
if len(allow):
ctx.print("ACL for {} => {}", sub, ", ".join(sorted(allow)))
else:
ctx.print("ACL for {} => [revoked]", sub)
plist = ", ".join(sorted(allow)) if allow else ""
ctx.print("{} => [{}]", sub, plist)
client.update_archive(vault, archive, form=update)
ctx.print("Done!")
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment