Gitlab Community Edition Instance
Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
cdstar
pycdstar3
Commits
70821c7e
Commit
70821c7e
authored
Jan 16, 2020
by
Marcel Hellkamp
Browse files
Require "acl set" to have at least one parameter
parent
cb8b97b4
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/pycdstar3/cli/commands/acl.py
View file @
70821c7e
...
...
@@ -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!"
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment