Exemplo n.º 1
0
 /// <summary>
 /// Return an instance of class that implement <see cref="IFastMultiplier"/> interface and used only allowed operations.
 /// </summary>
 /// <param name="options">Set allowed operation tha used rather then multiply operations</param>
 /// <returns></returns>
 public static IFastMultiplier GetFastMultiplier(AllowedOperation options)
 {
     switch (options)
     {
         case AllowedOperation.Mult:
             return new NoOptimizeMultiplier();
         case AllowedOperation.SubstractShift:
             return new MinuOfPowerOfTwoMultiplier();
         case AllowedOperation.SevenSum:
             return new SevenSumMultiplier();
         case AllowedOperation.SumShift:
         default:
             return new SumOfPowerOfTwoMultiplier();
     }
 }
Exemplo n.º 2
0
        public static UnknownSet UnknownSetGet(FileIdentifier fileIdentifier, List <AlternativeView> alternativeViews, string extension, string mimeType)
        {
            var unknownSet = new UnknownSet
            {
                FileIdentifier = fileIdentifier
            };

            var allowedOperations = new List <AllowedOperation>
            {
                AllowedOperation.GetAllowedOperationDownload(fileIdentifier, label: "Download")
            };

            unknownSet.AllowedOperations = allowedOperations;

            return(unknownSet);
        }
Exemplo n.º 3
0
 public override void SetInitialAllowedOperations(FileModel fileModel, List <AllowedOperation> allowed, PathIdentifier virtualPathIdentifier)
 {
     if (fileModel.Name.ToLower().EndsWith(".pdf") || fileModel.Name.ToLower().EndsWith(".docx"))
     {
         if (fileModel.Name.ToLower().EndsWith(".docx"))
         {
             var avs = fileModel.Read(MetadataKeyConstants.ALTERNATIVE_VIEWS, defaultValue: new List <AlternativeView>());
             if (avs.Any(a => a.MimeType == "application/pdf"))
             {
                 allowed.Add(AllowedOperation.GetAllowedOperationSendToEArraignment(fileModel.Identifier));
             }
         }
         else
         {
             allowed.Add(AllowedOperation.GetAllowedOperationSendToEArraignment(fileModel.Identifier));
         }
     }
 }
Exemplo n.º 4
0
        protected override List <AllowedOperation> GetPageAllowedOperations(PathIdentifier identifier)
        {
            var ops = new List <AllowedOperation>();

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

            var recipients = state.Folder.MetaEDiscoveryRecipientListRead();

            if (state.Folder.Files.Rows.Any(f => EDiscoveryUtility.GetCurrentShareState(f) == EDiscoveryShareState.Staged))
            {
                ops.Add(AllowedOperation.GetAllowedOperationPublish(identifier as FolderIdentifier, recipients.Count));
            }

            return(ops);
        }
Exemplo n.º 5
0
        public override void OverrideAllowedOperations(FileModel fileModel, List <AllowedOperation> allowed, PathIdentifier virtualPathIdentifier)
        {
            var isUserLeo = LEOUploadUtility.IsUserLeo(connection.UserAccessIdentifiers);

            var leoUploadFolder = new PathIdentifier(fileModel.Identifier as FolderIdentifier, LEOUploadUtility.LEO_UPLOAD_PATH_KEY);

            if (virtualPathIdentifier.Equals(leoUploadFolder) || virtualPathIdentifier.IsChildOf(leoUploadFolder))
            {
                allowed.Clear();

                allowed.Add(AllowedOperation.GetAllowedOperationDownload(fileModel.Identifier, false));
                allowed.Add(AllowedOperation.GetAllowedOperationMove(fileModel.Identifier));

                if (isUserLeo)
                {
                    allowed.Add(AllowedOperation.GetAllowedOperationRename(fileModel.Identifier));
                }
            }
        }
