public override bool Executing(EventCenter center, EventActionHandler handler, IEventInput input, IEventOutput output) { input.Properties.TryGetValue("token", out string token); if (token == "admin") { return(base.Executing(center, handler, input, output)); } else { output.EventError = EventError.InnerError; output.Data = new object[] { "操作用户无效!" }; return(false); } }
public override bool Executing(EventCenter center, EventActionHandler handler, IEventInput input, IEventOutput output) { string token = null; input.Properties?.TryGetValue("token", out token); var user = JWTHelper.Default.GetUserInfo(token); if (user != null) { return(base.Executing(center, handler, input, output)); } else { output.EventError = EventError.InnerError; output.Data = new object[] { "操作错误,无权操作相关资源!" }; return(false); } }
public override bool Executing(EventCenter center, EventActionHandler handler, IEventInput input, IEventOutput output) { output.EventError = EventError.NotFound; output.Data = new object[] { $"{input.EventPath} not found!" }; return(false); }
public override void Executed(EventCenter center, EventActionHandler handler, IEventInput input, IEventOutput output) { base.Executed(center, handler, input, output); Console.WriteLine($"{input.EventPath} executed"); }
public override bool Executing(EventCenter center, EventActionHandler handler, IEventInput input, IEventOutput output) { Console.WriteLine($"{input.EventPath} executing"); return(base.Executing(center, handler, input, output)); }