Transforming username and/or groupname

You can configure Ranger Usersync to perform username and/or groupname transformations in order to make them POSIX compliant.

You need to configure multiple properties to enable this feature. The values for these properties should be in the following format (similar to Sed format):
s/regex/replacement/g
Where,
  • "s" stands for substitution and is mandatory.
  • "/ " is the delimiter and is mandatory.
  • Regex is the regular expression to match.
  • Replacement is the value to replace and is optional. If not specified, the found pattern is removed from the resulting string.
  • "g" stands for replacing all the occurrences. It is optional, and if not specified, it defaults to "g".

To enable this feature, perform the following steps:

  1. Go to Cloudera Manager > Ranger > Configuration.
  2. Under Ranger Usersync, search and update the following properties:
    • ranger.usersync.mapping.username.handler (default value is org.apache.ranger.ugsyncutil.transform.RegEx)

      This property defines the specific class or handler responsible for mapping usernames from the external source.

    • ranger.usersync.mapping.groupname.handler (default value is org.apache.ranger.ugsyncutil.transform.RegEx)

      This property defines the specific class or handler responsible for mapping groupnames from the external source.

    • ranger.usersync.mapping.username.regex

      This property defines the regular expression which will be used for username conversion.

    • ranger.usersync.mapping.groupname.regex

      This property defines the regular expression which will be used for groupname conversion.

  3. Restart Ranger.