MCPcopy Create free account
hub / github.com/Snapchat/KeyDB / RM_CreateModuleUser

Function RM_CreateModuleUser

src/module.cpp:6685–6693  ·  view source on GitHub ↗

Creates a Redis ACL user that the module can use to authenticate a client. * After obtaining the user, the module should set what such user can do * using the RM_SetUserACL() function. Once configured, the user * can be used in order to authenticate a connection, with the specified * ACL rules, using the RedisModule_AuthClientWithUser() function. * * Note that: * * * Users created here are

Source from the content-addressed store, hash-verified

6683 * wants to invalidate the user to define a new one with different
6684 * capabilities. */
6685RedisModuleUser *RM_CreateModuleUser(const char *name) {
6686 RedisModuleUser *new_user = (RedisModuleUser*)zmalloc(sizeof(RedisModuleUser));
6687 new_user->user = ACLCreateUnlinkedUser();
6688
6689 /* Free the previous temporarily assigned name to assign the new one */
6690 sdsfree(new_user->user->name);
6691 new_user->user->name = sdsnew(name);
6692 return new_user;
6693}
6694
6695/* Frees a given user and disconnects all of the clients that have been
6696 * authenticated with it. See RM_CreateModuleUser for detailed usage.*/

Callers

nothing calls this directly

Calls 4

zmallocFunction · 0.85
ACLCreateUnlinkedUserFunction · 0.85
sdsfreeFunction · 0.85
sdsnewFunction · 0.85

Tested by

no test coverage detected