mirror of
https://github.com/netbirdio/netbird.git
synced 2025-08-22 20:21:04 +02:00
Improve account copying (#1069)
With this fix, all nested slices and pointers will be copied by value. Also, this fixes tests to compare the original and copy account by their values by marshaling them to JSON strings. Before that, they were copying the pointers that also passed the simple `=` compassion (as the addresses match).
This commit is contained in:
@@ -36,6 +36,18 @@ type PersonalAccessToken struct {
|
||||
LastUsed time.Time
|
||||
}
|
||||
|
||||
func (t *PersonalAccessToken) Copy() *PersonalAccessToken {
|
||||
return &PersonalAccessToken{
|
||||
ID: t.ID,
|
||||
Name: t.Name,
|
||||
HashedToken: t.HashedToken,
|
||||
ExpirationDate: t.ExpirationDate,
|
||||
CreatedBy: t.CreatedBy,
|
||||
CreatedAt: t.CreatedAt,
|
||||
LastUsed: t.LastUsed,
|
||||
}
|
||||
}
|
||||
|
||||
// PersonalAccessTokenGenerated holds the new PersonalAccessToken and the plain text version of it
|
||||
type PersonalAccessTokenGenerated struct {
|
||||
PlainToken string
|
||||
|
Reference in New Issue
Block a user