Commit 3d998e63 authored by ale's avatar ale

Set gidNumber on generated LDAP objects

parent c97fb450
Pipeline #3646 passed with stages
in 4 minutes and 47 seconds
......@@ -29,6 +29,7 @@ const (
passwordLastChangeLDAPAttr = "shadowLastChange"
u2fRegistrationsLDAPAttr = "u2fRegistration"
uidNumberLDAPAttr = "uidNumber"
gidNumberLDAPAttr = "gidNumber"
// Interface to something that adds Resources to a User.
......@@ -164,6 +165,7 @@ func userToLDAP(user *as.User) (attrs []ldap.PartialAttribute) {
{Type: "uid", Vals: s2l(user.Name)},
{Type: "cn", Vals: s2l(user.Name)},
{Type: uidNumberLDAPAttr, Vals: s2l(strconv.Itoa(user.UID))},
{Type: gidNumberLDAPAttr, Vals: s2l("2000")},
{Type: "givenName", Vals: s2l("Private")},
{Type: "sn", Vals: s2l("Private")},
{Type: "gecos", Vals: s2l(user.Name)},
......@@ -373,10 +373,14 @@ func (h *webdavResourceHandler) FromLDAP(entry *ldap.Entry) (*as.Resource, error
func (h *webdavResourceHandler) ToLDAP(rsrc *as.Resource) []ldap.PartialAttribute {
return []ldap.PartialAttribute{
{Type: "objectClass", Vals: []string{"top", "person", "posixAccount", "shadowAccount", "organizationalPerson", "inetOrgPerson", "ftpAccount"}},
{Type: "objectClass", Vals: []string{"top", "person", "posixAccount", "shadowAccount", "ftpAccount"}},
{Type: "ftpname", Vals: s2l(rsrc.Name)},
{Type: "homeDirectory", Vals: s2l(rsrc.DAV.Homedir)},
{Type: uidNumberLDAPAttr, Vals: s2l(strconv.Itoa(rsrc.DAV.UID))},
{Type: gidNumberLDAPAttr, Vals: s2l("2000")},
{Type: "uid", Vals: s2l(rsrc.Name)},
{Type: "cn", Vals: s2l(rsrc.Name)},
{Type: "sn", Vals: s2l("Private")},
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment