• Roshan Khatri's avatar
    Allows modules to declare new ACL categories. (#12486) · 75199605
    Roshan Khatri authored
    
    
    This PR adds a new Module API int RM_AddACLCategory(RedisModuleCtx *ctx, const char *category_name) to add a new ACL command category.
    
    Here, we initialize the ACLCommandCategories array by allocating space for 64 categories and duplicate the 21 default categories from the predefined array 'ACLDefaultCommandCategories' into the ACLCommandCategories array while ACL initialization. Valid ACL category names can only contain alphanumeric characters, underscores, and dashes.
    
    The API when called, checks for the onload flag, category name validity, and for duplicate category name if present. If the conditions are satisfied, the API adds the new category to the trailing end of the ACLCommandCategories array and assigns the acl_categories flag bit according to the index at which the category is added.
    
    If any error is encountered the errno is set accordingly by the API.
    
    ---------
    Co-authored-by: default avatarMadelyn Olson <madelyneolson@gmail.com>
    75199605
aclcheck.c 12.4 KB