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)
| 266 | // and returns the resource and action components. This is the common parsing |
| 267 | // logic shared between RBAC and database validation. |
| 268 | func 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. |
no outgoing calls
no test coverage detected