allow detaching any non-normalized DN (#19525)

This commit is contained in:
Harshavardhana 2024-04-16 17:36:43 -07:00 committed by GitHub
parent 73b4794cf7
commit a8d601b64a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1770,6 +1770,19 @@ func (sys *IAMSys) PolicyDBUpdateLDAP(ctx context.Context, isAttach bool,
isGroup = true
}
// Backward compatibility in detaching non-normalized DNs.
if !isAttach {
var oldDN string
if isGroup {
oldDN = r.Group
} else {
oldDN = r.User
}
if oldDN != dn {
sys.store.PolicyDBUpdate(ctx, oldDN, isGroup, stsUser, r.Policies, isAttach)
}
}
userType := stsUser
updatedAt, addedOrRemoved, effectivePolicies, err = sys.store.PolicyDBUpdate(
ctx, dn, isGroup, userType, r.Policies, isAttach)