Skip to content

Commit

Permalink
fix updating/removing group members
Browse files Browse the repository at this point in the history
  • Loading branch information
xrstf committed May 31, 2021
1 parent 13b3559 commit b30d7ba
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions pkg/glib/directory_groups.go
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,8 @@ func (ds *DirectoryService) AddNewMember(ctx context.Context, group *directoryv1

// RemoveMember removes a member from a group in Gsuite
func (ds *DirectoryService) RemoveMember(ctx context.Context, group *directoryv1.Group, member *directoryv1.Member) error {
if err := ds.Members.Delete(group.Email, member.Email).Context(ctx).Do(); err != nil {
// do NOT use the member email here, as it will lead to "Error 404: Resource Not Found: email, notFound." errors
if err := ds.Members.Delete(group.Id, member.Id).Context(ctx).Do(); err != nil {
return err
}

Expand All @@ -129,7 +130,8 @@ func (ds *DirectoryService) RemoveMember(ctx context.Context, group *directoryv1

// UpdateMembership changes the role of the member
func (ds *DirectoryService) UpdateMembership(ctx context.Context, group *directoryv1.Group, member *directoryv1.Member) error {
if _, err := ds.Members.Update(group.Email, member.Email, member).Context(ctx).Do(); err != nil {
// do NOT use the member email here, as it will lead to "Error 404: Resource Not Found: email, notFound." errors
if _, err := ds.Members.Update(group.Email, member.Id, member).Context(ctx).Do(); err != nil {
return err
}

Expand Down

0 comments on commit b30d7ba

Please sign in to comment.