Fix acl dryrun to return the tested common permission error. (#10359)

This commit is contained in:
Harkrishn Patro 2022-03-01 05:26:58 +01:00 committed by GitHub
parent dff153ff24
commit 21aabab401
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 1 deletions

View File

@ -2799,7 +2799,7 @@ setuser_cleanup:
sds err = sdsempty();
if (result == ACL_DENIED_CMD) {
err = sdscatfmt(err, "This user has no permissions to run "
"the '%s' command", c->cmd->fullname);
"the '%s' command", cmd->fullname);
} else if (result == ACL_DENIED_KEY) {
err = sdscatfmt(err, "This user has no permissions to access "
"the '%s' key", c->argv[idx + 3]->ptr);

View File

@ -305,6 +305,12 @@ start_server {tags {"acl external:skip"}} {
assert_equal "ERR Command 'not-a-command' not found" $e
}
test {Test various commands for command permissions} {
r ACL setuser command-test -@all
assert_equal "This user has no permissions to run the 'set' command" [r ACL DRYRUN command-test set somekey somevalue]
assert_equal "This user has no permissions to run the 'get' command" [r ACL DRYRUN command-test get somekey]
}
test {Test various odd commands for key permissions} {
r ACL setuser command-test +@all %R~read* %W~write* %RW~rw*