MCPcopy Index your code
hub / github.com/bytebase/bytebase / GetGroupByName

Method GetGroupByName

backend/store/group.go:58–75  ·  view source on GitHub ↗

GetGroupByName resolves a group by its resource name "groups/{identifier}". The identifier can be an email (contains "@") or an ID. Includes a fallback for legacy SCIM sync where the email was stored as the ID.

(ctx context.Context, workspace, name string)

Source from the content-addressed store, hash-verified

56// The identifier can be an email (contains "@") or an ID.
57// Includes a fallback for legacy SCIM sync where the email was stored as the ID.
58func (s *Store) GetGroupByName(ctx context.Context, workspace, name string) (*GroupMessage, error) {
59 identifier := strings.TrimPrefix(name, "groups/")
60 find := &FindGroupMessage{Workspace: workspace}
61 if strings.Contains(identifier, "@") {
62 find.Email = &identifier
63 } else {
64 find.ID = &identifier
65 }
66 group, err := s.GetGroup(ctx, find)
67 if err != nil {
68 return nil, err
69 }
70 if group == nil && find.ID == nil {
71 // Fallback: legacy SCIM sync may store email as ID.
72 return s.GetGroup(ctx, &FindGroupMessage{Workspace: workspace, ID: &identifier})
73 }
74 return group, nil
75}
76
77// GetGroup gets a group.
78func (s *Store) GetGroup(ctx context.Context, find *FindGroupMessage) (*GroupMessage, error) {

Callers 10

GetUsersByMemberFunction · 0.80
GetUserIAMPolicyBindingsFunction · 0.80
MemberContainsUserFunction · 0.80
GetGroupMethod · 0.80
UpdateGroupMethod · 0.80
DeleteGroupMethod · 0.80
sendInviteEmailsMethod · 0.80
getGroupMethod · 0.80

Calls 1

GetGroupMethod · 0.95

Tested by

no test coverage detected