MCPcopy Create free account
hub / github.com/compozy/agh / validateActorWriteAccess

Function validateActorWriteAccess

internal/resources/validate.go:119–130  ·  view source on GitHub ↗
(actor MutationActor, kind ResourceKind, scope ResourceScope)

Source from the content-addressed store, hash-verified

117}
118
119func validateActorWriteAccess(actor MutationActor, kind ResourceKind, scope ResourceScope) error {
120 if !actorAllowsKind(actor, kind) {
121 return fmt.Errorf("%w: actor cannot access resource kind %q", ErrPermissionDenied, kind)
122 }
123 if !actorAllowsScopeKind(actor, scope.Kind) {
124 return fmt.Errorf("%w: actor cannot access scope kind %q", ErrPermissionDenied, scope.Kind)
125 }
126 if !actorAllowsScope(actor, scope) {
127 return fmt.Errorf("%w: actor max scope does not allow %q/%q", ErrPermissionDenied, scope.Kind, scope.ID)
128 }
129 return nil
130}
131
132func validateActorReadAccess(actor MutationActor, record RawRecord) error {
133 if !actorAllowsKind(actor, record.Kind) {

Callers 4

preparePutRawMethod · 0.85
putRawWithExecutorMethod · 0.85
deleteRawWithExecutorMethod · 0.85
prepareSnapshotApplyMethod · 0.85

Calls 3

actorAllowsKindFunction · 0.85
actorAllowsScopeKindFunction · 0.85
actorAllowsScopeFunction · 0.85

Tested by

no test coverage detected