( id toolspkg.ToolID, filter *resources.ResourceFilter, scope toolspkg.Scope, )
| 376 | } |
| 377 | |
| 378 | func nativeApplyResourceScope( |
| 379 | id toolspkg.ToolID, |
| 380 | filter *resources.ResourceFilter, |
| 381 | scope toolspkg.Scope, |
| 382 | ) error { |
| 383 | if filter == nil || scope.Operator || strings.TrimSpace(scope.WorkspaceID) == "" { |
| 384 | return nil |
| 385 | } |
| 386 | workspaceScope := resources.ResourceScope{ |
| 387 | Kind: resources.ResourceScopeKindWorkspace, |
| 388 | ID: strings.TrimSpace(scope.WorkspaceID), |
| 389 | } |
| 390 | if filter.Scope == nil { |
| 391 | filter.Scope = &workspaceScope |
| 392 | return nil |
| 393 | } |
| 394 | if filter.Scope.Kind.Normalize() != resources.ResourceScopeKindWorkspace || |
| 395 | strings.TrimSpace(filter.Scope.ID) != workspaceScope.ID { |
| 396 | return nativeScopeMismatchError(id, "scope") |
| 397 | } |
| 398 | filter.Scope.ID = workspaceScope.ID |
| 399 | return nil |
| 400 | } |
| 401 | |
| 402 | func nativeResourceRecordAllowed(scope toolspkg.Scope, record resources.RawRecord) bool { |
| 403 | if scope.Operator || strings.TrimSpace(scope.WorkspaceID) == "" { |
no test coverage detected