tailcfg: add UserProfile.Groups
Updates tailscale/corp#13375 Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
This commit is contained in:
committed by
Brad Fitzpatrick
parent
2a6c237d4c
commit
f1cc8ab3f9
+24
-2
@@ -3,7 +3,7 @@
|
||||
|
||||
package tailcfg
|
||||
|
||||
//go:generate go run tailscale.com/cmd/viewer --type=User,Node,Hostinfo,NetInfo,Login,DNSConfig,RegisterResponse,DERPHomeParams,DERPRegion,DERPMap,DERPNode,SSHRule,SSHAction,SSHPrincipal,ControlDialPlan,Location --clonefunc
|
||||
//go:generate go run tailscale.com/cmd/viewer --type=User,Node,Hostinfo,NetInfo,Login,DNSConfig,RegisterResponse,DERPHomeParams,DERPRegion,DERPMap,DERPNode,SSHRule,SSHAction,SSHPrincipal,ControlDialPlan,Location,UserProfile --clonefunc
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
@@ -102,7 +102,8 @@ type CapabilityVersion int
|
||||
// - 63: 2023-06-08: Client understands SSHAction.AllowRemotePortForwarding.
|
||||
// - 64: 2023-07-11: Client understands s/CapabilityTailnetLockAlpha/CapabilityTailnetLock
|
||||
// - 65: 2023-07-12: Client understands DERPMap.HomeParams + incremental DERPMap updates with params
|
||||
const CurrentCapabilityVersion CapabilityVersion = 65
|
||||
// - 66: 2023-07-23: UserProfile.Groups added (available via WhoIs)
|
||||
const CurrentCapabilityVersion CapabilityVersion = 66
|
||||
|
||||
type StableID string
|
||||
|
||||
@@ -175,6 +176,27 @@ type UserProfile struct {
|
||||
// Roles exists for legacy reasons, to keep old macOS clients
|
||||
// happy. It JSON marshals as [].
|
||||
Roles emptyStructJSONSlice
|
||||
|
||||
// Groups contains group identifiers for any group that this user is
|
||||
// a part of and that the coordination server is configured to tell
|
||||
// your node about. (Thus, it may be empty or incomplete.)
|
||||
// There's no semantic difference between a nil and an empty list.
|
||||
// The list is always sorted.
|
||||
Groups []string `json:",omitempty"`
|
||||
}
|
||||
|
||||
func (p *UserProfile) Equal(p2 *UserProfile) bool {
|
||||
if p == nil && p2 == nil {
|
||||
return true
|
||||
}
|
||||
if p == nil || p2 == nil {
|
||||
return false
|
||||
}
|
||||
return p.ID == p2.ID &&
|
||||
p.LoginName == p2.LoginName &&
|
||||
p.DisplayName == p2.DisplayName &&
|
||||
p.ProfilePicURL == p2.ProfilePicURL &&
|
||||
(len(p.Groups) == 0 && len(p2.Groups) == 0 || reflect.DeepEqual(p.Groups, p2.Groups))
|
||||
}
|
||||
|
||||
type emptyStructJSONSlice struct{}
|
||||
|
||||
Reference in New Issue
Block a user