Checks whether a given user ID is valid and safe for use in file paths.
A valid user ID consists of only alphanumeric characters and underscores.
This function is used to prevent unsafe input that could lead to directory
traversal attacks or file system misuse.
Usage
is_valid_user_id(user_id)
Arguments
- user_id
A character string representing the user ID.
Value
A logical value: `TRUE` if the user ID is valid, `FALSE` otherwise.
Examples
is_valid_user_id("user123") # TRUE
#> [1] TRUE
is_valid_user_id("user-abc") # FALSE
#> [1] TRUE
is_valid_user_id("../../etc/") # FALSE
#> [1] FALSE