Ejemplo n.º 1
0
        public List <FileEntryWrapper> GetNewItems(T folderId)
        {
            return(FileStorageService.GetNewItems(folderId)
                   .Select(r =>
            {
                FileEntryWrapper wrapper = null;
                if (r is Folder <int> fol1)
                {
                    wrapper = FolderWrapperHelper.Get(fol1);
                }
                else if (r is Folder <string> fol2)
                {
                    wrapper = FolderWrapperHelper.Get(fol2);
                }
                else if (r is File <int> file1)
                {
                    wrapper = FileWrapperHelper.Get(file1);
                }
                else if (r is File <string> file2)
                {
                    wrapper = FileWrapperHelper.Get(file2);
                }

                return wrapper;
            })
                   .ToList());
        }
Ejemplo n.º 2
0
        public IEnumerable <FileEntryWrapper> MoveOrCopyBatchCheck(BatchModel batchModel)
        {
            var checkedFiles   = new List <object>();
            var checkedFolders = new List <object>();

            if (batchModel.DestFolderId.ValueKind == System.Text.Json.JsonValueKind.Number)
            {
                (checkedFiles, checkedFolders) = FileStorageService.MoveOrCopyFilesCheck(batchModel.FileIds, batchModel.FolderIds, batchModel.DestFolderId);
            }
            else
            {
                (checkedFiles, checkedFolders) = FileStorageService.MoveOrCopyFilesCheck(batchModel.FileIds, batchModel.FolderIds, batchModel.DestFolderId);
            }

            var entries = FileStorageService.GetItems(checkedFiles.OfType <int>().Select(Convert.ToInt32), checkedFiles.OfType <int>().Select(Convert.ToInt32), FilterType.FilesOnly, false, "", "");

            entries.AddRange(FileStorageService.GetItems(checkedFiles.OfType <string>(), checkedFiles.OfType <string>(), FilterType.FilesOnly, false, "", ""));

            return(entries.Select(r =>
            {
                FileEntryWrapper wrapper = null;
                if (r is Folder <int> fol1)
                {
                    wrapper = FolderWrapperHelper.Get(fol1);
                }
                if (r is Folder <string> fol2)
                {
                    wrapper = FolderWrapperHelper.Get(fol2);
                }

                return wrapper;
            }));
        }
Ejemplo n.º 3
0
 /// <summary>
 /// </summary>
 /// <param name="context"></param>
 /// <param name="fileStorageService"></param>
 public FilesControllerHelper(
     ApiContext context,
     FileStorageService <T> fileStorageService,
     FileWrapperHelper fileWrapperHelper,
     FilesSettingsHelper filesSettingsHelper,
     FilesLinkUtility filesLinkUtility,
     FileUploader fileUploader,
     DocumentServiceHelper documentServiceHelper,
     TenantManager tenantManager,
     SecurityContext securityContext,
     FolderWrapperHelper folderWrapperHelper,
     FileOperationWraperHelper fileOperationWraperHelper,
     FileShareWrapperHelper fileShareWrapperHelper,
     FileShareParamsHelper fileShareParamsHelper,
     EntryManager entryManager,
     FolderContentWrapperHelper folderContentWrapperHelper,
     ChunkedUploadSessionHelper chunkedUploadSessionHelper,
     DocumentServiceTrackerHelper documentServiceTracker,
     IOptionsMonitor <ILog> optionMonitor,
     SettingsManager settingsManager,
     EncryptionKeyPairHelper encryptionKeyPairHelper,
     IHttpContextAccessor httpContextAccessor,
     FileConverter fileConverter,
     ApiDateTimeHelper apiDateTimeHelper,
     UserManager userManager,
     DisplayUserSettingsHelper displayUserSettingsHelper)
 {
     ApiContext                 = context;
     FileStorageService         = fileStorageService;
     FileWrapperHelper          = fileWrapperHelper;
     FilesSettingsHelper        = filesSettingsHelper;
     FilesLinkUtility           = filesLinkUtility;
     FileUploader               = fileUploader;
     DocumentServiceHelper      = documentServiceHelper;
     TenantManager              = tenantManager;
     SecurityContext            = securityContext;
     FolderWrapperHelper        = folderWrapperHelper;
     FileOperationWraperHelper  = fileOperationWraperHelper;
     FileShareWrapperHelper     = fileShareWrapperHelper;
     FileShareParamsHelper      = fileShareParamsHelper;
     EntryManager               = entryManager;
     FolderContentWrapperHelper = folderContentWrapperHelper;
     ChunkedUploadSessionHelper = chunkedUploadSessionHelper;
     DocumentServiceTracker     = documentServiceTracker;
     SettingsManager            = settingsManager;
     EncryptionKeyPairHelper    = encryptionKeyPairHelper;
     ApiDateTimeHelper          = apiDateTimeHelper;
     UserManager                = userManager;
     DisplayUserSettingsHelper  = displayUserSettingsHelper;
     HttpContextAccessor        = httpContextAccessor;
     FileConverter              = fileConverter;
     Logger = optionMonitor.Get("ASC.Files");
 }
