(actor ActorContext, scope Scope)
| 2529 | } |
| 2530 | |
| 2531 | func requireCreateAuthority(actor ActorContext, scope Scope) error { |
| 2532 | if err := requireWriteAuthority(actor); err != nil { |
| 2533 | return err |
| 2534 | } |
| 2535 | |
| 2536 | switch scope.Normalize() { |
| 2537 | case ScopeGlobal: |
| 2538 | if !actor.Authority.CreateGlobal { |
| 2539 | return ErrPermissionDenied |
| 2540 | } |
| 2541 | case ScopeWorkspace: |
| 2542 | if !actor.Authority.CreateWorkspace { |
| 2543 | return ErrPermissionDenied |
| 2544 | } |
| 2545 | default: |
| 2546 | return fmt.Errorf("%w: create_task.scope is required", ErrValidation) |
| 2547 | } |
| 2548 | return nil |
| 2549 | } |
| 2550 | |
| 2551 | func normalizeCreateTaskSpec(spec CreateTask) (CreateTask, error) { |
| 2552 | normalized := spec |
no test coverage detected