diff --git a/src/Infrastructure/BotSharp.Core.Crontab/Abstraction/ICrontabAuthenticationHook.cs b/src/Infrastructure/BotSharp.Core.Crontab/Abstraction/ICrontabAuthenticationHook.cs new file mode 100644 index 00000000..031c67fb --- /dev/null +++ b/src/Infrastructure/BotSharp.Core.Crontab/Abstraction/ICrontabAuthenticationHook.cs @@ -0,0 +1,13 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace BotSharp.Core.Crontab.Abstraction +{ + public interface ICrontabAuthenticationHook + { + void SetUserIdentity(CrontabItem item); + } +} diff --git a/src/Infrastructure/BotSharp.Core.Crontab/Services/CrontabService.cs b/src/Infrastructure/BotSharp.Core.Crontab/Services/CrontabService.cs index cf4e1846..213dbbaa 100644 --- a/src/Infrastructure/BotSharp.Core.Crontab/Services/CrontabService.cs +++ b/src/Infrastructure/BotSharp.Core.Crontab/Services/CrontabService.cs @@ -115,7 +115,11 @@ public class CrontabService : ICrontabService, ITaskFeeder public async Task ScheduledTimeArrived(CrontabItem item) { _logger.LogDebug($"ScheduledTimeArrived {item}"); - + HookEmitter.Emit(_services, hook => + { + hook.SetUserIdentity(item); + }); + await HookEmitter.Emit(_services, async hook => { if (hook.Triggers == null || hook.Triggers.Contains(item.Title))