Ejemplo n.º 4
0
        internal FileEntryWrapper GetFileEntryWrapper(FileEntry r)
        {
            FileEntryWrapper wrapper = null;

            if (r is Folder <int> fol1)
            {
                wrapper = FolderWrapperHelper.Get(fol1);
            }
            else if (r is Folder <string> fol2)
            {
                wrapper = FolderWrapperHelper.Get(fol2);
            }
            else if (r is File <int> file1)
            {
                wrapper = FileWrapperHelper.Get(file1);
            }
            else if (r is File <string> file2)
            {
                wrapper = FileWrapperHelper.Get(file2);
            }

            return(wrapper);
        }
Ejemplo n.º 5
0
        public FolderWrapper <T> SaveThirdParty(
            string url,
            string login,
            string password,
            string token,
            bool isCorporate,
            string customerTitle,
            string providerKey,
            string providerId)
        {
            var thirdPartyParams = new ThirdPartyParams
            {
                AuthData      = new AuthData(url, login, password, token),
                Corporate     = isCorporate,
                CustomerTitle = customerTitle,
                ProviderId    = providerId,
                ProviderKey   = providerKey,
            };

            var folder = FileStorageService.SaveThirdParty(thirdPartyParams);

            return(FolderWrapperHelper.Get(folder));
        }
Ejemplo n.º 6
0
        public IEnumerable <FileEntryWrapper> MoveOrCopyBatchCheck(BatchModel batchModel)
        {
            FileStorageService.MoveOrCopyFilesCheck(batchModel.FileIds, batchModel.FolderIds, batchModel.DestFolderId, out var checkedFiles, out var checkedFolders);

            var entries = FileStorageService.GetItems(checkedFiles.OfType <long>().Select(Convert.ToInt32), checkedFiles.OfType <long>().Select(Convert.ToInt32), FilterType.FilesOnly, false, "", "");

            entries.AddRange(FileStorageService.GetItems(checkedFiles.OfType <string>(), checkedFiles.OfType <string>(), FilterType.FilesOnly, false, "", ""));

            return(entries.Select(r =>
            {
                FileEntryWrapper wrapper = null;
                if (r is Folder <int> fol1)
                {
                    wrapper = FolderWrapperHelper.Get(fol1);
                }
                if (r is Folder <string> fol2)
                {
                    wrapper = FolderWrapperHelper.Get(fol2);
                }

                return wrapper;
            }));
        }
Ejemplo n.º 7
0
        public FolderWrapper <T> GetFolderInfo(T folderId)
        {
            var folder = FileStorageService.GetFolder(folderId).NotFoundIfNull("Folder not found");

            return(FolderWrapperHelper.Get(folder));
        }
Ejemplo n.º 8
0
        public FolderWrapper <T> RenameFolder(T folderId, string title)
        {
            var folder = FileStorageService.FolderRename(folderId, title);

            return(FolderWrapperHelper.Get(folder));
        }
Ejemplo n.º 9
0
        public FolderWrapper <T> CreateFolder(T folderId, string title)
        {
            var folder = FileStorageService.CreateNewFolder(folderId, title);

            return(FolderWrapperHelper.Get(folder));
        }
Ejemplo n.º 10
0
 /// <summary>
 /// </summary>
 /// <param name="context"></param>
 /// <param name="fileStorageService"></param>
 public FilesControllerHelper(
     ApiContext context,
     FileStorageService <T> fileStorageService,
     FileWrapperHelper fileWrapperHelper,
     FilesSettingsHelper filesSettingsHelper,
     FilesLinkUtility filesLinkUtility,
     FileUploader fileUploader,
     DocumentServiceHelper documentServiceHelper,
     TenantManager tenantManager,
     SecurityContext securityContext,
     FolderWrapperHelper folderWrapperHelper,
     FileOperationWraperHelper fileOperationWraperHelper,
     FileShareWrapperHelper fileShareWrapperHelper,
     FileShareParamsHelper fileShareParamsHelper,
     EntryManager entryManager,
     UserManager userManager,
     WebItemSecurity webItemSecurity,
     CoreBaseSettings coreBaseSettings,
     ThirdpartyConfiguration thirdpartyConfiguration,
     MessageService messageService,
     CommonLinkUtility commonLinkUtility,
     DocumentServiceConnector documentServiceConnector,
     FolderContentWrapperHelper folderContentWrapperHelper,
     WordpressToken wordpressToken,
     WordpressHelper wordpressHelper,
     ConsumerFactory consumerFactory,
     EasyBibHelper easyBibHelper,
     ChunkedUploadSessionHelper chunkedUploadSessionHelper,
     IOptionsMonitor <ILog> optionMonitor)
 {
     ApiContext                 = context;
     FileStorageService         = fileStorageService;
     FileWrapperHelper          = fileWrapperHelper;
     FilesSettingsHelper        = filesSettingsHelper;
     FilesLinkUtility           = filesLinkUtility;
     FileUploader               = fileUploader;
     DocumentServiceHelper      = documentServiceHelper;
     TenantManager              = tenantManager;
     SecurityContext            = securityContext;
     FolderWrapperHelper        = folderWrapperHelper;
     FileOperationWraperHelper  = fileOperationWraperHelper;
     FileShareWrapperHelper     = fileShareWrapperHelper;
     FileShareParamsHelper      = fileShareParamsHelper;
     EntryManager               = entryManager;
     UserManager                = userManager;
     WebItemSecurity            = webItemSecurity;
     CoreBaseSettings           = coreBaseSettings;
     ThirdpartyConfiguration    = thirdpartyConfiguration;
     ConsumerFactory            = consumerFactory;
     BoxLoginProvider           = ConsumerFactory.Get <BoxLoginProvider>();
     DropboxLoginProvider       = ConsumerFactory.Get <DropboxLoginProvider>();
     GoogleLoginProvider        = ConsumerFactory.Get <GoogleLoginProvider>();
     OneDriveLoginProvider      = ConsumerFactory.Get <OneDriveLoginProvider>();
     MessageService             = messageService;
     CommonLinkUtility          = commonLinkUtility;
     DocumentServiceConnector   = documentServiceConnector;
     FolderContentWrapperHelper = folderContentWrapperHelper;
     WordpressToken             = wordpressToken;
     WordpressHelper            = wordpressHelper;
     EasyBibHelper              = easyBibHelper;
     ChunkedUploadSessionHelper = chunkedUploadSessionHelper;
     Logger = optionMonitor.Get("ASC.Files");
 }