(str string)
| 77 | } |
| 78 | |
| 79 | func (s *SubjectSet) FromString(str string) (*SubjectSet, error) { |
| 80 | // If there is no '#' we have a subject set without a relation, such as |
| 81 | // Users:Bob, which just means that the relation is empty. |
| 82 | namespaceAndObject, relation, _ := strings.Cut(str, "#") |
| 83 | |
| 84 | namespace, object, ok := strings.Cut(namespaceAndObject, ":") |
| 85 | if !ok { |
| 86 | return nil, errors.WithStack(ErrMalformedInput.WithDebug("expected subject set to contain ':'")) |
| 87 | } |
| 88 | |
| 89 | return &SubjectSet{ |
| 90 | Namespace: namespace, |
| 91 | Object: object, |
| 92 | Relation: relation, |
| 93 | }, nil |
| 94 | } |
| 95 | |
| 96 | func (t TreeNodeType) String() string { |
| 97 | return string(t) |
no outgoing calls