To enable uniqueness across attribute sets:

  • To configure the UID unique attribute plugin to apply across multiple attributes, use the dsconfig tool.

    The following table details the multiple-attribute-behavior property and the values it can take.

    The multiple-attribute-behavior property values, descriptions, and examples
    Value Description Example

    unique-within-each-attribute

    If multiple attributes are specified, then uniqueness is enforced for all values of each attribute, but the same value might appear in different attributes in the same entry or in different entries.

    For example, assume you have an existing entry that has attributes telephoneNumber=123-456-7890 and mobile=123-456-7891.

    If you set the uniqueness plugin to have --set "multiple-attribute-behavior:unique-within-each-attribute" and add:

    • An entry with a telephoneNumber value that matches the telephoneNumber attribute in the existing entry, then the add request fails.
    • An entry with a mobile value that matches the mobile attribute in the existing entry, then the request fails.
    • An entry with the same telephoneNumber and mobile attribute values, such as 123-456-7893, but differs from the values in the existing entry, then the add request succeeds.

    unique-across-all-attributes-including-in-same-entry

    If multiple attributes are specified, then uniqueness is enforced across all of those attributes. If a value appears in one of those attributes that value might not be present in any other of the listed attributes in the same entry, nor in any of the listed attributes in other entries.

    For example, assume you have an existing entry that has attributes, telephoneNumber=123-456-7890 and mobile=123-456-7891.

    If you set the uniqueness plugin to have --set "multiple-attribute-behavior:unique-across-all-attributes-including-in-same-entry" and add:

    • An entry with a telephoneNumber value, such as 123-456-7890, that matches the telephoneNumber attribute in an existing entry, then the add request fails.
    • An entry with a mobile value that matches the mobile attribute in an existing entry, then the request fails.
    • An entry with a mobile value, such as 123-456-7890, that matches the telephoneNumber attribute in an existing entry, then that fails.
    • An entry with the same telephoneNumber and mobile attribute values, such as 123-456-7893, but differ from the values in an existing entry, then the add request fails.

    unique-across-all-attributes-except-in-same-entry

    If multiple attributes are specified, then uniqueness is enforced across all of those attributes. So, if a value appears in one of those attributes, that value might not be present in any of the listed attributes in other entries. However, the same value might appear in multiple attributes in the same entry.

    For example, assume you have an existing entry that has attributes, telephoneNumber=123-456-7890 and mobile=123-456-7891.

    You set the uniqueness plugin to have --set "multiple-attribute-behavior:unique-across-all-attributes-except-in-same-entry" and add:

    • An entry with a telephoneNumber value, such as 123-456-7890, that matches the telephoneNumber attribute in an existing entry, then the add request fails.
    • An entry with a mobile value that matches the mobile attribute in the existing entry, then the request fails.
    • An entry with a mobile value, such as 123-456-7890, that matches the telephoneNumber attribute in an existing entry, then the request fails.
    • An entry with a telephoneNumber value, such as 123-456-7891, that matches the mobile attribute in an existing entry, then the request fails.
    • An entry with the same telephoneNumber and mobile attribute values, such as 123-456-7893, but that differs from the values in an existing entry, then the add request succeeds.

    The multiple-attribute-behavior property is set to unique-within-each-attribute, which indicates that uniqueness is enforced for all values of each attribute, such as telephoneNumber=123-456-7890 and mobile=123-456-7891, but the same value, such as either 123-456-7890 or 123-456-7891 might appear in different attributes in the same entry or in different entries.

    $ dsconfig create-plugin \
      --plug-in "Unique telephoneNumber and mobile" \
      --type "unique-attribute" \
      --set "enabled:true" \
      --set "type:telephoneNumber" \
      --set "type:mobile" \
      --set "multiple-attribute-behavior:unique-within-each-attribute" \
      --no-prompt