2

I am new to OpenDJ and LDAP and I want to know what is the LDAP Schema syntax to specify an attribute can have only one of the few values? For example, an User object has an attribute called status that can have only one of these values: Active, In-Active.

Appreciate any help here.

Nikki
  • 97
  • 10

1 Answers1

3

You can achieve what you want by defining a Syntax with the X-ENUM extension: http://docs.forgerock.org/en/opendj/2.6.0/admin-guide/index/chap-schema.html#attr-syntax-schema-definition-extensions

First define a statusSyntax and then an attribute status that uses that syntax.

Ludovic Poitou
  • 4,788
  • 2
  • 21
  • 30
  • The solution although correct, is not an LDAP solution (there are not any that I know of) but rather a solution specific to the OpenDJ implementation. – jwilleke Jan 12 '15 at 14:29
  • I agree the solution is specific to OpenDJ since there are no standard way to do this in LDAP. The question was asked in the context of OpenDJ though ;-) – Ludovic Poitou Jan 16 '15 at 09:26
  • Probably repeating, but could this be not done for ldap in particular? – inquisitive Jul 13 '18 at 09:07
  • 1
    @inquisitive, are you asking it there is a generic LDAP solution to this ? If so, the answer is no. It is possible to define an LDAP syntax that only accept the 2 values. However, in every LDAP directory server I know of, adding a syntax requires to write code, build and load the extension; with the exception of OpenDJ, where we've added this ability to define syntaxes based on enums (X-ENUM) or regular expressions (X-PATTERN). – Ludovic Poitou Jul 16 '18 at 08:15
  • @LudovicPoitou Thanks, that helps, I was probably looking for writing a custom syntax. – inquisitive Jul 16 '18 at 08:26
  • @LudovicPoitou Also, can you please direct me here? https://stackoverflow.com/questions/51357686/openldap-add-open-ldap-defined-attributes-to-custom-class – inquisitive Jul 16 '18 at 08:46