mirror of
https://github.com/zitadel/zitadel.git
synced 2024-12-13 11:34:26 +00:00
fix: remove domain and user correctly in DomainPolicyUsernamesWriteModel (#4850)
fix: remove Domain and User correctly in DomainPolicyUsernamesWriteModel
This commit is contained in:
parent
a3f15d8213
commit
48f535afa1
@ -109,23 +109,23 @@ func (wm *DomainPolicyUsernamesWriteModel) Reduce() error {
|
|||||||
|
|
||||||
func (wm *DomainPolicyUsernamesWriteModel) removeDomain(domain string) {
|
func (wm *DomainPolicyUsernamesWriteModel) removeDomain(domain string) {
|
||||||
for i, verifiedDomain := range wm.VerifiedDomains {
|
for i, verifiedDomain := range wm.VerifiedDomains {
|
||||||
if verifiedDomain != domain {
|
if verifiedDomain == domain {
|
||||||
continue
|
wm.VerifiedDomains[i] = wm.VerifiedDomains[len(wm.VerifiedDomains)-1]
|
||||||
|
wm.VerifiedDomains[len(wm.VerifiedDomains)-1] = ""
|
||||||
|
wm.VerifiedDomains = wm.VerifiedDomains[:len(wm.VerifiedDomains)-1]
|
||||||
|
return
|
||||||
}
|
}
|
||||||
wm.VerifiedDomains[i] = wm.VerifiedDomains[len(wm.VerifiedDomains)-1]
|
|
||||||
wm.VerifiedDomains[len(wm.VerifiedDomains)-1] = ""
|
|
||||||
wm.VerifiedDomains = wm.VerifiedDomains[:len(wm.VerifiedDomains)-1]
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (wm *DomainPolicyUsernamesWriteModel) removeUser(userID string) {
|
func (wm *DomainPolicyUsernamesWriteModel) removeUser(userID string) {
|
||||||
for i, user := range wm.Users {
|
for i, user := range wm.Users {
|
||||||
if user.id != userID {
|
if user.id == userID {
|
||||||
continue
|
wm.Users[i] = wm.Users[len(wm.Users)-1]
|
||||||
|
wm.Users[len(wm.Users)-1] = nil
|
||||||
|
wm.Users = wm.Users[:len(wm.Users)-1]
|
||||||
|
return
|
||||||
}
|
}
|
||||||
wm.Users[i] = wm.Users[len(wm.Users)-1]
|
|
||||||
wm.Users[len(wm.Users)-1] = nil
|
|
||||||
wm.Users = wm.Users[len(wm.Users)-1:]
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user