mirror of
https://github.com/tailscale/tailscale.git
synced 2025-10-09 08:01:31 +00:00
ipn/ipnlocal: add support for multiple user profiles
Signed-off-by: Maisem Ali <maisem@tailscale.com>
This commit is contained in:
@@ -590,7 +590,7 @@ func (c *Auto) sendStatus(who string, err error, url string, nm *netmap.NetworkM
|
||||
}
|
||||
if nm != nil && loggedIn && synced {
|
||||
pp := c.direct.GetPersist()
|
||||
p = &pp
|
||||
p = pp.AsStruct()
|
||||
} else {
|
||||
// don't send netmap status, as it's misleading when we're
|
||||
// not logged in.
|
||||
@@ -708,7 +708,7 @@ func (c *Auto) Shutdown() {
|
||||
// used exclusively in tests.
|
||||
func (c *Auto) TestOnlyNodePublicKey() key.NodePublic {
|
||||
priv := c.direct.GetPersist()
|
||||
return priv.PrivateNodeKey.Public()
|
||||
return priv.PrivateNodeKey().Public()
|
||||
}
|
||||
|
||||
func (c *Auto) TestOnlySetAuthKey(authkey string) {
|
||||
|
@@ -333,10 +333,10 @@ func (c *Direct) SetTKAHead(tkaHead string) bool {
|
||||
return true
|
||||
}
|
||||
|
||||
func (c *Direct) GetPersist() persist.Persist {
|
||||
func (c *Direct) GetPersist() persist.PersistView {
|
||||
c.mu.Lock()
|
||||
defer c.mu.Unlock()
|
||||
return c.persist
|
||||
return c.persist.View()
|
||||
}
|
||||
|
||||
func (c *Direct) TryLogout(ctx context.Context) error {
|
||||
@@ -633,6 +633,12 @@ func (c *Direct) doLogin(ctx context.Context, opt loginOpt) (mustRegen bool, new
|
||||
if resp.Login.LoginName != "" {
|
||||
persist.LoginName = resp.Login.LoginName
|
||||
}
|
||||
persist.UserProfile = tailcfg.UserProfile{
|
||||
ID: resp.User.ID,
|
||||
DisplayName: resp.Login.DisplayName,
|
||||
ProfilePicURL: resp.Login.ProfilePicURL,
|
||||
LoginName: resp.Login.LoginName,
|
||||
}
|
||||
|
||||
// TODO(crawshaw): RegisterResponse should be able to mechanically
|
||||
// communicate some extra instructions from the server:
|
||||
|
Reference in New Issue
Block a user