MCPcopy Create free account
hub / github.com/bytebase/bytebase / updateGroupFromSCIM

Method updateGroupFromSCIM

backend/api/directory-sync/webhook.go:939–959  ·  view source on GitHub ↗

updateGroupFromSCIM updates an existing group with data from SCIMGroup. Used by both POST (when group exists) and PUT operations.

(ctx context.Context, group *store.GroupMessage, scimGroup *SCIMGroup, source string)

Source from the content-addressed store, hash-verified

937// updateGroupFromSCIM updates an existing group with data from SCIMGroup.
938// Used by both POST (when group exists) and PUT operations.
939func (s *Service) updateGroupFromSCIM(ctx context.Context, group *store.GroupMessage, scimGroup *SCIMGroup, source string) (*store.GroupMessage, error) {
940 var members []*storepb.GroupMember
941 for _, scimMember := range scimGroup.Members {
942 member, err := s.getGroupMember(ctx, scimMember)
943 if err != nil {
944 slog.Error("failed to get scim group member", slog.Any("member", scimMember), log.BBError(err))
945 continue
946 }
947 members = append(members, member)
948 }
949
950 return s.store.UpdateGroup(ctx, &store.UpdateGroupMessage{
951 ID: group.ID,
952 Workspace: group.Workspace,
953 Title: &scimGroup.DisplayName,
954 Payload: &storepb.GroupPayload{
955 Source: source,
956 Members: members,
957 },
958 })
959}
960
961func convertToSCIMUser(user *store.UserMessage) *SCIMUser {
962 return &SCIMUser{

Callers 1

Calls 4

getGroupMemberMethod · 0.95
BBErrorFunction · 0.92
UpdateGroupMethod · 0.65
ErrorMethod · 0.45

Tested by

no test coverage detected