api/v2: show a tagged device's creator as its user

A tagged device shows the login that made the key it joined with.
Its owner stays its tags.
This commit is contained in:
Kristoffer Dalby committed 2026-10-28 18:28:23 +00:00
1 parent 7210c01b60
commit 8ea774564d
7 files changed
+88 -27

No files matched your search

+11 -3
View File
@@ -482,10 +482,18 @@ func routesFromView(view types.NodeView) DeviceRoutes {
}
}
// deviceUser is the owning login. [types.NodeView.Owner] already resolves the
// tags-as-identity rule: tagged nodes present the special TaggedDevices user,
// user-owned nodes present their login, orphaned nodes present nothing.
// deviceUser is the owning login. A tagged device, owned by its tags, shows
// the login that made the key it joined with, as Tailscale does: nothing when
// a token made that key.
func deviceUser(view types.NodeView) string {
if view.IsTagged() {
if key := view.AuthKey(); key.Valid() && key.User().Valid() {
return key.User().Username()
}
return ""
}
owner := view.Owner()
if owner.Valid() {
return owner.Username()