我正在尝试在 LDAP 中创建一个使用对象类 inetOrgPerson 和 groupOfNames 的用户(因此我可以使用属性“member”),但无论我尝试哪种组合,它都不允许我这样做。使用“member”属性的正确方法是什么?
这是我尝试通过 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' )
)
]]
答案1
技术原因是groupOfNames
和person
objectClass是互斥的,都是结构类,但是没有上下级关系,所以是不同的objectClass链,根据RFC 4512:
一个对象或别名条目的特点是恰好有一个结构对象类超类链,该链具有单个结构对象类作为最下属的对象类。
团体有成员,但个人不是团体,不能像团体一样拥有成员。
据我所知,您通常会将一个人设为某个组的成员,而 LDAP 服务器会提供内部函数来维护反向查找映射,以便轻松检索对象所属的组(如果您愿意的话,可以称为虚拟属性,通常是属性)memberOf
。ApacheDS 可能不支持此功能(然而)。
换句话说,LDAP 对象所属的组不是对象本身的属性,您甚至可能不想尝试手动维护它。