Exemplo n.º 6
0
        private AllowedOperation[] GetOperations(
            FileModel fileModel,
            PathIdentifier pathIdentifier,
            List <IModule> activeModules,
            PathIdentifier virtualPathIdentifier = null
            )
        {
            var allowed = new List <AllowedOperation>
            {
                AllowedOperation.GetAllowedOperationDownload(fileModel.Identifier, false),
                AllowedOperation.GetAllowedOperationDownloadZip(fileModel.Identifier),
                AllowedOperation.GetAllowedOperationMove(fileModel.Identifier),
                AllowedOperation.GetAllowedOperationRename(fileModel.Identifier),
            };

            if (fileModel.PrivilegeCheck("delete", connection, throwOnFail: false))
            {
                allowed.Add(AllowedOperation.GetAllowedOperationDelete(fileModel.Identifier));
            }

            if (fileModel.Extension == "zip")
            {
                allowed.Add(AllowedOperation.GetAllowedOperationExtractZip(fileModel.Identifier));
            }

            // here we're going to process our modules in 2 phases.
            // some modules like eDiscovery are going to clean out all the allowed operations.  So they must run last.
            if (activeModules != null)
            {
                foreach (var module in activeModules)
                {
                    module.SetInitialAllowedOperations(fileModel, allowed, virtualPathIdentifier);
                }

                foreach (var module in activeModules)
                {
                    module.OverrideAllowedOperations(fileModel, allowed, virtualPathIdentifier);
                }
            }

            return(allowed.ToArray());
        }
Exemplo n.º 7
0
        public static ImageSet ImageSetGet(FileIdentifier fileIdentifier, List <AlternativeView> alternativeViews, string extension, string mimeType)
        {
            var imageSet = new ImageSet
            {
                ImageType = ImageSet.ImageTypeEnum.Unknown
            };

            if (IsImageExtension(extension) || IsImageMimeType(mimeType))
            {
                imageSet.FileIdentifier = fileIdentifier;
            }

            if (imageSet.FileIdentifier != null)
            {
                imageSet.ImageType = ImageSet.ImageTypeEnum.Image;
            }

            var exif = alternativeViews?.FirstOrDefault(v => v.Name == "EXIF")?.FileIdentifier;

            imageSet.PreviewImageIdentifier = alternativeViews
                                              ?.FirstOrDefault(v =>
                                                               v.SizeType == "Thumbnail" ||
                                                               (v.SizeType == null &&
                                                                v.ImageFormat == ImageFormatEnum.PNG &&
                                                                v.Height == 100) // there was a period where SizeType was missing
                                                               )
                                              ?.FileIdentifier;

            var allowedOperations = new List <AllowedOperation>
            {
                AllowedOperation.GetAllowedOperationDownload(fileIdentifier, label: "Download")
            };

            if (exif != null)
            {
                allowedOperations.Add(AllowedOperation.GetAllowedOperationDownload(exif, label: "Download EXIF"));
            }

            imageSet.AllowedOperations = allowedOperations;

            return(imageSet);
        }
Exemplo n.º 8
0
        protected override List <AllowedOperation> GetPageAllowedOperations(PathIdentifier identifier)
        {
            if (IsLEOUser && identifier != null && identifier.IsChildOf(OfficerPathIdentifier))
            {
                var ops = new List <AllowedOperation>
                {
                    AllowedOperation.GetAllowedOperationMove(identifier),
                    AllowedOperation.GetAllowedOperationNewPath(identifier)
                };

                if (ManagerConfiguration.IsFeatureEnabledUpload &&
                    state.Folder.PrivilegeCheck("file:create", connection, throwOnFail: false))
                {
                    ops.Add(AllowedOperation.GetAllowedOperationUpload(identifier));
                }

                return(ops);
            }

            return(null);
        }
Exemplo n.º 9
0
        public virtual List <AllowedOperation> GetSubPathOperations(List <IModule> activeModules, PathIdentifier pathIdentifier)
        {
            var subPathDefaultOperations = new List <AllowedOperation>()
            {
                AllowedOperation.GetAllowedOperationMove(pathIdentifier, pathIdentifier),
                AllowedOperation.GetAllowedOperationRename(pathIdentifier),
                AllowedOperation.GetAllowedOperationDownloadZip(pathIdentifier)
            };

            if (state.Folder.PrivilegeCheck("delete", connection, throwOnFail: false))
            {
                subPathDefaultOperations.Add(AllowedOperation.GetAllowedOperationDelete(pathIdentifier));
            }


            foreach (var module in activeModules)
            {
                module.AlterSubPathOperations(pathIdentifier, subPathDefaultOperations);
            }
            return(subPathDefaultOperations);
        }
