public override void BuildDynamicFolders(PathIdentifier identifier, ItemQueryResponse page, FolderModel folder, bool isRestrictedView = false) { if (EDiscoveryUtility.IsUserEDiscovery(connection.UserAccessIdentifiers) || LEOUploadUtility.IsUserLeo(connection.UserAccessIdentifiers)) { return; } var logPathIdentifier = new PathIdentifier(identifier) { PathKey = LOG_READER_PATH_KEY }; if (page.PathTree.Paths == null) { page.PathTree.Paths = new List <ManagerPathModel>(); } // Last the parent / root node of 'eDiscovery' var logPath = new ManagerPathModel { Identifier = logPathIdentifier, Icons = new string[] { "fa-history" }, Name = "Logs", FullPath = LOG_READER_PATH_KEY, AllowedOperations = null, Paths = new List <ManagerPathModel>(), IsExpanded = false }; page.PathTree.Paths.Add(logPath); }
public void RecurseTree(ManagerPathModel node, Action <ManagerPathModel> action) { if (node != null) { action(node); if (node.Paths?.Any() ?? false) { foreach (var child in node.Paths) { RecurseTree(child, action); } } } }
protected void SecurityPrunePaths(ManagerPathModel node) { node.Paths = node.Paths.Where(p => IsAllowed(p.Identifier)) .ToList(); if (!IsAllowed(node.Identifier, includeAncestors: false)) { node.AllowedOperations = null; } foreach (var child in node.Paths) { SecurityPrunePaths(child); } }
public override void BuildDynamicFolders(PathIdentifier identifier, ItemQueryResponse page, FolderModel folder, bool isRestrictedView = false) { if (!isRestrictedView) { var leoUploadRootIdentifier = new PathIdentifier(identifier) { PathKey = LEOUploadUtility.LEO_UPLOAD_PATH_KEY }; // If it hasn't been added then it's going to be generated dynamically like this. if (!page?.PathTree?.Paths?.Any(p => p.Identifier.PathKey == LEOUploadUtility.LEO_UPLOAD_PATH_KEY) ?? false) { if (page.PathTree.Paths == null) { page.PathTree.Paths = new List <ManagerPathModel>(); } // Last the parent / root node of 'eDiscovery' var leoUploadPath = new ManagerPathModel { Identifier = leoUploadRootIdentifier, Icons = new string[] { LEOUploadUtility.LEO_UPLOAD_FOLDER_COLOR_STYLE }, Name = LEOUploadUtility.LEO_UPLOAD_PATH_NAME, FullPath = LEOUploadUtility.LEO_UPLOAD_PATH_KEY, AllowedOperations = null, Paths = new List <ManagerPathModel>(), IsExpanded = false // TODO: Put in the real logic here. }; page.PathTree.Paths.Add(leoUploadPath); } else { // In this case it already exists in the path tree, we're going to move it around, and alter some of it's properties. // this also means that there's a child folder for an officer underneath the LEO Upload path. // This is also where you might want to put some ordering in place. var leoUploadManagerPath = page.PathTree.Paths.Where(path => path.Identifier.PathKey == LEOUploadUtility.LEO_UPLOAD_PATH_KEY).FirstOrDefault(); // Now that we have the path, we're going to do things like change it's icon color. if (leoUploadManagerPath != null) { leoUploadManagerPath.Icons = new string[] { LEOUploadUtility.LEO_UPLOAD_FOLDER_COLOR_STYLE }; leoUploadManagerPath.AllowedOperations = null; leoUploadManagerPath.IsExpanded = true; } // We also want to color all the children blue as well. foreach (var child in leoUploadManagerPath.Paths) { child.Icons = new string[] { LEOUploadUtility.LEO_UPLOAD_FOLDER_COLOR_STYLE }; } // Now we need to move this order around. page.PathTree.Paths.Remove(leoUploadManagerPath); page.PathTree.Paths.Add(leoUploadManagerPath); } RecurseTree(page.PathTree, path => { if (path.Identifier.IsChildOf(leoUploadRootIdentifier) && (path.AllowedOperations?.Any() ?? false)) { path.AllowedOperations = path.AllowedOperations.Where(a => !(a.BatchOperation is MoveIntoRequest)); } }); } }
public override void BuildDynamicFolders(PathIdentifier identifier, ItemQueryResponse page, FolderModel folder, bool isRestrictedView) { if (!page?.PathTree?.Paths?.Any(p => p.Identifier.PathKey == EDiscoveryUtility.E_DISCOVERY_PATH_KEY) ?? false) { if (page.PathTree.Paths == null) { page.PathTree.Paths = new List <ManagerPathModel>(); } var managerPathModels = new List <ManagerPathModel>(); // we have to build up the children first. // First we get all the dated package dynamic paths. var datedPackagePaths = BuildDatedPackagesDynamicFolder(folder); var eDiscoveryIdentifier = new PathIdentifier(identifier) { PathKey = EDiscoveryUtility.E_DISCOVERY_PATH_KEY }; // Last the parent / root node of 'eDiscovery' var eDiscoveryPath = new ManagerPathModel { Identifier = eDiscoveryIdentifier, Icons = new string[] { EDiscoveryUtility.EDISCOVERY_FOLDER_COLOR_STYLE }, Name = EDiscoveryUtility.E_DISCOVERY_PATH_NAME, FullPath = EDiscoveryUtility.E_DISCOVERY_PATH_KEY, AllowedOperations = null, Paths = new List <ManagerPathModel>(), IsExpanded = datedPackagePaths.Count > 0 || EDiscoveryUtility.GetStagedCount(folder) > 0, }; if (datedPackagePaths.Any()) { var allPackagesIdentifier = new PathIdentifier(identifier as FolderIdentifier, EDiscoveryUtility.E_DISCOVERY_ALL_PACKAGE_PATH_KEY); var packageName = "All"; var processor = new PathProcessor(folder.Identifier); processor.Read(folder, skipFolderPaths: true, pathReader: f => { var sharePath = f.MetaEDiscoveryPathIdentifierRead(); if (sharePath != null) { return(allPackagesIdentifier.CreateChild(sharePath.PathKey)); } else { return(sharePath); } }); datedPackagePaths.Insert(0, new EDiscoveryManagerPathModel() { Identifier = allPackagesIdentifier, Icons = new string[] { EDiscoveryUtility.EDISCOVERY_FOLDER_COLOR_STYLE }, Name = packageName, FullPath = allPackagesIdentifier.FullName, Paths = processor[allPackagesIdentifier]?.Paths }); } eDiscoveryPath.Paths = eDiscoveryPath.Paths.Concat(datedPackagePaths).ToList(); if (!isRestrictedView) { eDiscoveryPath.Paths.Add(GetNotSharedYetPath(folder)); } page.PathTree.Paths.Add(eDiscoveryPath); } }