MCPcopy Index your code
hub / github.com/coder/coder / ParseResourceAction

Function ParseResourceAction

coderd/rbac/scopes.go:268–274  ·  view source on GitHub ↗

ParseResourceAction parses a scope string formatted as " : " and returns the resource and action components. This is the common parsing logic shared between RBAC and database validation.

(scope string)

Source from the content-addressed store, hash-verified

266// and returns the resource and action components. This is the common parsing
267// logic shared between RBAC and database validation.
268func ParseResourceAction(scope string) (resource string, action string, ok bool) {
269 parts := strings.SplitN(scope, ":", 2)
270 if len(parts) != 2 || parts[0] == "" || parts[1] == "" {
271 return "", "", false
272 }
273 return parts[0], parts[1], true
274}
275
276// parseLowLevelScope parses a low-level scope name formatted as
277// "<resource>:<action>" and validates it against RBACPermissions.

Callers 2

parseLowLevelScopeFunction · 0.85
ParseAllowListEntryFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected