MCPcopy Create free account
hub / github.com/cloudbase/garm / getUIDFromContext

Function getUIDFromContext

database/sql/util.go:1105–1116  ·  view source on GitHub ↗
(ctx context.Context)

Source from the content-addressed store, hash-verified

1103}
1104
1105func getUIDFromContext(ctx context.Context) (uuid.UUID, error) {
1106 userID := auth.UserID(ctx)
1107 if userID == "" {
1108 return uuid.Nil, fmt.Errorf("error getting UID from context: %w", runnerErrors.ErrUnauthorized)
1109 }
1110
1111 asUUID, err := uuid.Parse(userID)
1112 if err != nil {
1113 return uuid.Nil, fmt.Errorf("error parsing UID from context: %w", runnerErrors.ErrUnauthorized)
1114 }
1115 return asUUID, nil
1116}
1117
1118func (s *sqlDatabase) sqlToParamTemplate(template Template) (params.Template, error) {
1119 var data []byte

Callers 15

ListTemplatesMethod · 0.85
getTemplateMethod · 0.85
GetTemplateByNameMethod · 0.85
CreateTemplateMethod · 0.85
GetGithubCredentialsMethod · 0.85
ListGithubCredentialsMethod · 0.85

Calls 1

UserIDFunction · 0.92

Tested by

no test coverage detected