mirror of
https://github.com/netbirdio/netbird.git
synced 2026-04-18 00:06:38 +00:00
properly copy group users
This commit is contained in:
@@ -48,6 +48,14 @@ type GroupUser struct {
|
||||
UserID string `gorm:"primaryKey"`
|
||||
}
|
||||
|
||||
func (g *GroupUser) Copy() *GroupUser {
|
||||
return &GroupUser{
|
||||
AccountID: g.AccountID,
|
||||
GroupID: g.GroupID,
|
||||
UserID: g.UserID,
|
||||
}
|
||||
}
|
||||
|
||||
func (g *Group) LoadGroupPeers() {
|
||||
g.Peers = make([]string, len(g.GroupPeers))
|
||||
for i, peer := range g.GroupPeers {
|
||||
|
||||
@@ -223,8 +223,11 @@ func (u *User) Copy() *User {
|
||||
var groupUsers []*GroupUser
|
||||
if u.Groups != nil {
|
||||
groupUsers = make([]*GroupUser, len(u.Groups))
|
||||
copy(groupUsers, u.Groups)
|
||||
for i, groupUser := range u.Groups {
|
||||
groupUsers[i] = groupUser.Copy()
|
||||
}
|
||||
}
|
||||
|
||||
var autoGroups []string
|
||||
if u.AutoGroups != nil {
|
||||
autoGroups = make([]string, len(u.AutoGroups))
|
||||
|
||||
Reference in New Issue
Block a user