Added max list size circumvention for file transfers between sites.
This commit is contained in:
@@ -122,36 +122,46 @@ public class HtmlExportService
|
||||
AppendFilterInput(sb);
|
||||
AppendTableOpen(sb);
|
||||
sb.AppendLine("<thead><tr>");
|
||||
sb.AppendLine($" <th>{T["report.col.object"]}</th><th>{T["report.col.title"]}</th><th>{T["report.col.url"]}</th><th>{T["report.badge.unique"]}</th><th>{T["report.col.users_groups"]}</th><th>{T["report.col.permission_level"]}</th><th>{T["report.col.simplified"]}</th><th>{T["report.col.risk"]}</th><th>{T["report.col.granted_through"]}</th>");
|
||||
sb.AppendLine($" <th>{T["report.col.users_groups"]}</th><th>{T["report.col.permission_level"]}</th><th>{T["report.col.simplified"]}</th><th>{T["report.col.risk"]}</th><th>{T["report.col.granted_through"]}</th>");
|
||||
sb.AppendLine("</tr></thead>");
|
||||
sb.AppendLine("<tbody>");
|
||||
|
||||
int grpMemIdx = 0;
|
||||
foreach (var entry in entries)
|
||||
int sectionIdx = 0;
|
||||
var groups = entries.GroupBy(e => (e.ObjectType, e.Title, e.Url)).ToList();
|
||||
foreach (var group in groups)
|
||||
{
|
||||
var typeCss = ObjectTypeCss(entry.ObjectType);
|
||||
var uniqueCss = entry.HasUniquePermissions ? "badge unique" : "badge inherited";
|
||||
var uniqueLbl = entry.HasUniquePermissions ? T["report.badge.unique"] : T["report.badge.inherited"];
|
||||
var (riskBg, riskText, riskBorder) = RiskLevelColors(entry.RiskLevel);
|
||||
var sectionId = $"sec{sectionIdx++}";
|
||||
var first = group.First();
|
||||
var typeCss = ObjectTypeCss(group.Key.ObjectType);
|
||||
var uniqueCss = first.HasUniquePermissions ? "badge unique" : "badge inherited";
|
||||
var uniqueLbl = first.HasUniquePermissions ? T["report.badge.unique"] : T["report.badge.inherited"];
|
||||
var count = group.Count();
|
||||
|
||||
var (pills, subRows) = BuildUserPillsCell(
|
||||
entry.UserLogins, entry.Inner.Users, entry.Inner.PrincipalType, groupMembers,
|
||||
colSpan: 9, grpMemIdx: ref grpMemIdx,
|
||||
targetLabel: entry.TargetLabel, sharingLinkType: entry.SharingLinkType,
|
||||
hideSystemGroupRaw: hideSystemGroupRaw);
|
||||
|
||||
sb.AppendLine("<tr>");
|
||||
sb.AppendLine($" <td><span class=\"{typeCss}\">{HtmlEncode(entry.ObjectType)}</span></td>");
|
||||
sb.AppendLine($" <td>{HtmlEncode(entry.Title)}</td>");
|
||||
sb.AppendLine($" <td><a href=\"{HtmlEncode(entry.Url)}\" target=\"_blank\">{T["report.text.link"]}</a></td>");
|
||||
sb.AppendLine($" <td><span class=\"{uniqueCss}\">{uniqueLbl}</span></td>");
|
||||
sb.AppendLine($" <td>{pills}</td>");
|
||||
sb.AppendLine($" <td>{HtmlEncode(entry.PermissionLevels)}</td>");
|
||||
sb.AppendLine($" <td>{HtmlEncode(entry.SimplifiedLabels)}</td>");
|
||||
sb.AppendLine($" <td><span class=\"risk-badge\" style=\"background:{riskBg};color:{riskText};border-color:{riskBorder}\">{HtmlEncode(entry.RiskLevel.ToString())}</span></td>");
|
||||
sb.AppendLine($" <td>{BuildGrantedThroughCell(entry.GrantedThrough, entry.TargetUrl, entry.TargetLabel, entry.SharingLinkType, hideSystemGroupRaw)}</td>");
|
||||
sb.AppendLine($"<tr class=\"section-header collapsed\" data-section=\"{sectionId}\">");
|
||||
sb.AppendLine($" <td colspan=\"5\"><span class=\"chevron\">▼</span><span class=\"{typeCss}\">{HtmlEncode(group.Key.ObjectType)}</span> <strong>{HtmlEncode(group.Key.Title)}</strong> <a href=\"{HtmlEncode(group.Key.Url)}\" target=\"_blank\">↗</a> <span class=\"{uniqueCss}\">{uniqueLbl}</span><span class=\"entry-badge\">{count} {T["report.text.entries_unit"]}</span></td>");
|
||||
sb.AppendLine("</tr>");
|
||||
if (subRows.Length > 0) sb.Append(subRows);
|
||||
|
||||
foreach (var entry in group)
|
||||
{
|
||||
var (riskBg, riskText, riskBorder) = RiskLevelColors(entry.RiskLevel);
|
||||
|
||||
var (pills, subRows) = BuildUserPillsCell(
|
||||
entry.UserLogins, entry.Inner.Users, entry.Inner.PrincipalType, groupMembers,
|
||||
colSpan: 5, grpMemIdx: ref grpMemIdx,
|
||||
targetLabel: entry.TargetLabel, sharingLinkType: entry.SharingLinkType,
|
||||
hideSystemGroupRaw: hideSystemGroupRaw,
|
||||
sectionId: sectionId);
|
||||
|
||||
sb.AppendLine($"<tr data-section-member=\"{sectionId}\" style=\"display:none\">");
|
||||
sb.AppendLine($" <td>{pills}</td>");
|
||||
sb.AppendLine($" <td>{HtmlEncode(entry.PermissionLevels)}</td>");
|
||||
sb.AppendLine($" <td>{HtmlEncode(entry.SimplifiedLabels)}</td>");
|
||||
sb.AppendLine($" <td><span class=\"risk-badge\" style=\"background:{riskBg};color:{riskText};border-color:{riskBorder}\">{HtmlEncode(entry.RiskLevel.ToString())}</span></td>");
|
||||
sb.AppendLine($" <td>{BuildGrantedThroughCell(entry.GrantedThrough, entry.TargetUrl, entry.TargetLabel, entry.SharingLinkType, hideSystemGroupRaw)}</td>");
|
||||
sb.AppendLine("</tr>");
|
||||
if (subRows.Length > 0) sb.Append(subRows);
|
||||
}
|
||||
}
|
||||
|
||||
AppendTableClose(sb);
|
||||
|
||||
@@ -52,17 +52,62 @@ a:hover { text-decoration: underline; }
|
||||
.risk-card .rlabel { font-size: .8rem; margin-top: 2px; }
|
||||
.risk-card .users { font-size: .7rem; margin-top: 2px; opacity: 0.8; }
|
||||
.risk-badge { display: inline-block; padding: 2px 8px; border-radius: 4px; font-size: .75rem; font-weight: 600; border: 1px solid; }
|
||||
.section-header td { background: #edf2f7; font-weight: 600; cursor: pointer; padding: 8px 14px; border-bottom: 2px solid #cbd5e0; user-select: none; }
|
||||
.section-header:hover td { background: #e2e8f0; }
|
||||
.section-header .chevron { margin-right: 8px; display: inline-block; transition: transform 0.15s; }
|
||||
.section-header.collapsed .chevron { transform: rotate(-90deg); }
|
||||
.entry-badge { display: inline-block; background: #e2e8f0; color: #4a5568; border-radius: 10px; padding: 1px 8px; font-size: .75rem; font-weight: 600; margin-left: 8px; }
|
||||
";
|
||||
|
||||
internal const string InlineJs = @"function filterTable() {
|
||||
var input = document.getElementById('filter').value.toLowerCase();
|
||||
var rows = document.querySelectorAll('#permTable tbody tr');
|
||||
rows.forEach(function(row) {
|
||||
if (row.hasAttribute('data-group')) return;
|
||||
row.style.display = row.textContent.toLowerCase().indexOf(input) > -1 ? '' : 'none';
|
||||
var sections = document.querySelectorAll('#permTable tbody tr.section-header');
|
||||
if (sections.length === 0) {
|
||||
document.querySelectorAll('#permTable tbody tr').forEach(function(row) {
|
||||
if (row.hasAttribute('data-group')) return;
|
||||
row.style.display = row.textContent.toLowerCase().indexOf(input) > -1 ? '' : 'none';
|
||||
});
|
||||
return;
|
||||
}
|
||||
if (!input) {
|
||||
sections.forEach(function(hdr) {
|
||||
hdr.style.display = '';
|
||||
var sid = hdr.getAttribute('data-section');
|
||||
var collapsed = hdr.classList.contains('collapsed');
|
||||
document.querySelectorAll('[data-section-member=' + sid + ']:not([data-group])').forEach(function(r) {
|
||||
r.style.display = collapsed ? 'none' : '';
|
||||
});
|
||||
});
|
||||
return;
|
||||
}
|
||||
sections.forEach(function(hdr) {
|
||||
var sid = hdr.getAttribute('data-section');
|
||||
var members = document.querySelectorAll('[data-section-member=' + sid + ']:not([data-group])');
|
||||
var anyMatch = false;
|
||||
members.forEach(function(r) {
|
||||
var match = r.textContent.toLowerCase().indexOf(input) > -1;
|
||||
r.style.display = match ? '' : 'none';
|
||||
if (match) anyMatch = true;
|
||||
});
|
||||
if (!anyMatch && hdr.textContent.toLowerCase().indexOf(input) > -1) {
|
||||
anyMatch = true;
|
||||
members.forEach(function(r) { r.style.display = ''; });
|
||||
}
|
||||
hdr.style.display = anyMatch ? '' : 'none';
|
||||
});
|
||||
}
|
||||
document.addEventListener('click', function(ev) {
|
||||
var hdr = ev.target.closest('.section-header');
|
||||
if (hdr) {
|
||||
var sid = hdr.getAttribute('data-section');
|
||||
hdr.classList.toggle('collapsed');
|
||||
var collapsed = hdr.classList.contains('collapsed');
|
||||
document.querySelectorAll('[data-section-member=' + sid + ']').forEach(function(r) {
|
||||
if (r.hasAttribute('data-group')) { r.style.display = 'none'; return; }
|
||||
r.style.display = collapsed ? 'none' : '';
|
||||
});
|
||||
return;
|
||||
}
|
||||
var trigger = ev.target.closest('.group-expandable');
|
||||
if (!trigger) return;
|
||||
var id = trigger.getAttribute('data-group-target');
|
||||
@@ -141,7 +186,8 @@ document.addEventListener('click', function(ev) {
|
||||
ref int grpMemIdx,
|
||||
string? targetLabel = null,
|
||||
string? sharingLinkType = null,
|
||||
bool hideSystemGroupRaw = false)
|
||||
bool hideSystemGroupRaw = false,
|
||||
string? sectionId = null)
|
||||
{
|
||||
var T = TranslationSource.Instance;
|
||||
var logins = userLogins.Split(';', StringSplitOptions.RemoveEmptyEntries);
|
||||
@@ -173,35 +219,48 @@ document.addEventListener('click', function(ev) {
|
||||
|
||||
if (hasResolvedMembers && groupMembers!.TryGetValue(name, out var resolved))
|
||||
{
|
||||
var grpId = $"grpmem{grpMemIdx}";
|
||||
pills.Append("<span class=\"user-pill group-expandable\"");
|
||||
if (isResolvedSystemGroup)
|
||||
pills.Append(" data-system-group=\"1\"");
|
||||
pills.Append($" data-group-target=\"{HtmlEncode(grpId)}\" data-email=\"{HtmlEncode(login)}\">");
|
||||
if (isResolvedSystemGroup)
|
||||
if (resolved.Count == 0)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(sharingLinkType))
|
||||
pills.Append(BuildSharingLinkBadge(sharingLinkType!));
|
||||
pills.Append(HtmlEncode(targetLabel!));
|
||||
// Members unavailable — render plain pill, skip expandable sub-row.
|
||||
var cls2 = isResolvedSystemGroup ? "user-pill\" data-system-group=\"1" : "user-pill";
|
||||
pills.Append($"<span class=\"{cls2}\" title=\"{HtmlEncode(T["report.text.empty_group"])}\" data-email=\"{HtmlEncode(login)}\">");
|
||||
if (isResolvedSystemGroup)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(sharingLinkType))
|
||||
pills.Append(BuildSharingLinkBadge(sharingLinkType!));
|
||||
pills.Append(HtmlEncode(targetLabel!));
|
||||
}
|
||||
else
|
||||
{
|
||||
pills.Append(HtmlEncode(name));
|
||||
}
|
||||
pills.Append("</span>");
|
||||
}
|
||||
else
|
||||
{
|
||||
pills.Append(HtmlEncode(name));
|
||||
}
|
||||
pills.Append(" ▼</span>");
|
||||
var grpId = $"grpmem{grpMemIdx}";
|
||||
pills.Append("<span class=\"user-pill group-expandable\"");
|
||||
if (isResolvedSystemGroup)
|
||||
pills.Append(" data-system-group=\"1\"");
|
||||
pills.Append($" data-group-target=\"{HtmlEncode(grpId)}\" data-email=\"{HtmlEncode(login)}\">");
|
||||
if (isResolvedSystemGroup)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(sharingLinkType))
|
||||
pills.Append(BuildSharingLinkBadge(sharingLinkType!));
|
||||
pills.Append(HtmlEncode(targetLabel!));
|
||||
}
|
||||
else
|
||||
{
|
||||
pills.Append(HtmlEncode(name));
|
||||
}
|
||||
pills.Append(" ▼</span>");
|
||||
|
||||
string memberContent;
|
||||
if (resolved.Count > 0)
|
||||
{
|
||||
var parts = resolved.Select(m => $"{HtmlEncode(m.DisplayName)} <{HtmlEncode(m.Login)}>");
|
||||
memberContent = string.Join(" • ", parts);
|
||||
var memberContent = string.Join(" • ", parts);
|
||||
var sectionAttr = sectionId != null ? $" data-section-member=\"{HtmlEncode(sectionId)}\"" : "";
|
||||
subRows.AppendLine($"<tr data-group=\"{HtmlEncode(grpId)}\"{sectionAttr} style=\"display:none\"><td colspan=\"{colSpan}\" style=\"padding-left:2em;font-size:.8rem;color:#555\">{memberContent}</td></tr>");
|
||||
grpMemIdx++;
|
||||
}
|
||||
else
|
||||
{
|
||||
memberContent = $"<em style=\"color:#888\">{T["report.text.members_unavailable"]}</em>";
|
||||
}
|
||||
subRows.AppendLine($"<tr data-group=\"{HtmlEncode(grpId)}\" style=\"display:none\"><td colspan=\"{colSpan}\" style=\"padding-left:2em;font-size:.8rem;color:#555\">{memberContent}</td></tr>");
|
||||
grpMemIdx++;
|
||||
}
|
||||
else if (isResolvedSystemGroup)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user