예제 #1
0
        public EDiscoveryManagerPathModel GetNotSharedYetPath(FolderModel folder)
        {
            // We need to get the staged count, as it will allow us to A. determine if we're going to show the not shared yet folder,
            // and B. a cound on the not shared yet folder.
            var stagedCount         = EDiscoveryUtility.GetStagedCount(folder);
            var notSharedIdentifier = new PathIdentifier(folder.Identifier, EDiscoveryUtility.E_DISCOVERY_NOT_SHARED_PATH_KEY);

            var processor = new PathProcessor(folder.Identifier);

            processor.Read(folder, skipFolderPaths: true, pathReader: f => {
                if (f.ShareState() != EDiscoveryShareState.Staged)
                {
                    return(null);
                }

                var sharePath = f.MetaEDiscoveryPathIdentifierRead();

                if (sharePath != null)
                {
                    return(notSharedIdentifier.CreateChild(sharePath.PathKey));
                }

                return(null);
            });

            return(new EDiscoveryManagerPathModel()
            {
                Identifier = notSharedIdentifier,
                Icons = new string[] { EDiscoveryUtility.EDISCOVERY_FOLDER_COLOR_STYLE },
                Name = $"Not Shared Yet ({stagedCount.ToString()})",
                FullPath = "eDiscovery/Not Shared Yet",
                AllowedOperations = null,
                Paths = processor[notSharedIdentifier]?.Paths
            });
        }
예제 #2
0
        public PathProcessor(FolderIdentifier folderIdentifier)
        {
            this.PathMap          = new Dictionary <PathIdentifier, ManagerPathModel>();
            this.FolderIdentifier = folderIdentifier;

            Add(PathIdentifier.Root(folderIdentifier));
        }
예제 #3
0
        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);
        }
예제 #4
0
        public override BaseItemQueryHandler GetInitialQueryHandler(PathIdentifier identifier, PathService pathService, APIConnection connection, IAuditLogStore auditLogStore, ManagerConfiguration managerConfiguration, FileService fileService)
        {
            // If the user is leo user, we're going to use a special query handler that
            // will return only the files the user is allowed to see.
            if (LEOUploadUtility.IsUserLeo(connection.UserAccessIdentifiers))
            {
                var userKey = connection.UserIdentifier.UserKey;

                // here we're going to do some basic security check.  The userKey has a folder key on it.  We need to make sure that matches.
                var userKeyTokens = userKey.Split(':').ToList();
                // now this will be an array, of tokens, keep in mind userkeys can be something like Defendant:18337980:[email protected], so we want everything before the last ':'
                // so we can remove the last token, and then we'll be able to just join back everything else.
                userKeyTokens.RemoveAt(userKeyTokens.Count - 1);
                // also get rid of the leo: prefix
                userKeyTokens.RemoveAt(0);
                var folderKeyFromUser = String.Join(':', userKeyTokens);
                if (folderKeyFromUser != identifier.FolderKey)
                {
                    throw (new UnauthorizedAccessException($"You're not authorized for this Folder userKey:{userKey} tried to access: {identifier.FolderKey}"));
                }

                return(new LEOUserItemQueryHandler(pathService, connection, auditLogStore, this, managerConfiguration, fileService));
            }

            if (identifier.PathKey == LEOUploadUtility.LEO_UPLOAD_PATH_KEY)
            {
                return(new LEOUploadRootQueryHandler(pathService, connection, auditLogStore, this, managerConfiguration, fileService));
            }

            return(null);
        }
예제 #5
0
        protected virtual async Task Initialize(PathIdentifier identifier)
        {
            state = await pathService.OpenFolder(identifier);

            page = new ItemQueryResponse
            {
                PathName = identifier.LeafName,
                PathTree = state.Paths.Root,
            };

            if (state.Folder != null)
            {
                var caseNumber = state.Folder.Read <string>("attribute.casenumber");
                var lastName   = state.Folder.Read <string>("attribute.lastname");

                if (lastName != null)
                {
                    if (caseNumber != null)
                    {
                        page.PathTree.Name = $"{lastName} ({caseNumber})";
                    }
                    else
                    {
                        page.PathTree.Name = lastName;
                    }
                }
            }

            filteredFiles = state.Folder.Files.Rows as IEnumerable <FileModel>; //A collection of files that we will use to build up our response.
        }
예제 #6
0
 public override void AlterGridTitle(string gridTitle, PathIdentifier identifier)
 {
     if (EDiscoveryUtility.IsEDiscoveryPath(identifier))
     {
         gridTitle = identifier.FullName;
     }
 }
