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

Function formatUserNameByType

backend/component/iam/manager.go:144–153  ·  view source on GitHub ↗

formatUserNameByType returns the appropriate member name format based on user type. For regular users: users/{email} For service accounts: serviceAccounts/{email} For workload identities: workloadIdentities/{email}

(user *store.UserMessage)

Source from the content-addressed store, hash-verified

142// For service accounts: serviceAccounts/{email}
143// For workload identities: workloadIdentities/{email}
144func formatUserNameByType(user *store.UserMessage) string {
145 switch user.Type {
146 case storepb.PrincipalType_SERVICE_ACCOUNT:
147 return common.FormatServiceAccountEmail(user.Email)
148 case storepb.PrincipalType_WORKLOAD_IDENTITY:
149 return common.FormatWorkloadIdentityEmail(user.Email)
150 default:
151 return common.FormatUserEmail(user.Email)
152 }
153}

Callers 1

checkFunction · 0.85

Calls 3

FormatUserEmailFunction · 0.92

Tested by

no test coverage detected