Skip to content

Commit

Permalink
Fix sharing with different modes (#4379)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
nono committed Apr 18, 2024
2 parents 8c161e2 + 582e370 commit 26505bb
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions model/sharing/member.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 26505bb

Please sign in to comment.