예제 #7
0
 protected override void AddSubpaths(List <IModule> activeModules, PathIdentifier identifier)
 {
     if (IsAllowed(identifier, includeAncestors: false))
     {
         base.AddSubpaths(activeModules, identifier);
     }
 }
예제 #8
0
        protected virtual void AddSubpaths(List <IModule> activeModules, PathIdentifier identifier)
        {
            // add subpaths
            var requestedPath = state.Paths[identifier];

            if (requestedPath?.Paths != null)
            {
                foreach (var p in requestedPath.Paths)
                {
                    allRows.Add(new ManagerPathModel
                    {
                        Identifier        = p.Identifier,
                        AllowedOperations = GetSubPathOperations(activeModules, p.Identifier),
                        FullPath          = p.FullPath,
                        Icons             = p.Icons,
                        Name  = p.Name,
                        Paths = null
                    });
                }
            }

            foreach (var module in activeModules)
            {
                module.FinalFilter(allRows, identifier);
            }
        }
예제 #9
0
 private AllowedOperation[] GetDefaultAllowedOperations(PathIdentifier pathIdentifier)
 {
     return(new AllowedOperation[]
     {
         AllowedOperation.GetAllowedOperationMove(pathIdentifier, pathIdentifier)
     });
 }
        protected override async Task Initialize(PathIdentifier identifier)
        {
            state = await pathService.OpenFolder(identifier, true);

            page = new ItemQueryResponse
            {
                PathName = identifier.LeafName,
                PathTree = state.Paths.Root,
            };
            // Only add an audit log entry if the user accessed a package. If full path == null, then they're hitting "Case Files"
            if (!String.IsNullOrEmpty(identifier.FullName))
            {
                await this.auditLogStore.AddEntry(
                    new AuditLogEntry()
                {
                    EntryType  = AuditLogEntryType.eDiscoveryUserPackageAccess,
                    Message    = $"User Accessed Package: \"{identifier.PathKey.Replace(EDiscoveryUtility.E_DISCOVERY_PATH_NAME + "/", "")}\" ",
                    ModuleType = ModuleType.eDiscovery
                },
                    identifier as FolderIdentifier
                    );
            }

            filteredFiles = state.Folder.Files.Rows as IEnumerable <FileModel>; //A collection of files that we will use to build up our response.
        }
예제 #11
0
 protected virtual void BuildDynamicFolders(List <IModule> activeModules, PathIdentifier identifier, ItemQueryResponse page, FolderModel folder)
 {
     foreach (var module in activeModules)
     {
         // False here signals that this is not the restricted view.  So for instance with eDiscovery the not shared yet folder will be included.
         module.BuildDynamicFolders(identifier, page, state.Folder, false);
     }
 }
예제 #12
0
 public ManagerPathModel this[PathIdentifier pathIdentifier]
 {
     get
     {
         Add(pathIdentifier);
         return(PathMap[pathIdentifier]);
     }
 }
 protected override void BuildDynamicFolders(List <IModule> activeModules, PathIdentifier identifier, ItemQueryResponse page, FolderModel folder)
 {
     foreach (var module in activeModules)
     {
         // true here means that this is a restricted view, so for things like EDiscovery the not shared yet folder will not be included.
         module.BuildDynamicFolders(identifier, page, state.Folder, true);
     }
 }
 protected virtual void InternalFilterFiles(PathIdentifier identifier)
 {
     filteredFiles = filteredFiles
                     .Where(f => f.Read <string>(MetadataKeyConstants.E_DISCOVERY_SHARE_STATE_META_KEY) == EDiscoveryShareState.Published.ToString())
                     .Where(f => PackageName == "all" ||
                            f.Read <string>(MetadataKeyConstants.E_DISCOVERY_SHARE_PACKGAGE) == PackageName
                            );
 }
예제 #15
0
        public override BaseItemQueryHandler GetInitialQueryHandler(PathIdentifier identifier, PathService pathService, APIConnection connection, IAuditLogStore auditLogStore, ManagerConfiguration managerConfiguration, FileService fileService)
        {
            if (identifier.PathKey == LOG_READER_PATH_KEY)
            {
                return(new LogReaderQueryHandler(pathService, connection, managerConfiguration, fileService, logReaderService));
            }

            return(null);
        }
예제 #16
0
        public PathIdentifier GetOfficerPath(FolderIdentifier folderIdentifier, string firstName, string lastName)
        {
            var leoUploadFolder = new PathIdentifier(folderIdentifier, LEOUploadUtility.LEO_UPLOAD_PATH_KEY);

            // Here we're adding a child folder to the leo upload whenever we add a new officer.
            var childPath = leoUploadFolder.CreateChild($"{firstName} {lastName}");

            return(childPath);
        }
