Commit 77471dfe authored by antirez's avatar antirez
Browse files

ACL: implement keys field in ACL GETUSER.

parent f021da5e
...@@ -850,7 +850,7 @@ void aclCommand(client *c) { ...@@ -850,7 +850,7 @@ void aclCommand(client *c) {
return; return;
} }
addReplyMapLen(c,3); addReplyMapLen(c,4);
/* Flags */ /* Flags */
addReplyBulkCString(c,"flags"); addReplyBulkCString(c,"flags");
...@@ -892,6 +892,22 @@ void aclCommand(client *c) { ...@@ -892,6 +892,22 @@ void aclCommand(client *c) {
addReplyBulkCString(c,"commands"); addReplyBulkCString(c,"commands");
sds cmddescr = ACLDescribeUserCommandRules(u); sds cmddescr = ACLDescribeUserCommandRules(u);
addReplyBulkSds(c,cmddescr); addReplyBulkSds(c,cmddescr);
/* Key patterns */
addReplyBulkCString(c,"keys");
if (u->flags & USER_FLAG_ALLKEYS) {
addReplyArrayLen(c,1);
addReplyBulkCBuffer(c,"*",1);
} else {
addReplyArrayLen(c,listLength(u->patterns));
listIter li;
listNode *ln;
listRewind(u->patterns,&li);
while((ln = listNext(&li))) {
sds thispat = listNodeValue(ln);
addReplyBulkCBuffer(c,thispat,sdslen(thispat));
}
}
} else if (!strcasecmp(sub,"help")) { } else if (!strcasecmp(sub,"help")) {
const char *help[] = { const char *help[] = {
"LIST -- List all the registered users.", "LIST -- List all the registered users.",
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment