outposts/ldap: Support hard coded `uidNumber` and `gidNumber`. (#1582)

This commit is contained in:
Ilya Kogan 2021-10-10 17:43:36 -04:00 committed by GitHub
parent 83f4830946
commit 9ed236f7ab
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 12 additions and 0 deletions

View File

@ -122,10 +122,22 @@ func (pi *ProviderInstance) GetVirtualGroupDN(group string) string {
}
func (pi *ProviderInstance) GetUidNumber(user api.User) string {
uidNumber, ok := user.GetAttributes()["uidNumber"].(string)
if ok {
return uidNumber
}
return strconv.FormatInt(int64(pi.uidStartNumber+user.Pk), 10)
}
func (pi *ProviderInstance) GetGidNumber(group api.Group) string {
gidNumber, ok := group.GetAttributes()["gidNumber"].(string)
if ok {
return gidNumber
}
return strconv.FormatInt(int64(pi.gidStartNumber+pi.GetRIDForGroup(group.Pk)), 10)
}