public static bool StartTrack(string fileId, string docKeyForTrack, bool isNew) { var callbackUrl = CommonLinkUtility.GetFullAbsolutePath(FilesLinkUtility.FileHandlerPath + "?" + FilesLinkUtility.Action + "=track" + "&vkey=" + HttpUtility.UrlEncode(Signature.Create(fileId, StudioKeySettings.GetSKey())) + "&new=" + isNew.ToString().ToLower()); return(DocumentServiceConnector.Command(CommandMethod.Info, docKeyForTrack, fileId, callbackUrl)); }
public static bool RenameFile(File file) { var docKeyForTrack = GetDocKey(file); var meta = new Web.Core.Files.DocumentService.MetaData { Title = file.Title }; return(DocumentServiceConnector.Command(Web.Core.Files.DocumentService.CommandMethod.Meta, docKeyForTrack, file.ID, meta: meta)); }
public static bool StartTrack(string fileId, string docKeyForTrack) { var callbackUrl = CommonLinkUtility.GetFullAbsolutePath(FilesLinkUtility.FileHandlerPath + "?" + FilesLinkUtility.Action + "=track" + "&" + FilesLinkUtility.FileId + "=" + fileId + "&" + FilesLinkUtility.AuthKey + "=" + EmailValidationKeyProvider.GetEmailKey(fileId)); callbackUrl = DocumentServiceConnector.ReplaceCommunityAdress(callbackUrl); return(DocumentServiceConnector.Command(CommandMethod.Info, docKeyForTrack, fileId, callbackUrl)); }
public static bool RenameFile(File file) { if (!FileUtility.CanWebView(file.Title) && !FileUtility.CanWebEdit(file.Title) && !FileUtility.CanWebReview(file.Title)) { return(true); } var docKeyForTrack = GetDocKey(file); var meta = new Web.Core.Files.DocumentService.MetaData { Title = file.Title }; return(DocumentServiceConnector.Command(Web.Core.Files.DocumentService.CommandMethod.Meta, docKeyForTrack, file.ID, meta: meta)); }
public bool RenameFile <T>(File <T> file, IFileDao <T> fileDao) { if (!FileUtility.CanWebView(file.Title) && !FileUtility.CanWebEdit(file.Title) && !FileUtility.CanWebReview(file.Title) && !FileUtility.CanWebRestrictedEditing(file.Title) && !FileUtility.CanWebComment(file.Title)) { return(true); } var fileStable = file.Forcesave == ForcesaveType.None ? file : fileDao.GetFileStable(file.ID, file.Version); var docKeyForTrack = GetDocKey(fileStable); var meta = new Web.Core.Files.DocumentService.MetaData { Title = file.Title }; return(DocumentServiceConnector.Command(Web.Core.Files.DocumentService.CommandMethod.Meta, docKeyForTrack, file.ID, meta: meta)); }
public bool DropUser(string docKeyForTrack, string[] users, object fileId = null) { return(DocumentServiceConnector.Command(Web.Core.Files.DocumentService.CommandMethod.Drop, docKeyForTrack, fileId, null, users)); }
public static bool StartTrack(string fileId, string docKeyForTrack) { var callbackUrl = GetCallbackUrl(fileId); return(DocumentServiceConnector.Command(CommandMethod.Info, docKeyForTrack, fileId, callbackUrl)); }
public static bool Drop(string docKeyForTrack, List <Guid> users, object fileId = null) { var dropString = "[\"" + string.Join("\",\"", users) + "\"]"; return(DocumentServiceConnector.Command(CommandMethod.Drop, docKeyForTrack, fileId, null, dropString)); }
private static string ProcessSave(string fileId, bool isNew, TrackerData fileData) { Guid userId; var comments = new List <string>(); if (fileData.Status == TrackerStatus.Corrupted) { comments.Add(FilesCommonResource.ErrorMassage_SaveCorrupted); } if (fileData.Users == null || fileData.Users.Count == 0 || !Guid.TryParse(fileData.Users[0], out userId)) { userId = FileTracker.GetEditingBy(fileId).FirstOrDefault(); } try { SecurityContext.AuthenticateMe(userId); } catch (Exception ex) { Global.Logger.Info("DocService save error: anonymous author - " + userId, ex); if (!userId.Equals(ASC.Core.Configuration.Constants.Guest.ID)) { comments.Add(FilesCommonResource.ErrorMassage_SaveAnonymous); } } File file = null; var saved = false; if (string.IsNullOrEmpty(fileData.Url)) { try { comments.Add(FilesCommonResource.ErrorMassage_SaveUrlLost); FileTracker.Remove(fileId); file = EntryManager.CompleteVersionFile(fileId, 0, false, false); using (var fileDao = Global.DaoFactory.GetFileDao()) { fileDao.UpdateComment(file.ID, file.Version, string.Join("; ", comments)); } } catch (Exception ex) { Global.Logger.Error(string.Format("DocService save error. Version update. File id: '{0}'. UserId: {1}. DocKey '{2}'", fileId, userId, fileData.Key), ex); } } else { try { file = EntryManager.SaveEditing(fileId, -1, userId, null, fileData.Url, null, isNew, string.Empty, string.Join("; ", comments), false); saved = fileData.Status == TrackerStatus.MustSave; } catch (Exception ex) { Global.Logger.Error(string.Format("DocService save error. File id: '{0}'. UserId: {1}. DocKey '{2}'. DownloadUri: {3}", fileId, userId, fileData.Key, fileData.Url), ex); StoringFileAfterError(fileId, userId.ToString(), fileData.Url); } } if (file != null) { var user = CoreContext.UserManager.GetUsers(userId); if (user != null) { FilesMessageService.Send(file, MessageInitiator.DocsService, MessageAction.UserFileUpdated, user.DisplayUserName(false), file.Title); } SaveHistory(file, string.IsNullOrEmpty(fileData.ChangesHistory) ? fileData.History.ToString() : fileData.ChangesHistory, fileData.ChangesUrl); } FileTracker.Remove(fileId); DocumentServiceConnector.Command(CommandMethod.Saved, fileData.Key, fileId, null, userId.ToString(), saved ? "1" : "0"); return(saved ? "0" //error:0 - saved : "1"); //error:1 - some error }
public static bool DropUser(string docKeyForTrack, List <Guid> users, object fileId = null) { return(DocumentServiceConnector.Command(Web.Core.Files.DocumentService.CommandMethod.Drop, docKeyForTrack, fileId, null, users.Select(u => u.ToString()).ToArray())); }