add user error .
skydeadpeng opened this issue · comments
addRequest := ldap.NewAddRequest("uid=adminUser1,OU=test,OU=gongsi,dc=hlwgystpt,dc=com", nil)
addRequest.Attribute("objectClass", []string{"person", "organizationalPerson", "user", "top"})
addRequest.Attribute("uid", []string{"adminUser1"})
addRequest.Attribute("mail", []string{"adminUser1@gmail.com"})
addRequest.Attribute("member", []string{"cn=superadmin,OU=test,OU=gongsi,dc=hlwgystpt,dc=com"})
addRequest.Attribute("name", []string{"Superadmin"})
addRequest.Attribute("userPassword", []string{"adminUser1"})
LDAP Result Code 19 "Constraint Violation": 000020B5: AtrErr: DSID-03152804, #1:
0: 000020B5: DSID-03152804, problem 1005 (CONSTRAINT_ATT_TYPE), data 0, Att 1f (member)
@skydeadpeng According to core.schema
in OpenLDAP server, the person
objectClass must require two attributes: sn
and cn
. Why don't you add two attributes to your request?
objectclass ( 2.5.6.6 NAME 'person'
DESC 'RFC2256: a person'
SUP top STRUCTURAL
MUST ( sn $ cn )
MAY ( userPassword $ telephoneNumber $ seeAlso $ description ) )
addRequest.Attribute("member", []string{"cn=superadmin,OU=test,OU=gongsi,dc=hlwgystpt,dc=com"})
data 0, Att 1f (member)
I found an error message indicating the member attribute was wrong. How about removing the member
attribute?
Or set the group
attribute with member
attributes.
addRequest.Attribute("objectClass", []string{"group", "top"})
@t2y The error messages states that there's a problem with the submitted attribute member
in the add request. Looking at the context of the operation, they're trying to add this newly created user to a group called superadmin
, but the attribute for such operation would be memberOf
. Also judging by the error message, this is an Active Directory, not an OpenLDAP server.
@cpuschma Exactly. I misunderstood the error message—this error message is from Active Directory. I mean that the request attributes are wrong in this case.
@skydeadpeng Use GitHub Discussions next time you have a question like this.