mirror of
https://github.com/netbirdio/netbird.git
synced 2026-05-19 15:19:55 +00:00
Extract wildcard user merge helper to satisfy case-clause length
This commit is contained in:
@@ -62,12 +62,16 @@ func applyResolvedRuleToState(
|
||||
return
|
||||
}
|
||||
state.sshEnabled = true
|
||||
if state.authorizedUsers[auth.Wildcard] == nil {
|
||||
state.authorizedUsers[auth.Wildcard] = make(map[string]struct{})
|
||||
}
|
||||
for userID := range cb.getAllowedUserIDs() {
|
||||
state.authorizedUsers[auth.Wildcard][userID] = struct{}{}
|
||||
}
|
||||
mergeWildcardUsers(state.authorizedUsers, cb.getAllowedUserIDs())
|
||||
}
|
||||
}
|
||||
|
||||
func mergeWildcardUsers(dst map[string]map[string]struct{}, users map[string]struct{}) {
|
||||
if dst[auth.Wildcard] == nil {
|
||||
dst[auth.Wildcard] = make(map[string]struct{})
|
||||
}
|
||||
for userID := range users {
|
||||
dst[auth.Wildcard][userID] = struct{}{}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user