Added tests, solved some bugs, and code reorg
This commit is contained in:
parent
687e8d12be
commit
01a5fe3c51
5 changed files with 389 additions and 23 deletions
|
|
@ -216,3 +216,22 @@ func (n *Namespace) toUser() *tailcfg.User {
|
|||
}
|
||||
return &u
|
||||
}
|
||||
|
||||
func getMapResponseUserProfiles(m Machine, peers Machines) []tailcfg.UserProfile {
|
||||
namespaceMap := make(map[string]Namespace)
|
||||
namespaceMap[m.Namespace.Name] = m.Namespace
|
||||
for _, p := range peers {
|
||||
namespaceMap[p.Namespace.Name] = p.Namespace // not worth checking if already is there
|
||||
}
|
||||
|
||||
profiles := []tailcfg.UserProfile{}
|
||||
for _, namespace := range namespaceMap {
|
||||
profiles = append(profiles,
|
||||
tailcfg.UserProfile{
|
||||
ID: tailcfg.UserID(namespace.ID),
|
||||
LoginName: namespace.Name,
|
||||
DisplayName: namespace.Name,
|
||||
})
|
||||
}
|
||||
return profiles
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue