コード例 #1
0
        private async Task <ModelBase> RemoveOfficerAsync(RemoveOfficerRequest removeRequest)
        {
            FolderModel folder = null;

            await connection.ConcurrencyRetryBlock(async() =>
            {
                folder         = await connection.Folder.GetAsync(removeRequest.FolderIdentifier);
                var recipients = folder.MetaLEOUploadOfficerListRead();

                var recipient = recipients.FirstOrDefault(f => f.Email == removeRequest.RecipientEmail);

                folder.MetaLEOUploadOfficerListRemove(removeRequest.RecipientEmail);

                var paths = folder.Read <List <string> >("_paths");
                if (paths != null && recipient != null)
                {
                    var officerPath = GetOfficerPath(folder.Identifier, recipient.FirstName, recipient.LastName);
                    if (paths.Contains(officerPath.PathKey))
                    {
                        paths = paths.Where(p => !p.StartsWith(officerPath.PathKey)).ToList();
                    }

                    folder.Write("_paths", paths);
                }

                await connection.Folder.PutAsync(folder);
            });

            await InitializePrivilegedConnectionAsync();

            // Using the special connection here to delete the user.
            await privilegedConnection.User.DeleteAsync(ModuleUtility.GetFolderScopedUserIdentifier(folder.Identifier, removeRequest.RecipientEmail, "leo"));

            await this.auditLogStore.AddEntry(
                new AuditLogEntry()
            {
                EntryType  = AuditLogEntryType.LEOUploadOfficerDeleted,
                Message    = $"An officer has been removed {removeRequest.RecipientEmail}",
                ModuleType = Modules.ModuleType.LEOUpload
            },
                folder.Identifier
                );

            return(new RecipientResponse()
            {
                Email = removeRequest.RecipientEmail,
            });
        }
コード例 #2
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));
        }