This is like ACLSetUserCommandBit(), but instead of setting the specified * ID, it will check all the commands in the category specified as argument, * and will set all the bits corresponding to such commands to the specified * value. Since the category passed by the user may be non existing, the * function returns C_ERR if the category was not found, or C_OK if it was * found and the operati
| 412 | * function returns C_ERR if the category was not found, or C_OK if it was |
| 413 | * found and the operation was performed. */ |
| 414 | int ACLSetUserCommandBitsForCategory(user *u, const char *category, int value) { |
| 415 | uint64_t cflag = ACLGetCommandCategoryFlagByName(category); |
| 416 | if (!cflag) return C_ERR; |
| 417 | dictIterator *di = dictGetIterator(server.orig_commands); |
| 418 | dictEntry *de; |
| 419 | while ((de = dictNext(di)) != NULL) { |
| 420 | struct redisCommand *cmd = dictGetVal(de); |
| 421 | if (cmd->flags & CMD_MODULE) continue; /* Ignore modules commands. */ |
| 422 | if (cmd->flags & cflag) { |
| 423 | ACLSetUserCommandBit(u,cmd->id,value); |
| 424 | ACLResetSubcommandsForCommand(u,cmd->id); |
| 425 | } |
| 426 | } |
| 427 | dictReleaseIterator(di); |
| 428 | return C_OK; |
| 429 | } |
| 430 | |
| 431 | /* Return the number of commands allowed (on) and denied (off) for the user 'u' |
| 432 | * in the subset of commands flagged with the specified category name. |
no test coverage detected