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
| 421 | * function returns C_ERR if the category was not found, or C_OK if it was |
| 422 | * found and the operation was performed. */ |
| 423 | int ACLSetUserCommandBitsForCategory(user *u, const char *category, int value) { |
| 424 | uint64_t cflag = ACLGetCommandCategoryFlagByName(category); |
| 425 | if (!cflag) return C_ERR; |
| 426 | dictIterator *di = dictGetIterator(g_pserver->orig_commands); |
| 427 | dictEntry *de; |
| 428 | while ((de = dictNext(di)) != NULL) { |
| 429 | struct redisCommand *cmd = (redisCommand*)dictGetVal(de); |
| 430 | if (cmd->flags & CMD_MODULE) continue; /* Ignore modules commands. */ |
| 431 | if (cmd->flags & cflag) { |
| 432 | ACLSetUserCommandBit(u,cmd->id,value); |
| 433 | ACLResetSubcommandsForCommand(u,cmd->id); |
| 434 | } |
| 435 | } |
| 436 | dictReleaseIterator(di); |
| 437 | return C_OK; |
| 438 | } |
| 439 | |
| 440 | /* Return the number of commands allowed (on) and denied (off) for the user 'u' |
| 441 | * in the subset of commands flagged with the specified category name. |
no test coverage detected