From 26f98bca9707340bb5a4ddf4d097c81bdb3118d7 Mon Sep 17 00:00:00 2001 From: antirez Date: Mon, 28 Jan 2019 12:33:14 +0100 Subject: [PATCH] ACL: Test: check default behavior and keys ACLs. --- tests/unit/acl.tcl | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/tests/unit/acl.tcl b/tests/unit/acl.tcl index 6e66e311..3f774ce1 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*} }