Exemplo n.º 10
0
        protected virtual List <AllowedOperation> GetPageAllowedOperations(PathIdentifier identifier)
        {
            var ops = new List <AllowedOperation>
            {
                AllowedOperation.GetAllowedOperationMove(identifier),
                AllowedOperation.GetAllowedOperationNewPath(identifier)
            };

            if (ManagerConfiguration.IsFeatureEnabledUpload &&
                state.Folder.PrivilegeCheck("file:create", connection, throwOnFail: false))
            {
                ops.Add(AllowedOperation.GetAllowedOperationUpload(identifier));
            }

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

            return(ops);
        }
Exemplo n.º 11
0
        public override void OverrideAllowedOperations(FileModel fileModel, List <AllowedOperation> allowed, PathIdentifier virtualPathIdentifier)
        {
            if (EDiscoveryUtility.IsEDiscoveryPath(virtualPathIdentifier))
            {
                allowed.Clear();
                allowed.Add(
                    AllowedOperation.GetAllowedOperationDownload(fileModel.Identifier, false)
                    );
                allowed.Add(
                    AllowedOperation.GetAllowedOperationDownloadZip(fileModel.Identifier)
                    );
            }

            // The allowed operations depend on what state the file is in.
            switch (EDiscoveryUtility.GetCurrentShareState(fileModel))
            {
            case EDiscoveryShareState.NotShared:
                // If the file hasn't been shared yet, we can "Share" it.
                allowed.Add(AllowedOperation.GetAllowedOperationShare(fileModel.Identifier, true));
                break;

            case EDiscoveryShareState.Staged:
                // If the file has only been staged, the we can "unshare" it.
                allowed.Add(AllowedOperation.GetAllowedOperationShare(fileModel.Identifier, false));
                break;

            case EDiscoveryShareState.Published:
                // If it's been published there isn't anything related to sharing that you can do on the file.
                // However if it's published we're not going to allow you to delete the file.
                allowed.RemoveAll(action => action.BatchOperation is DeleteRequest);
                allowed.RemoveAll(action => action.BatchOperation is RenameRequest);
                break;

            default:
                break;
            }
        }
Exemplo n.º 12
0
        public async override Task <ClipSet> QueryOneAsync(FileIdentifier identifier, CancellationToken cancellationToken = default(CancellationToken))
        {
            var rootFile = await Connection.File.GetAsync(identifier);

            var clipSetJson =
                rootFile.Read <List <AlternativeView> >(MetadataKeyConstants.ALTERNATIVE_VIEWS)
                ?.FirstOrDefault(v => v.Name == FILENAME);

            var set = await ViewSetService.LoadSet <ClipSet>(identifier);

            if (clipSetJson != null)
            {
                set.Segments = await Connection.File.DownloadAsAsync <List <ClipSegmentModel> >(clipSetJson.FileIdentifier);
            }

            var ops = set.AllowedOperations.ToList();

            ops.Add(AllowedOperation.GetAllowedOperationExportFrame(identifier));
            ops.Add(AllowedOperation.GetAllowedOperationExportClip(identifier));

            set.AllowedOperations = ops;

            return(set);
        }