예제 #17
0
        protected override void BuildDynamicFolders(List <IModule> activeModules, PathIdentifier identifier, ItemQueryResponse page, FolderModel folder)
        {
            base.BuildDynamicFolders(activeModules, identifier, page, folder);

            if (IsLEOUser)
            {
                SecurityPrunePaths(page.PathTree);
            }
        }
예제 #18
0
        public ISourceFile GetLocalIncludeFile(string Path)
        {
            string absPath = new PathIdentifier(DirectoryPath, Path).AbsolutePath.Path;

            if (System.IO.File.Exists(absPath))
            {
                return(new SourceFile(new LazySourceDocument(absPath, Parameters.Log), Parameters));
            }
            return(null);
        }
예제 #19
0
        public static void MetaPathIdentifierWrite(this FileModel fileModel, PathIdentifier pathIdentifier)
        {
            if (pathIdentifier.OrganizationKey != fileModel.Identifier.OrganizationKey ||
                pathIdentifier.FolderKey != fileModel.Identifier.FolderKey)
            {
                throw new Exception("PathIdentifier does not reconcile with file's Identifier wrt: OrganizationKey or FolderKey");
            }

            fileModel.Write("_path", pathIdentifier.PathKey);
        }
예제 #20
0
        public List <EDiscoveryManagerPathModel> BuildDatedPackagesDynamicFolder(FolderModel folder)
        {
            var managerPaths = new List <EDiscoveryManagerPathModel>();

            var packageMap = folder.Read <EDiscoveryPackageMap>(MetadataKeyConstants.E_DISCOVERY_PACKAGE_MAP_METAKEY);

            if (this.IsModuleActive(folder))
            {
                // go through all the folders, and find all the
                foreach (var file in folder.Files.Rows
                         .Where(f => f.Read <string>(MetadataKeyConstants.E_DISCOVERY_SHARE_PACKGAGE) != null)
                         )
                {
                    var sharePackageName       = file.Read <string>(MetadataKeyConstants.E_DISCOVERY_SHARE_PACKGAGE);
                    var sharePackageIdentifier = new PathIdentifier(file.Identifier as FolderIdentifier, "eDiscovery/" + sharePackageName);

                    // Here we're checking to make sure we haven't already added this 'dated share folder'
                    if (!managerPaths.Any(mp => mp.Identifier.Equals(sharePackageIdentifier)))
                    {
                        var processor = new PathProcessor(folder.Identifier);
                        processor.Read(folder, skipFolderPaths: true, pathReader: f => {
                            var sharePath = f.MetaEDiscoveryPathIdentifierRead();
                            if (sharePackageName != null &&
                                f.Read <string>(MetadataKeyConstants.E_DISCOVERY_SHARE_PACKGAGE) != sharePackageName)
                            {
                                return(null);
                            }

                            if (sharePath != null)
                            {
                                return(sharePackageIdentifier.CreateChild(sharePath.PathKey));
                            }
                            else
                            {
                                return(sharePath);
                            }
                        });

                        var packagePath = new EDiscoveryManagerPathModel()
                        {
                            Identifier        = sharePackageIdentifier,
                            Icons             = new string[] { EDiscoveryUtility.EDISCOVERY_FOLDER_COLOR_STYLE },
                            Name              = sharePackageName,
                            FullPath          = sharePackageIdentifier.FullName,
                            Paths             = processor[sharePackageIdentifier]?.Paths,
                            CustomName        = EDiscoveryUtility.GetCustomName(packageMap, sharePackageName),
                            AllowedOperations = EDiscoveryUtility.IsUserEDiscovery(connection.UserAccessIdentifiers) ? new AllowedOperation[] { } : new AllowedOperation[] { AllowedOperation.GetAllowedOperationEditPackageName(folder.Identifier, sharePackageName) },
                        };
                        managerPaths.Add(packagePath);
                    }
                }
            }

            return(managerPaths);
        }
예제 #21
0
 public async Task SharePath(PathIdentifier pathIdentifier, bool shared)
 {
     if (shared)
     {
         await SharePathForEDiscoveryAsync(pathIdentifier);
     }
     else
     {
         await UnSharePathForEDiscoveryAsync(pathIdentifier);
     }
 }
        protected override List <AllowedOperation> GetPageAllowedOperations(PathIdentifier identifier)
        {
            var ops = new List <AllowedOperation>();

            if (ManagerConfiguration.IsFeatureEnabledSearch)
            {
                AllowedOperation.GetAllowedOperationSearch(identifier);
            }

            return(ops);
        }
