Initial commit
This commit is contained in:
@@ -0,0 +1,35 @@
|
||||
using SharepointToolbox.Web.Core.Helpers;
|
||||
|
||||
namespace SharepointToolbox.Web.Core.Models;
|
||||
|
||||
public class SimplifiedPermissionEntry
|
||||
{
|
||||
public PermissionEntry Inner { get; }
|
||||
public string SimplifiedLabels { get; }
|
||||
public RiskLevel RiskLevel { get; }
|
||||
public IReadOnlyList<PermissionLevelMapping.MappingResult> Mappings { get; }
|
||||
|
||||
public string ObjectType => Inner.ObjectType;
|
||||
public string Title => Inner.Title;
|
||||
public string Url => Inner.Url;
|
||||
public bool HasUniquePermissions => Inner.HasUniquePermissions;
|
||||
public string Users => Inner.Users;
|
||||
public string UserLogins => Inner.UserLogins;
|
||||
public string PermissionLevels => Inner.PermissionLevels;
|
||||
public string GrantedThrough => Inner.GrantedThrough;
|
||||
public string PrincipalType => Inner.PrincipalType;
|
||||
public string? TargetUrl => Inner.TargetUrl;
|
||||
public string? TargetLabel => Inner.TargetLabel;
|
||||
public string? SharingLinkType => Inner.SharingLinkType;
|
||||
|
||||
public SimplifiedPermissionEntry(PermissionEntry entry)
|
||||
{
|
||||
Inner = entry;
|
||||
Mappings = PermissionLevelMapping.GetMappings(entry.PermissionLevels);
|
||||
SimplifiedLabels = PermissionLevelMapping.GetSimplifiedLabels(entry.PermissionLevels);
|
||||
RiskLevel = PermissionLevelMapping.GetHighestRisk(entry.PermissionLevels);
|
||||
}
|
||||
|
||||
public static IReadOnlyList<SimplifiedPermissionEntry> WrapAll(IEnumerable<PermissionEntry> entries)
|
||||
=> entries.Select(e => new SimplifiedPermissionEntry(e)).ToList();
|
||||
}
|
||||
Reference in New Issue
Block a user