Exemplo n.º 13
0
        protected async override Task BuildViews(List <IModule> activeModules, int pageIndex, int pageSize, FolderModel folder, PathIdentifier identifier, string userTimeZone)
        {
            this.page.Views = new List <Models.Responses.IViewModel>();

            // This will show the instructions on how to work with EDiscovery
            var instructions = new DataViewModel
            {
                DataModel  = null,
                DataSchema = new ManagerFieldObject()
                {
                    IsCollapsed = false,
                    Properties  = new Dictionary <string, ManagerFieldBaseSchema>()
                    {
                        { "Instructions", new ManagerFieldNull()
                          {
                              Description = @"<p>
                                                    Law Enforcement Officers can add files and folders directly to your case.
                                                </p><p>
                                                    Below are officers that you have authorized to contribute to this case. 
                                                    To add someone new, click ""Add Officer"", fill out the form, and email
                                                    the provided access information.  Click the action button next to an officer
                                                    to regenerate their access link/password or to remove them from the case. 
                                                </p><p>
                                                    Uploads will be added to a folder with the officer's name.  
                                                    Files can be moved from an officer folder into other folders within the case.
                                                    Once moved, the officer will no longer be able to see the files they added.
                                                </p>",
                              IsReadOnly  = true,
                              Order       = 0,
                              Title       = "LEO Upload Instructions"
                          } },
                    }
                },
                AllowedOperations = null
            };

            this.page.Views.Add(instructions);

            this.page.Views.Add(RecipientViewBuilder.BuildPagedGridView(
                                    pageIndex,
                                    pageSize,
                                    folder.MetaLEOUploadOfficerListRead(),
                                    folder.Identifier,
                                    userTimeZone,
                                    GridViewModel.GRID_TITLES_LEO_UPLOAD_OFFICERS,
                                    new List <AllowedOperation>()
            {
                AllowedOperation.GetAllowedOperationAddOfficer(folder.Identifier)
            },
                                    GetAllowedOperationsForRecipient
                                    ));

            // We need to take a list of manager path models, and convert them to a list of item query response object
            //TODO Add in our child officer folders.
            //var managerPathModels = this.LEOUploadModule.BuildDatedPackagesDynamicFolder(folder);
            //managerPathModels.Add(this.LEOUploadModule.GetNotSharedYetPath(folder));

            // Now we need to convert these manager path models into something that's a list of
            var dynamicPaths = new List <IItemQueryResponse>();

            //TODO Add in our child officer folders.
            //dynamicPaths.AddRange(managerPathModels);

            //this.page.Views.Add(
            //    GridViewBuilder.BuildGridView(
            //        pageIndex,
            //        pageSize,
            //        dynamicPaths,
            //        new List<GridColumnSpecification>() { GridColumnSpecification.GetNameColumn(), GridColumnSpecification.GetCustomNameColumn(), GridColumnSpecification.GetActionsColumn() },
            //        GridViewModel.GRID_TITLES_EDISOVERY_PACKAGES)
            //    );

            // Now we build up the list of audit log entries.
            var auditLogEntries = this.auditLogStore.TranslateEntriesForDisplay(
                await this.auditLogStore.GetEntries(folder.Identifier, ModuleType.LEOUpload), userTimeZone
                );

            this.page.Views.Add(AuditLogViewBuilder.BuildPagedGridView(pageIndex, pageSize, auditLogEntries, folder.Identifier, i => (i as AuditLogEntry)?.Created));
        }
Exemplo n.º 14
0
        public static DataViewModel BuildDataViewModel(FolderModel folder)
        {
            // First we grab the schema.
            var schema    = GetFieldSchema(folder);
            var dataModel = new Dictionary <string, object>();

            // Now we have the schema we also need to build up the data model as well.
            if (schema != null && schema is ManagerFieldObject)
            {
                var managerFieldObject = schema as ManagerFieldObject;

                foreach (var property in managerFieldObject.Properties)
                {
                    if (property.Value is ManagerFieldString)
                    {
                        dataModel.Add(
                            property.Value.AttributeStorageLocationKey,
                            // Read out of metadata, the property.value, which will be a base schema object.  That object will have a AttributeStorageLocationKey
                            // this will be where the actual value of this data is stored.
                            folder.Read <string>(property.Value.AttributeStorageLocationKey)
                            );
                    }
                    if (property.Value is ManagerFieldInt)
                    {
                        dataModel.Add(
                            property.Value.AttributeStorageLocationKey,
                            folder.Read <int>(property.Value.AttributeStorageLocationKey)
                            );
                    }
                    if (property.Value is ManagerFieldBoolean)
                    {
                        dataModel.Add(
                            property.Value.AttributeStorageLocationKey,
                            folder.Read <bool>(property.Value.AttributeStorageLocationKey)
                            );
                    }
                    if (property.Value is ManagerFieldObject)
                    {
                        dataModel.Add(
                            property.Value.AttributeStorageLocationKey,
                            folder.Read <object>(property.Value.AttributeStorageLocationKey)
                            );
                    }
                    if (property.Value is ManagerFieldDecimal)
                    {
                        dataModel.Add(
                            property.Value.AttributeStorageLocationKey,
                            folder.Read <decimal>(property.Value.AttributeStorageLocationKey)
                            );
                    }
                }

                return(new DataViewModel
                {
                    DataModel = dataModel,
                    DataSchema = schema,
                    AllowedOperations = new List <AllowedOperation>()
                    {
                        AllowedOperation.GetAllowedOperationSave(folder.Identifier),
                    }
                });
            }
            else
            {
                return(null);
            }
        }
Exemplo n.º 15
0
        public static MediaSet MediaSetGet(OrganizationModel organization, FileIdentifier fileIdentifier, List <AlternativeView> alternativeViews, string extension, string mimeType, bool isPrivileged = false)
        {
            bool noTranscodes = false;

            var mediaSet = new MediaSet
            {
                AutoPlay = false,
                Preload  = true,
                Poster   = alternativeViews?.FirstOrDefault(v => v.MimeType == MIME_PNG)?.FileIdentifier
            };

            // query for video formats by mime-type
            var mp4  = alternativeViews?.FirstOrDefault(v => v.MimeType == MIME_MP4)?.FileIdentifier;
            var webm = alternativeViews?.FirstOrDefault(v => v.MimeType == MIME_WEBM)?.FileIdentifier;
            var mp3  = alternativeViews?.FirstOrDefault(v => v.MimeType == MIME_MP3)?.FileIdentifier;
            var exif = alternativeViews?.FirstOrDefault(v => v.Name == "EXIF")?.FileIdentifier;

            // check to see if the original was either of the targets
            if (mp4 == null && mimeType == MIME_MP4)
            {
                mp4 = fileIdentifier;
            }
            if (webm == null && mimeType == MIME_WEBM)
            {
                webm = fileIdentifier;
            }
            if (mp3 == null && mimeType == MIME_MP3)
            {
                mp3 = fileIdentifier;
            }

            var sources = new List <MediaSource>();

            mediaSet.Sources = sources;

            if (mp4 != null)
            {
                sources.Add(new MediaSource(mp4, MIME_MP4));
            }

            if (webm != null)
            {
                sources.Add(new MediaSource(webm, MIME_WEBM));
            }

            if (mp3 != null)
            {
                sources.Add(new MediaSource(mp3, MIME_MP3));
            }

            // if we don't have any of our target formats, try adding the original file
            if (!sources.Any())
            {
                sources.Add(new MediaSource(fileIdentifier, mimeType));
                noTranscodes = true;
            }

            var vtt = alternativeViews?.FirstOrDefault(v => v.MimeType == MIME_VTT && v.Name == TranscriptService.FILENAME_VTT)?.FileIdentifier;

            if (vtt == null)
            {
                vtt = alternativeViews?.FirstOrDefault(v => v.MimeType == MIME_VTT)?.FileIdentifier;
            }
            if (vtt != null)
            {
                mediaSet.Subtitles = new List <MediaSubtitles>
                {
                    new MediaSubtitles {
                        FileIdentifier = vtt,
                        IsDefault      = true,
                        Label          = "English",
                        Language       = "English"
                    }
                };
            }

            // let's see how we did
            mediaSet.MediaType = MediaSet.MediaTypeEnum.Unknown;

            if (mp3 != null)
            {
                mediaSet.MediaType = MediaSet.MediaTypeEnum.Audio;
            }

            if (mp4 != null || webm != null)
            {
                mediaSet.MediaType = MediaSet.MediaTypeEnum.Video;
            }

            // we couldn't find any alternative views, indicating a transcoder
            // has visited this file. let's check the primary file itself
            if (noTranscodes && false)
            {
                if (mimeType?.ToLower().StartsWith("video") ?? false)
                {
                    mediaSet.MediaType = MediaSet.MediaTypeEnum.Video;
                }
                else if (mimeType?.ToLower().StartsWith("audio") ?? false)
                {
                    mediaSet.MediaType = MediaSet.MediaTypeEnum.Audio;
                }
            }

            var allowedOperations = new List <AllowedOperation>
            {
                AllowedOperation.GetAllowedOperationDownload(fileIdentifier, label: "Download")
            };

            if (mp4 != null)
            {
                allowedOperations.Add(AllowedOperation.GetAllowedOperationDownload(mp4, label: "Download MP4"));
            }

            if (exif != null)
            {
                allowedOperations.Add(AllowedOperation.GetAllowedOperationDownload(exif, label: "Download EXIF"));
            }

            if (mediaSet.MediaType == MediaSet.MediaTypeEnum.Audio &&
                mp3 != null)
            {
                allowedOperations.Add(AllowedOperation.GetAllowedOperationDownload(mp3, label: "Download MP3"));
            }

            if (vtt != null)
            {
                allowedOperations.Add(AllowedOperation.GetAllowedOperationDownload(vtt, label: "Download Subtitles"));
            }
            else
            {
                if (isPrivileged)
                {
                    if (mp3 != null && organization.Read("transcript[isActive]", defaultValue: false))
                    {
                        allowedOperations.Add(AllowedOperation.GetAllowedOperationTranscribe(fileIdentifier));
                    }
                }
            }

            if (isPrivileged)
            {
                if (mp4 != null)
                {
                    allowedOperations.Add(AllowedOperation.GetAllowedOperationWatermarkVideo(mp4));
                }
            }


            mediaSet.AllowedOperations = allowedOperations;

            return(mediaSet);
        }
