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

Function extractPermissions

backend/api/mcp/openapi_index.go:179–206  ·  view source on GitHub ↗
(description string)

Source from the content-addressed store, hash-verified

177}
178
179func extractPermissions(description string) []string {
180 matches := permissionRegex.FindStringSubmatch(description)
181 if len(matches) < 2 {
182 return nil
183 }
184
185 permStr := strings.TrimSpace(matches[1])
186 if permStr == "None" || permStr == "" {
187 return nil
188 }
189
190 // Remove parenthetical notes like "(for project parent)"
191 if idx := strings.Index(permStr, "("); idx > 0 {
192 permStr = strings.TrimSpace(permStr[:idx])
193 }
194
195 // Split by comma
196 perms := strings.Split(permStr, ",")
197
198 var result []string
199 for _, p := range perms {
200 p = strings.TrimSpace(p)
201 if p != "" && p != "None" {
202 result = append(result, p)
203 }
204 }
205 return result
206}
207
208func (idx *OpenAPIIndex) indexKeywords(ep *EndpointInfo) {
209 // Extract keywords from service, method, summary

Callers 1

parseSpecMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected