summaryrefslogtreecommitdiff
path: root/tests/unit/acl.tcl
diff options
context:
space:
mode:
authorantirez <antirez@gmail.com>2019-01-28 12:33:14 +0100
committerantirez <antirez@gmail.com>2019-01-28 12:33:18 +0100
commit26f98bca9707340bb5a4ddf4d097c81bdb3118d7 (patch)
tree9baf76d1e7bbb5ac1c981a2fd901ac7ab7859638 /tests/unit/acl.tcl
parent6320aa49f38bbba1fa265942b47a8a5ef4f3b4e3 (diff)
downloadredis-26f98bca9707340bb5a4ddf4d097c81bdb3118d7.tar.gz
ACL: Test: check default behavior and keys ACLs.
Diffstat (limited to 'tests/unit/acl.tcl')
-rw-r--r--tests/unit/acl.tcl20
1 files changed, 20 insertions, 0 deletions
diff --git a/tests/unit/acl.tcl b/tests/unit/acl.tcl
index 6e66e3116..3f774ce13 100644
--- a/tests/unit/acl.tcl
+++ b/tests/unit/acl.tcl
@@ -34,4 +34,24 @@ start_server {tags {"acl"}} {
catch {r AUTH newuser passwd1} e
set e
} {*WRONGPASS*}
+
+ test {By default users are not able to access any command} {
+ catch {r SET foo bar} e
+ set e
+ } {*NOPERM*}
+
+ test {By default users are not able to access any key} {
+ r ACL setuser newuser +set
+ catch {r SET foo bar} e
+ set e
+ } {*NOPERM*key*}
+
+ test {It's possible to allow the access of a subset of keys} {
+ r ACL setuser newuser allcommands ~foo:* ~bar:*
+ r SET foo:1 a
+ r SET bar:2 b
+ catch {r SET zap:3 c} e
+ r ACL setuser newuser allkeys; # Undo keys ACL
+ set e
+ } {*NOPERM*key*}
}