Exemplo n.º 16
0
        protected async override Task BuildViews(List <IModule> activeModules, int pageIndex, int pageSize, FolderModel folder, PathIdentifier identifier, string userTimeZone)
        {
            this.page.Views = new List <Models.Responses.IViewModel>();

            // This will show the instructions on how to work with EDiscovery
            var instructions = new DataViewModel
            {
                DataModel  = null,
                DataSchema = new ManagerFieldObject()
                {
                    IsCollapsed = false,
                    Properties  = new Dictionary <string, ManagerFieldBaseSchema>()
                    {
                        { "Instructions", new ManagerFieldNull()
                          {
                              Description = @"<p>
                                                  Files/folders that you have marked for sharing will appear in the ""Not Yet Shared"" folder and will remain there until you click <b>""Turn Over.""</b>
                                                </p>
                                                <p>
                                                  Clicking <b>""Turn Over""</b> will move the files from ""Not Yet Shared"" into a Discovery Package of files.
                                                </p>
                                                <p>
                                                  Once turned over, files cannot be edited or deleted.  Files turned over will still be in their original file folders, but the color will change to green.
                                                </p>
                                                <p>
                                                  Below are other users that you have authorized to view Discovery Packages.  To add someone new, click ""Add Recipient"" and fill out the form.  Click the action button next to a user to regenerate their access link/password or to remove them from the case.
                                                </p>",
                              IsReadOnly  = true,
                              Order       = 0,
                              Title       = "eDiscovery Instructions"
                          } },
                    }
                },
                AllowedOperations = null
            };

            this.page.Views.Add(instructions);

            this.page.Views.Add(RecipientViewBuilder.BuildPagedGridView(
                                    pageIndex,
                                    pageSize,
                                    folder.MetaEDiscoveryRecipientListRead(),
                                    folder.Identifier,
                                    userTimeZone,
                                    GridViewModel.GRID_TITLES_EDISOVERY_RECIPIENTS,
                                    new List <AllowedOperation>()
            {
                AllowedOperation.GetAllowedOperationAddRecipient(folder.Identifier, folder)
            },
                                    GetAllowedOperationsForRecipient
                                    ));

            // We need to take a list of manager path models, and convert them to a list of item query response object
            var managerPathModels = this.eDiscovery.BuildDatedPackagesDynamicFolder(folder);

            managerPathModels.Add(this.eDiscovery.GetNotSharedYetPath(folder));

            // Now we need to convert these manager path models into something that's a list of
            var dynamicPaths = new List <IItemQueryResponse>();

            dynamicPaths.AddRange(managerPathModels);

            this.page.Views.Add(
                GridViewBuilder.BuildGridView(
                    pageIndex,
                    pageSize,
                    dynamicPaths,
                    new List <GridColumnSpecification>()
            {
                GridColumnSpecification.GetNameColumn(), GridColumnSpecification.GetCustomNameColumn(), GridColumnSpecification.GetActionsColumn()
            },
                    GridViewModel.GRID_TITLES_EDISOVERY_PACKAGES)
                );

            // Now we build up the list of audit log entries.
            var auditLogEntries = this.auditLogStore.TranslateEntriesForDisplay(
                await this.auditLogStore.GetEntries(folder.Identifier, ModuleType.eDiscovery), userTimeZone
                );

            this.page.Views.Add(AuditLogViewBuilder.BuildPagedGridView(pageIndex, pageSize, auditLogEntries, folder.Identifier));
        }
