mirror of
https://github.com/juanfont/headscale.git
synced 2024-11-30 02:43:05 +00:00
nits
Signed-off-by: Kristoffer Dalby <kristoffer@tailscale.com>
This commit is contained in:
parent
33c8bbcef8
commit
7c92acb50c
3 changed files with 4 additions and 4 deletions
|
@ -639,7 +639,7 @@ func EnableAutoApprovedRoutes(
|
||||||
|
|
||||||
log.Trace().
|
log.Trace().
|
||||||
Str("node", node.Hostname).
|
Str("node", node.Hostname).
|
||||||
Str("user", node.User.Name).
|
Uint("user.id", node.User.ID).
|
||||||
Strs("routeApprovers", routeApprovers).
|
Strs("routeApprovers", routeApprovers).
|
||||||
Str("prefix", netip.Prefix(advertisedRoute.Prefix).String()).
|
Str("prefix", netip.Prefix(advertisedRoute.Prefix).String()).
|
||||||
Msg("looking up route for autoapproving")
|
Msg("looking up route for autoapproving")
|
||||||
|
|
|
@ -26,7 +26,7 @@ type PreAuthKey struct {
|
||||||
|
|
||||||
func (key *PreAuthKey) Proto() *v1.PreAuthKey {
|
func (key *PreAuthKey) Proto() *v1.PreAuthKey {
|
||||||
protoKey := v1.PreAuthKey{
|
protoKey := v1.PreAuthKey{
|
||||||
User: key.User.Name,
|
User: key.User.Username(),
|
||||||
Id: strconv.FormatUint(key.ID, util.Base10),
|
Id: strconv.FormatUint(key.ID, util.Base10),
|
||||||
Key: key.Key,
|
Key: key.Key,
|
||||||
Ephemeral: key.Ephemeral,
|
Ephemeral: key.Ephemeral,
|
||||||
|
|
|
@ -21,7 +21,7 @@ type User struct {
|
||||||
gorm.Model
|
gorm.Model
|
||||||
// The index `idx_name_provider_identifier` is to enforce uniqueness
|
// The index `idx_name_provider_identifier` is to enforce uniqueness
|
||||||
// between Name and ProviderIdentifier. This ensures that
|
// between Name and ProviderIdentifier. This ensures that
|
||||||
// you can have multiple usersnames of the same name in OIDC,
|
// you can have multiple users with the same name in OIDC,
|
||||||
// but not if you only run with CLI users.
|
// but not if you only run with CLI users.
|
||||||
|
|
||||||
// Username for the user, is used if email is empty
|
// Username for the user, is used if email is empty
|
||||||
|
@ -54,9 +54,9 @@ type User struct {
|
||||||
// enabled with OIDC, which means that there is a domain involved which
|
// enabled with OIDC, which means that there is a domain involved which
|
||||||
// should be used throughout headscale, in information returned to the
|
// should be used throughout headscale, in information returned to the
|
||||||
// user and the Policy engine.
|
// user and the Policy engine.
|
||||||
// If the username does not contain an '@' it will be added to the end.
|
|
||||||
func (u *User) Username() string {
|
func (u *User) Username() string {
|
||||||
username := cmp.Or(u.Email, u.Name, u.ProviderIdentifier, strconv.FormatUint(uint64(u.ID), 10))
|
username := cmp.Or(u.Email, u.Name, u.ProviderIdentifier, strconv.FormatUint(uint64(u.ID), 10))
|
||||||
|
|
||||||
// TODO(kradalby): Wire up all of this for the future
|
// TODO(kradalby): Wire up all of this for the future
|
||||||
// if !strings.Contains(username, "@") {
|
// if !strings.Contains(username, "@") {
|
||||||
// username = username + "@"
|
// username = username + "@"
|
||||||
|
|
Loading…
Reference in a new issue