예제 #23
0
        public static bool IsEDiscoveryPath(PathIdentifier pathIdentifier)
        {
            var path = pathIdentifier?.PathKey;

            return(path != null && (
                       path == EDiscoveryUtility.E_DISCOVERY_NOT_SHARED_PATH_KEY ||
                       path == EDiscoveryUtility.E_DISCOVERY_ALL_PACKAGE_PATH_KEY ||
                       path == EDiscoveryUtility.E_DISCOVERY_PATH_KEY ||
                       path.StartsWith(EDiscoveryUtility.E_DISCOVERY_DATED_PACKAGE_PATH_KEY)
                       ));
        }
예제 #24
0
        public override void OnResponse(ItemQueryResponse response, PathIdentifier pathIdentifier)
        {
            var leoUploadPath = new PathIdentifier(pathIdentifier as FolderIdentifier, LEOUploadUtility.LEO_UPLOAD_PATH_KEY);

            if (pathIdentifier.IsChildOf(leoUploadPath) && response.AllowedOperations != null)
            {
                if (!LEOUploadUtility.IsUserLeo(connection.UserAccessIdentifiers))
                {
                    response.AllowedOperations = response.AllowedOperations.Where(a => !(a.BatchOperation is UploadRequest));
                }
            }
        }
        protected override void FilterFiles(PathIdentifier identifier)
        {
            PackageIdentifier      = EDiscoveryUtility.GetPackageIdentifier(identifier);
            RelativePathIdentifier = identifier?.RelativeTo(PackageIdentifier);
            PackageName            = PackageIdentifier?.PathKey?.Replace("eDiscovery/", "");

            InternalFilterFiles(identifier);

            filteredFiles = filteredFiles
                            .Where(f => EDiscoveryUtility.IsPackageRelativePath(f, RelativePathIdentifier))
                            .Where(f => !f.Read <bool>(MetadataKeyConstants.HIDDEN));
        }
예제 #26
0
        public override void FinalFilter(List <IItemQueryResponse> allRows, PathIdentifier identifier)
        {
            var leoUploadPath = new PathIdentifier(identifier as FolderIdentifier, LEOUploadUtility.LEO_UPLOAD_PATH_KEY);

            if (identifier.IsRoot)
            {
                var subPath = allRows.OfType <ManagerPathModel>().FirstOrDefault(r => leoUploadPath.Equals(r.Identifier));
                if (subPath != null)
                {
                    allRows.Remove(subPath);
                }
            }
        }
예제 #27
0
 public override void AlterSubPathOperations(PathIdentifier pathIdentifier, List <AllowedOperation> subPathDefaultOperations)
 {
     if (EDiscoveryUtility.IsEDiscoveryPath(pathIdentifier))
     {
         // If it's an eDiscovery path, we're going to clear out the allowed operations.
         subPathDefaultOperations.Clear();
     }
     else
     {
         subPathDefaultOperations.Add(AllowedOperation.GetAllowedOperationShare(pathIdentifier, true));
         subPathDefaultOperations.Add(AllowedOperation.GetAllowedOperationShare(pathIdentifier, false));
     }
 }
예제 #28
0
 public ISourceFile GetAdditionalIncludeFile(string Path)
 {
     if (Parameters.Log.Options.HasOption("includes"))
     {
         foreach (var includeDir in Parameters.Log.Options.GetOption <string[]>("includes", new string[] { }))
         {
             string absPath = new PathIdentifier(includeDir, Path).AbsolutePath.Path;
             if (System.IO.File.Exists(absPath))
             {
                 return(new SourceFile(new LazySourceDocument(absPath, Parameters.Log), Parameters));
             }
         }
     }
     return(null);
 }
예제 #29
0
 protected override void FilterFiles(PathIdentifier identifier)
 {
     if (IsLEOUser)
     {
         //if (identifier.IsChildOf(OfficerPathIdentifier))
         {
             filteredFiles = filteredFiles
                             .Where(f => identifier.Equals(f.MetaPathIdentifierRead()))
                             .Where(f => !f.MetaHiddenRead())
                             .Where(f => f.MetaPathIdentifierRead()?.IsChildOf(OfficerPathIdentifier) ?? false);
         }
         //else
         //  filteredFiles = new FileModel[0];
     }
 }
예제 #30
0
        public async Task SharePathForEDiscoveryAsync(PathIdentifier pathIdentifier)
        {
            var notShared = await this.FilesOfStateInPath(EDiscoveryShareState.NotShared, pathIdentifier);

            foreach (var file in notShared)
            {
                var filePath     = file.MetaPathIdentifierRead();
                var relativePath = filePath.RelativeTo(pathIdentifier.ParentPathIdentifier);

                file.MetaEDiscoveryPathIdentifierWrite(relativePath);

                UpdateShareState(file, EDiscoveryShareState.Staged);
                await connection.File.PutAsync(file);
            }
        }