Exemplo n.º 17
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);
        }
Exemplo n.º 18
0
        public async Task <T> LoadSet <T>(FileIdentifier fileIdentifier)
            where T : BaseSet
        {
            var file = await api.File.GetAsync(fileIdentifier);

            var fileStatus = await api.File.GetOnlineStatusAsync(fileIdentifier);


            var organization = await api.Organization.GetAsync(fileIdentifier as OrganizationIdentifier);

            BaseSet set = null;

            // this is awful, but no clear security check to perform
            bool isPrivileged = !EDiscoveryUtility.IsUserEDiscovery(this.api.UserAccessIdentifiers) &&
                                !LEOUploadUtility.IsUserLeo(this.api.UserAccessIdentifiers);

            if (typeof(T).Equals(typeof(TextSet)))
            {
                set = TextService.TextSetGet(file, true);
            }

            if (typeof(T).Equals(typeof(DocumentSet)))
            {
                set = DocumentSetService.DocumentSetGet(file);
            }

            if (typeof(T).Equals(typeof(MediaSet)))
            {
                set = MediaService.MediaSetGet(organization, file, isPrivileged);
            }

            if (typeof(T).Equals(typeof(TranscriptSet)))
            {
                var transcriptSet = TranscriptService.TranscriptSetGet(organization, file);
                transcriptSet.Segments = await TranscriptService.LoadSegments(api, transcriptSet.Subtitles?.FirstOrDefault()?.FileIdentifier);

                set = transcriptSet;
            }

            if (typeof(T).Equals(typeof(ClipSet)))
            {
                var clipSet = ClipService.ClipSetGet(organization, file);
                set = clipSet;
            }

            if (typeof(T).Equals(typeof(ImageSet)))
            {
                set = ImageService.ImageSetGet(file);
            }

            if (typeof(T).Equals(typeof(UnknownSet)))
            {
                set = UnknownService.UnknownSetGet(file);
            }

            if (set.AllowedOperations == null)
            {
                set.AllowedOperations = new[]
                {
                    AllowedOperation.GetAllowedOperationDownload(fileIdentifier, false)
                }
            }
            ;

            set.RootFileIdentifier = file.Read(MetadataKeyConstants.CHILDOF, defaultValue: file.Identifier);

            if (set.RootFileIdentifier.Equals(fileIdentifier))
            {
                set.Views = DetectFileViews(organization, file);
            }
            else
            {
                set.Views = DetectFileViews(organization, await api.File.GetAsync(set.RootFileIdentifier));
            }


            // some wierd logic for eDiscovery
            // if eDiscovery, then no subtitles
            if (set is MediaSet && EDiscoveryUtility.IsUserEDiscovery(api.UserAccessIdentifiers))
            {
                var media = set as MediaSet;
                media.Subtitles = null;
            }


            if (fileStatus != FileModel.OnlineStatus.Online)
            {
                set.Views = new ManagerFileView[] { new ManagerFileView {
                                                        ViewerType = ManagerFileView.ViewerTypeEnum.Offline,
                                                        Identifier = set.RootFileIdentifier
                                                    } };

                set.AllowedOperations = new AllowedOperation[]
                {
                    AllowedOperation.GetAllowedOperationRequestOnlineFolder(set.RootFileIdentifier)
                };

                set.RootFileIdentifier = null;
            }

            return(set as T);
        }