public GlobalFolder( CoreBaseSettings coreBaseSettings, WebItemManager webItemManager, WebItemSecurity webItemSecurity, AuthContext authContext, TenantManager tenantManager, UserManager userManager, SettingsManager settingsManager, GlobalStore globalStore, IOptionsMonitor <ILog> options, IServiceProvider serviceProvider, Global global ) { CoreBaseSettings = coreBaseSettings; WebItemManager = webItemManager; WebItemSecurity = webItemSecurity; AuthContext = authContext; TenantManager = tenantManager; UserManager = userManager; SettingsManager = settingsManager; GlobalStore = globalStore; ServiceProvider = serviceProvider; Global = global; Logger = options.Get("ASC.Files"); }
public string GetTempUrl(Stream stream, string ext) { if (stream == null) { throw new ArgumentNullException("stream"); } var store = GlobalStore.GetStore(); var fileName = string.Format("{0}{1}", Guid.NewGuid(), ext); var path = Path.Combine("temp_stream", fileName); store.Save( FileConstant.StorageDomainTmp, path, stream, MimeMapping.GetMimeMapping(ext), "attachment; filename=\"" + fileName + "\""); var uriBuilder = new UriBuilder(CommonLinkUtility.GetFullAbsolutePath(FilesLinkUtility.FileHandlerPath)); var query = uriBuilder.Query; query += $"{FilesLinkUtility.Action}=tmp&"; query += $"{FilesLinkUtility.FileTitle}={HttpUtility.UrlEncode(fileName)}&"; query += $"{FilesLinkUtility.AuthKey}={EmailValidationKeyProvider.GetEmailKey(fileName)}"; return($"{uriBuilder.Uri}?{query}"); }
public PathProvider( WebImageSupplier webImageSupplier, IDaoFactory daoFactory, CommonLinkUtility commonLinkUtility, FilesLinkUtility filesLinkUtility, EmailValidationKeyProvider emailValidationKeyProvider, GlobalStore globalStore, BaseCommonLinkUtility baseCommonLinkUtility) { WebImageSupplier = webImageSupplier; DaoFactory = daoFactory; CommonLinkUtility = commonLinkUtility; FilesLinkUtility = filesLinkUtility; EmailValidationKeyProvider = emailValidationKeyProvider; GlobalStore = globalStore; BaseCommonLinkUtility = baseCommonLinkUtility; GetFileServicePath = BaseCommonLinkUtility.ToAbsolute("~/Products/Files/Services/WCFService/service.svc/"); }
private object GetFolderIdAndProccessFirstVisit(FileMarker fileMarker, IDaoFactory daoFactory, bool my) { var folderDao = daoFactory.FolderDao; var fileDao = daoFactory.FileDao; var id = my ? folderDao.GetFolderIDUser(false) : folderDao.GetFolderIDCommon(false); if (Equals(id, 0)) //TODO: think about 'null' { id = my ? folderDao.GetFolderIDUser(true) : folderDao.GetFolderIDCommon(true); //Copy start document if (AdditionalWhiteLabelSettings.Instance(SettingsManager).StartDocsEnabled) { try { var storeTemplate = GlobalStore.GetStoreTemplate(); var culture = my ? UserManager.GetUsers(AuthContext.CurrentAccount.ID).GetCulture() : TenantManager.GetCurrentTenant().GetCulture(); var path = FileConstant.StartDocPath + culture + "/"; if (!storeTemplate.IsDirectory(path)) { path = FileConstant.StartDocPath + "default/"; } path += my ? "my/" : "corporate/"; SaveStartDocument(fileMarker, folderDao, fileDao, id, path, storeTemplate); } catch (Exception ex) { Logger.Error(ex); } } } return(id); }