[Date Prev][Date Next] [Chronological] [Thread] [Top]

Re: How can I define unique attribute types in my own schema?



I think the general reply is, you need to read up on how LDAP works.
However, more specific:

Sadik Kumlali writes:
> I could not found a way of doing an attribute unique while defining my
> own schema.
> 
> I need following attributes:
> 
> bookCode (unique)
> bookName
> bookDescription 
> 
> What I want is not to allow duplicate bookCodes. 
> 
> I thought that it might caused by attribute identifiers such as SYNTAX
> and EQUALITY. However, if I try to insert same 'cn's for inetOrgPerson,
> it does not allow me while it allowing me to insert same 'sn's.

Perhaps that cn already existed in the entry.  When you ask for help
about such things, it's easier to tell what is wrong if you specify the
exact command you used and the LDIF of the affected entries (both the
current entry and the modification you attempted.)

> I found
> that both of 'cn' and 'sn' are defined as 'SUP name'. So there is no
> difference in definition. What mechanism enforces the OpenLDAP not to
> allow duplicated 'cn's?

I'm not sure what you mean by unique and duplicate and whatever here -
in the entry, or in the DIT, or what?

An entry may contain multiple 'cn' and 'sn' values, since these
attributes are not defined as SINGLE-VALUE attributes.  (Compare
with 'c' alias 'countryName' which has SINGLE-VALUE in core.schema.)

An entry can not contain two 'cn' values that compare equal according to
'cn's EQUALITY matching rule.  'cn' inherits that from 'name': EQUALITY
caseIgnoreMatch.  Thus cn=foo matches cn=FOO.

If you mean that you don't want two different entires to contain the
same bookCode, you can only enforce that by giving both entries the same
parent DN and using bookCode as the RDN, since two entries with the same
parent can not have the same RDN (again, according to the appropriate
EQUALITY matching rule).

SYNTAX only says what kind of values the attribute can contain,
e.g. ASCII only, or UTF-8 only, or any octet string.

-- 
Hallvard