From f4c39db45022ce3177d8aea7873d40dbdf300da2 Mon Sep 17 00:00:00 2001 From: antirez Date: Mon, 28 Jan 2019 12:40:07 +0100 Subject: [PATCH] ACL: Test: nopass user flag, commands/groups +/- rules. --- tests/unit/acl.tcl | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/tests/unit/acl.tcl b/tests/unit/acl.tcl index 3f774ce1..d6645e26 100644 --- a/tests/unit/acl.tcl +++ b/tests/unit/acl.tcl @@ -54,4 +54,27 @@ start_server {tags {"acl"}} { r ACL setuser newuser allkeys; # Undo keys ACL set e } {*NOPERM*key*} + + test {Users can be configured to authenticate with any password} { + r ACL setuser newuser nopass + r AUTH newuser zipzapblabla + } {OK} + + test {ACLs can exclude single commands} { + r ACL setuser newuser -ping + r INCR mycounter ; # Should not raise an error + catch {r PING} e + set e + } {*NOPERM*} + + test {ACLs can include or excluse whole classes of commands} { + r ACL setuser newuser -@all +@set +acl + r SADD myset a b c; # Should not raise an error + r ACL setuser newuser +@all -@string + r SADD myset a b c; # Again should not raise an error + # String commands instead should raise an error + catch {r SET foo bar} e + r ACL setuser newuser allcommands; # Undo commands ACL + set e + } {*NOPERM*} }