diff --git a/compose/service/automation_trigger.go b/compose/service/automation_trigger.go index 68ef09037..f9d92cbe0 100644 --- a/compose/service/automation_trigger.go +++ b/compose/service/automation_trigger.go @@ -129,6 +129,13 @@ func (svc automationTrigger) isValid(ctx context.Context, s *automation.Script, return errors.WithStack(ErrNoTriggerManagementPermissions) } } + + case "interval", + "deferred": + if s.RunAs == 0 { + return errors.WithStack(automation.ErrAutomationScriptMissingUser) + } + default: return errors.WithStack(automation.ErrAutomationTriggerInvalidEvent) } diff --git a/pkg/automation/script.go b/pkg/automation/script.go index f55f348f4..0ed5ff9b8 100644 --- a/pkg/automation/script.go +++ b/pkg/automation/script.go @@ -99,7 +99,8 @@ const ( ) var ( - ErrAutomationScriptInvalid = errors.New("AutomationScriptInvalid") + ErrAutomationScriptInvalid = errors.New("AutomationScriptInvalid") + ErrAutomationScriptMissingUser = errors.New("AutomationScriptMissingUser") ) // IsValid - enabled, deleted?