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

Re: Uniqueness across multiple attributes



Stefan Schmidt wrote:
> Hello Andreas,
> thank you for your reply. The idea would have been to prevent duplicates across mail and mailAlias from being created in the first place, but you are right if
> OpenLDAP doesn't allow this then using an external script to check if the mail addresses are unique could be a workaround.

You could also try writing your schema such that mail and mailAlias are related through inheritance. E.g.,
make mailAlias a subtype of mail, or make them both inherit from a common supertype. Then set the uniqueness
constraint on the supertype.

> Cheers,
> Stefan Schmidt
> 
> Am Mi., 12. Juni 2019 um 20:09 Uhr schrieb A. Schulze <sca@andreasschulze.de <mailto:sca@andreasschulze.de>>:
> 
> 
> 
>     Am 12.06.19 um 13:51 schrieb Stefan Schmidt:
>     > Hello,
>     >
>     > is it possible define a unique constraint across attributes? We have a mail field and a mailAlias field and would like to assure that if a mail address
>     exists either in mail or mailAlias it cannot be added again to either field, meaning mail addresses are unique in the complete tree.
>     >
>     > We are using OpenLDAP 2.4 and currently we use the following LDIF to load the unique module and assure that the mail attribute is unique:
>     >
>     > dn: cn=module,cn=config
>     > cn: module
>     > objectclass: olcModuleList
>     > objectclass: top
>     > olcmoduleload: unique
>     > olcmodulepath: /usr/lib/ldap
>     >
>     > dn: olcOverlay=unique,olcDatabase={1}hdb,cn=config
>     > objectClass: olcOverlayConfig
>     > objectClass: olcUniqueConfig
>     > olcOverlay: {0}unique
>     > olcUniqueAttribute: mail
>     >
>     > Which LDIF would I use to assure uniqueness across mail and mailAlias?
>     >
>     > Cheers,
>     > Stefan Schmidt
> 
>     see my question http://www.openldap.org/lists/openldap-technical/201905/msg00021.html
>     and the answer http://www.openldap.org/lists/openldap-technical/201905/msg00022.html
> 


-- 
  -- Howard Chu
  CTO, Symas Corp.           http://www.symas.com
  Director, Highland Sun     http://highlandsun.com/hyc/
  Chief Architect, OpenLDAP  http://www.openldap.org/project/