diff options
| author | Marwan Sulaiman <marwan@tailscale.com> | 2023-12-01 02:39:14 -0500 |
|---|---|---|
| committer | Marwan Sulaiman <marwan@tailscale.com> | 2023-12-01 03:04:35 -0500 |
| commit | 8092eaed805ec2baac601e5a93ed4fe2fbad4a80 (patch) | |
| tree | f9217bcfa64c2e20500339fce70382a686152762 /types/netmap/netmap.go | |
| parent | b819f66eb1efab85dcf5550d4f0da92fb7ab2551 (diff) | |
| download | tailscale-marwan/displayname.tar.xz tailscale-marwan/displayname.zip | |
ipn/ipnlocal,others: add tailnet display name to user profilemarwan/displayname
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 <marwan@tailscale.com>
Diffstat (limited to 'types/netmap/netmap.go')
| -rw-r--r-- | types/netmap/netmap.go | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/types/netmap/netmap.go b/types/netmap/netmap.go index 233dcc656..e92a63278 100644 --- a/types/netmap/netmap.go +++ b/types/netmap/netmap.go @@ -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. |
