ipn/ipnlocal,others: add tailnet display name to user profile

This PR adds the new editable display name for a tailnet which
will be the preferred display in client UIs and CLIs when
fast user switching between profiles.

Updates #9286

Signed-off-by: Marwan Sulaiman <[email protected]>
This commit is contained in:
Marwan Sulaiman committed 2023-12-01 03:04:35 -05:00
1 parent b819f66eb1
commit 8092eaed80
9 files changed
+49 -18

No files matched your search

+11
View File
@@ -68,6 +68,8 @@ type NetworkMap struct {
// Domain is the current Tailnet name.
Domain string
// DisplayName is the user editable version of the Domain.
DisplayName string `json:",omitempty"`
// DomainAuditLogID is an audit log ID provided by control and
// only populated if the domain opts into data-plane audit logging.
@@ -187,6 +189,15 @@ func (nm *NetworkMap) DomainName() string {
return nm.Domain
}
// DisplayName returns the name of the NetworkMap's current tailnet user
// editable display name. If the map is nil, it returns an empty string.
func (nm *NetworkMap) GetDisplayName() string {
if nm == nil {
return ""
}
return nm.DisplayName
}
// SelfCapabilities returns SelfNode.Capabilities if nm and nm.SelfNode are
// non-nil. This is a method so we can use it in envknob/logknob without a
// circular dependency.