Why can't I use inetOrgPerson with groupOfNames?
I am trying to create a user in LDAP that uses object classes inetOrgPerson with groupOfNames (so i could use the attribute 'member') but it won't let me no matter which combination I try. What is the correct way to use 'member' attribute?
This is the error message I get when trying to add it through Apache Directory Studio.
Error while creating entry
- [LDAP: error code 65 - OBJECT_CLASS_VIOLATION: failed for MessageType : ADD_REQUES
java.lang.Exception: [LDAP: error code 65 - OBJECT_CLASS_VIOLATION: failed for MessageType : ADD_REQUEST
Message ID : 113
Add Request :
Entry
dn[n]: [email protected],o=test,ou=tenant,dc=test,dc=com
objectClass: groupOfNames
objectClass: organizationalPerson
objectClass: person
objectClass: top
objectClass: inetOrgPerson
uid: [email protected]
member: cn=user,ou=role,dc=test,dc=com
sn: sadsadsad
cn: sdsadsad
: ERR_61 Entry [email protected],o=test,ou=tenant,dc=test,dc=com contains more than one STRUCTURAL ObjectClass: [OBJECT_CLASS ( 2.5.6.9
NAME 'groupOfNames'
DESC RFC2256: a group of names (DNs)
SUP 'top'
STRUCTURAL
MUST ( 'cn' $ 'member' )
MAY ( 'businessCategory' $ 'seeAlso' $ 'owner' $ 'ou' $ 'o' $ 'description' )
)
, OBJECT_CLASS ( 2.16.840.1.113730.3.2.2
NAME 'inetOrgPerson'
DESC RFC2798: Internet Organizational Person
SUP 'organizationalPerson'
STRUCTURAL
MAY ( 'audio' $ 'businessCategory' $ 'carLicense' $ 'departmentNumber' $ 'displayName' $ 'employeeNumber' $ 'employeeType' $ 'givenName' $ 'homePhone' $ 'homePostalAddress' $ 'initials' $ 'jpegPhoto' $ 'labeledURI' $ 'mail' $ 'manager' $ 'mobile' $ 'o' $ 'pager' $ 'photo' $ 'roomNumber' $ 'secretary' $ 'uid' $ 'userCertificate' $ 'x500UniqueIdentifier' $ 'preferredLanguage' $ 'userSMIMECertificate' $ 'userPKCS12' )
)
]]
at org.apache.directory.studio.connection.core.io.api.DirectoryApiConnectionWrapper.checkResponse(DirectoryApiConnectionWrapper.java:1280)
at org.apache.directory.studio.connection.core.io.api.DirectoryApiConnectionWrapper.access$600(DirectoryApiConnectionWrapper.java:109)
at org.apache.directory.studio.connection.core.io.api.DirectoryApiConnectionWrapper$6.run(DirectoryApiConnectionWrapper.java:928)
at org.apache.directory.studio.connection.core.io.api.DirectoryApiConnectionWrapper.runAndMonitor(DirectoryApiConnectionWrapper.java:1175)
at org.apache.directory.studio.connection.core.io.api.DirectoryApiConnectionWrapper.checkConnectionAndRunAndMonitor(DirectoryApiConnectionWrapper.java:1109)
at org.apache.directory.studio.connection.core.io.api.DirectoryApiConnectionWrapper.createEntry(DirectoryApiConnectionWrapper.java:950)
at org.apache.directory.studio.ldapbrowser.core.jobs.CreateEntryRunnable.createEntry(CreateEntryRunnable.java:224)
at org.apache.directory.studio.ldapbrowser.core.jobs.CreateEntryRunnable.run(CreateEntryRunnable.java:124)
at org.apache.directory.studio.connection.ui.RunnableContextRunner$1.run(RunnableContextRunner.java:112)
at org.eclipse.jface.operation.ModalContext$ModalContextThread.run(ModalContext.java:121)
[LDAP: error code 65 - OBJECT_CLASS_VIOLATION: failed for MessageType : ADD_REQUEST
Message ID : 113
Add Request :
Entry
dn[n]: [email protected],o=test,ou=tenant,dc=test,dc=com
objectClass: groupOfNames
objectClass: organizationalPerson
objectClass: person
objectClass: top
objectClass: inetOrgPerson
uid: [email protected]
member: cn=user,ou=role,dc=test,dc=com
sn: sadsadsad
cn: sdsadsad
: ERR_61 Entry [email protected],o=test,ou=tenant,dc=test,dc=com contains more than one STRUCTURAL ObjectClass: [OBJECT_CLASS ( 2.5.6.9
NAME 'groupOfNames'
DESC RFC2256: a group of names (DNs)
SUP 'top'
STRUCTURAL
MUST ( 'cn' $ 'member' )
MAY ( 'businessCategory' $ 'seeAlso' $ 'owner' $ 'ou' $ 'o' $ 'description' )
)
, OBJECT_CLASS ( 2.16.840.1.113730.3.2.2
NAME 'inetOrgPerson'
DESC RFC2798: Internet Organizational Person
SUP 'organizationalPerson'
STRUCTURAL
MAY ( 'audio' $ 'businessCategory' $ 'carLicense' $ 'departmentNumber' $ 'displayName' $ 'employeeNumber' $ 'employeeType' $ 'givenName' $ 'homePhone' $ 'homePostalAddress' $ 'initials' $ 'jpegPhoto' $ 'labeledURI' $ 'mail' $ 'manager' $ 'mobile' $ 'o' $ 'pager' $ 'photo' $ 'roomNumber' $ 'secretary' $ 'uid' $ 'userCertificate' $ 'x500UniqueIdentifier' $ 'preferredLanguage' $ 'userSMIMECertificate' $ 'userPKCS12' )
)
]]
Solution 1:
The technical reason is that both the groupOfNames
and the person
objectClass are mutually exclusive. They are both structural classes but without a subordinate relationship, making them different objectClass chains and according to RFC 4512:
An object or alias entry is characterised by precisely one structural object class superclass chain which has a single structural object class as the most subordinate object class.
A group has members, but a person is not a group and can't have members like a group.
As far as I know you normally make a person a member of a group and the LDAP server provides an internal function to maintain the reverse lookup mapping to easily retrieve the groups an object belongs to, a virtual attribute if you will, typically the memberOf
attribute. ApacheDS may not support this (yet).
In other words, the groups an LDAP object belongs to is not a property of the object itself and you should probably not even desire to try to maintain that manually.