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
| 6683 | * wants to invalidate the user to define a new one with different |
| 6684 | * capabilities. */ |
| 6685 | RedisModuleUser *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.*/ |
nothing calls this directly
no test coverage detected