mirror of
https://github.com/juanfont/headscale.git
synced 2026-09-18 06:22:05 +09:00
policy,types: skip recompile when the user list is unchanged
SetUsers now also reports whether user-derived peer adjacency moved. Updates #3417
This commit is contained in:
@@ -105,6 +105,16 @@ func (u *User) StringID() string {
|
||||
return strconv.FormatUint(uint64(u.ID), 10)
|
||||
}
|
||||
|
||||
// PolicyEqual reports whether the policy would resolve both users the same
|
||||
// way: the same row, and the same name, email, and provider identity that
|
||||
// user aliases match on.
|
||||
func (u *User) PolicyEqual(o *User) bool {
|
||||
return u.ID == o.ID &&
|
||||
u.Name == o.Name &&
|
||||
u.Email == o.Email &&
|
||||
u.ProviderIdentifier == o.ProviderIdentifier
|
||||
}
|
||||
|
||||
// TypedID returns a pointer to the user's ID as a [UserID] type.
|
||||
// This is a convenience method to avoid ugly casting like ptr.To(types.UserID(user.ID)).
|
||||
func (u *User) TypedID() *UserID {
|
||||
|
||||
Reference in New Issue
Block a user