Error When Group Membership already Exists

This commit is contained in:
Samuel Lorch 2021-09-16 14:55:52 +02:00
parent 27715fd266
commit c3f7f9ac1b

View file

@ -120,6 +120,9 @@ func UpdateGroup(ctx context.Context, c *api.Client, groupID, name string, opera
})
} else {
// Membership Exists so we can modify or delete it
if !operation.Delete && membership.IsAdmin == operation.IsGroupManager {
return fmt.Errorf("Membership for User %v already Exists with Same Role", operation.UserID)
}
request.GroupChanges = append(request.GroupChanges, api.GroupMembership{
ID: membership.ID,
IsAdmin: operation.IsGroupManager,