support user details category in document bulk generation

This commit is contained in:
Gary Sharp
2023-04-14 16:40:13 +10:00
parent 13549e7ec4
commit 273b67c422
10 changed files with 812 additions and 169 deletions
@@ -12,6 +12,7 @@ using Disco.Web.Areas.Config.Models.DocumentTemplate;
using Disco.Web.Areas.Config.Views.DocumentTemplate;
using System;
using System.Collections.Generic;
using System.Diagnostics.Eventing.Reader;
using System.Linq;
using System.Web.Mvc;
@@ -262,6 +263,18 @@ namespace Disco.Web.Areas.Config.Controllers
throw new NotSupportedException();
}
}
if (Authorization.Has(Claims.User.ShowDetails))
{
m.UserDetails = Database.UserDetails.Where(d => d.Scope == "Details").GroupBy(d => d.Key).Select(g => new BulkGenerateModel.ItemWithCount<string>()
{
Item = g.Key,
Count = g.Count(),
}).ToList();
}
else
{
m.UserDetails = new List<BulkGenerateModel.ItemWithCount<string>>();
}
// UI Extensions
UIExtensions.ExecuteExtensions<ConfigDocumentTemplateBulkGenerate>(ControllerContext, m);