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
| 6491 | * wants to invalidate the user to define a new one with different |
| 6492 | * capabilities. */ |
| 6493 | RedisModuleUser *RM_CreateModuleUser(const char *name) { |
| 6494 | RedisModuleUser *new_user = zmalloc(sizeof(RedisModuleUser)); |
| 6495 | new_user->user = ACLCreateUnlinkedUser(); |
| 6496 | |
| 6497 | /* Free the previous temporarily assigned name to assign the new one */ |
| 6498 | sdsfree(new_user->user->name); |
| 6499 | new_user->user->name = sdsnew(name); |
| 6500 | return new_user; |
| 6501 | } |
| 6502 | |
| 6503 | /* Frees a given user and disconnects all of the clients that have been |
| 6504 | * authenticated with it. See RM_CreateModuleUser for detailed usage.*/ |
nothing calls this directly
no test coverage detected