MCPcopy Create free account
hub / github.com/F-Stack/f-stack / ACLSetUserCommandBitsForCategory

Function ACLSetUserCommandBitsForCategory

app/redis-6.2.6/src/acl.c:414–429  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

412 * function returns C_ERR if the category was not found, or C_OK if it was
413 * found and the operation was performed. */
414int 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.

Callers 1

ACLSetUserFunction · 0.85

Calls 6

ACLSetUserCommandBitFunction · 0.85
dictGetIteratorFunction · 0.70
dictNextFunction · 0.70
dictReleaseIteratorFunction · 0.70

Tested by

no test coverage detected