Adds ability to filter the outgoing dashboard model

This commit is contained in:
Shannon
2018-12-11 12:32:51 +11:00
parent f9967e2d7d
commit e91cf0039b
2 changed files with 13 additions and 1 deletions

View File

@@ -118,6 +118,7 @@ namespace Umbraco.Web.Editors
}
[ValidateAngularAntiForgeryToken]
[OutgoingEditorModelEvent]
public IEnumerable<Tab<DashboardControl>> GetDashboard(string section)
{
return _dashboards.GetDashboards(section, Security.CurrentUser);

View File

@@ -1,4 +1,5 @@
using System.Web.Http.Filters;
using System.Collections.Generic;
using System.Web.Http.Filters;
using Umbraco.Core.Events;
using Umbraco.Web.Models.ContentEditing;
@@ -13,6 +14,13 @@ namespace Umbraco.Web.Editors
public static event TypedEventHandler<HttpActionExecutedContext, EditorModelEventArgs<MediaItemDisplay>> SendingMediaModel;
public static event TypedEventHandler<HttpActionExecutedContext, EditorModelEventArgs<MemberDisplay>> SendingMemberModel;
public static event TypedEventHandler<HttpActionExecutedContext, EditorModelEventArgs<UserDisplay>> SendingUserModel;
public static event TypedEventHandler<HttpActionExecutedContext, EditorModelEventArgs<IEnumerable<Tab<DashboardControl>>>> SendingDashboardModel;
private static void OnSendingDashboardModel(HttpActionExecutedContext sender, EditorModelEventArgs<IEnumerable<Tab<DashboardControl>>> e)
{
var handler = SendingDashboardModel;
handler?.Invoke(sender, e);
}
private static void OnSendingUserModel(HttpActionExecutedContext sender, EditorModelEventArgs<UserDisplay> e)
{
@@ -56,6 +64,9 @@ namespace Umbraco.Web.Editors
if (e.Model is UserDisplay)
OnSendingUserModel(sender, new EditorModelEventArgs<UserDisplay>(e));
if (e.Model is IEnumerable<Tab<DashboardControl>>)
OnSendingDashboardModel(sender, new EditorModelEventArgs<IEnumerable<Tab<DashboardControl>>>(e));
}
}
}