From 582e370ad8cc3a7d04ebf8796cbf9e52c5b2f119 Mon Sep 17 00:00:00 2001 From: Bruno Michel Date: Thu, 18 Apr 2024 15:32:15 +0200 Subject: [PATCH] Fix sharing with different modes When a group is added in read-only to a sharing, it is no longer possible to add an individual who is a member of this group in read-write for this sharing. --- model/sharing/member.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/model/sharing/member.go b/model/sharing/member.go index 44ffca94eef..0535a0b40fc 100644 --- a/model/sharing/member.go +++ b/model/sharing/member.go @@ -196,11 +196,12 @@ func (s *Sharing) addMember(inst *instance.Instance, m Member) (string, int, err if !found { continue } - if len(m.Groups) > 0 && s.Members[i].ReadOnly != m.ReadOnly { + if s.Members[i].ReadOnly != m.ReadOnly { if s.Members[i].OnlyInGroups { return "", -1, ErrMemberAlreadyInGroup + } else if len(m.Groups) > 0 { + return "", -1, ErrMemberAlreadyAdded } - return "", -1, ErrMemberAlreadyAdded } if member.Status == MemberStatusReady { return "", i, nil