MCPcopy Create free account
hub / github.com/devaccuracy/ledgerforge / ParseScope

Function ParseScope

api/middleware/scope.go:68–74  ·  view source on GitHub ↗

ParseScope parses a scope string into resource and action

(scope string)

Source from the content-addressed store, hash-verified

66
67// ParseScope parses a scope string into resource and action
68func ParseScope(scope string) (Resource, Action) {
69 parts := strings.Split(scope, ":")
70 if len(parts) != 2 {
71 return "", ""
72 }
73 return Resource(parts[0]), Action(parts[1])
74}
75
76// HasPermission checks if a set of scopes has permission for a given resource and HTTP method
77func HasPermission(scopes []string, resource Resource, method string) bool {

Callers 2

TestParseScopeFunction · 0.85
HasPermissionFunction · 0.85

Calls 2

ResourceTypeAlias · 0.85
ActionTypeAlias · 0.85

Tested by 1

TestParseScopeFunction · 0.68