Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ruanhaishen
redis
Commits
f021da5e
Commit
f021da5e
authored
Jan 30, 2019
by
antirez
Browse files
Acl: Test: check command rules synthesis.
parent
9db2c849
Changes
1
Hide whitespace changes
Inline
Side-by-side
tests/unit/acl.tcl
View file @
f021da5e
...
...
@@ -86,4 +86,26 @@ start_server {tags {"acl"}} {
catch
{
r CLIENT KILL type master
}
e
set e
}
{
*NOPERM*
}
# Note that the order of the generated ACL rules is not stable in Redis
# so we need to match the different parts and not as a whole string.
test
{
ACL GETUSER is able to translate back command permissions
}
{
# Subtractive
r ACL setuser newuser reset +@all ~* -@string +incr -debug +debug|digest
set cmdstr
[
dict get
[
r ACL getuser newuser
]
commands
]
assert_match
{
*+@all*
}
$cmdstr
assert_match
{
*-@string*
}
$cmdstr
assert_match
{
*+incr*
}
$cmdstr
assert_match
{
*-debug +debug|digest**
}
$cmdstr
# Additive
r ACL setuser newuser reset +@string -incr +acl +debug|digest +debug|segfault
set cmdstr
[
dict get
[
r ACL getuser newuser
]
commands
]
assert_match
{
*-@all*
}
$cmdstr
assert_match
{
*+@string*
}
$cmdstr
assert_match
{
*-incr*
}
$cmdstr
assert_match
{
*+debug|digest*
}
$cmdstr
assert_match
{
*+debug|segfault*
}
$cmdstr
assert_match
{
*+acl*
}
$cmdstr
}
}
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