diff --git a/products/ASC.Files/Server/Core/Entries/EditHistory.cs b/products/ASC.Files/Server/Core/Entries/EditHistory.cs index 772b222630..e7b7c3f8ee 100644 --- a/products/ASC.Files/Server/Core/Entries/EditHistory.cs +++ b/products/ASC.Files/Server/Core/Entries/EditHistory.cs @@ -1,51 +1,48 @@ -/* - * - * (c) Copyright Ascensio System Limited 2010-2018 - * - * This program is freeware. You can redistribute it and/or modify it under the terms of the GNU - * General Public License (GPL) version 3 as published by the Free Software Foundation (https://www.gnu.org/copyleft/gpl.html). - * In accordance with Section 7(a) of the GNU GPL its Section 15 shall be amended to the effect that - * Ascensio System SIA expressly excludes the warranty of non-infringement of any third-party rights. - * - * THIS PROGRAM IS DISTRIBUTED WITHOUT ANY WARRANTY; WITHOUT EVEN THE IMPLIED WARRANTY OF MERCHANTABILITY OR - * FITNESS FOR A PARTICULAR PURPOSE. For more details, see GNU GPL at https://www.gnu.org/copyleft/gpl.html - * - * You can contact Ascensio System SIA by email at sales@onlyoffice.com - * - * The interactive user interfaces in modified source and object code versions of ONLYOFFICE must display - * Appropriate Legal Notices, as required under Section 5 of the GNU GPL version 3. - * - * Pursuant to Section 7 § 3(b) of the GNU GPL you must retain the original ONLYOFFICE logo which contains - * relevant author attributions when distributing the software. If the display of the logo in its graphic - * form is not reasonably feasible for technical reasons, you must include the words "Powered by ONLYOFFICE" - * in every copy of the program you distribute. - * Pursuant to Section 7 § 3(e) we decline to grant you any rights under trademark law for use of our trademarks. - * -*/ - - -using System; -using System.Collections.Generic; -using System.Diagnostics; -using System.Linq; -using System.Runtime.Serialization; +/* + * + * (c) Copyright Ascensio System Limited 2010-2018 + * + * This program is freeware. You can redistribute it and/or modify it under the terms of the GNU + * General Public License (GPL) version 3 as published by the Free Software Foundation (https://www.gnu.org/copyleft/gpl.html). + * In accordance with Section 7(a) of the GNU GPL its Section 15 shall be amended to the effect that + * Ascensio System SIA expressly excludes the warranty of non-infringement of any third-party rights. + * + * THIS PROGRAM IS DISTRIBUTED WITHOUT ANY WARRANTY; WITHOUT EVEN THE IMPLIED WARRANTY OF MERCHANTABILITY OR + * FITNESS FOR A PARTICULAR PURPOSE. For more details, see GNU GPL at https://www.gnu.org/copyleft/gpl.html + * + * You can contact Ascensio System SIA by email at sales@onlyoffice.com + * + * The interactive user interfaces in modified source and object code versions of ONLYOFFICE must display + * Appropriate Legal Notices, as required under Section 5 of the GNU GPL version 3. + * + * Pursuant to Section 7 § 3(b) of the GNU GPL you must retain the original ONLYOFFICE logo which contains + * relevant author attributions when distributing the software. If the display of the logo in its graphic + * form is not reasonably feasible for technical reasons, you must include the words "Powered by ONLYOFFICE" + * in every copy of the program you distribute. + * Pursuant to Section 7 § 3(e) we decline to grant you any rights under trademark law for use of our trademarks. + * +*/ + + +using System; +using System.Collections.Generic; +using System.Linq; +using System.Runtime.Serialization; using ASC.Common.Logging; -using ASC.Core; -using ASC.Core.Tenants; -using ASC.Core.Users; +using ASC.Core; +using ASC.Core.Tenants; +using ASC.Core.Users; using ASC.Files.Resources; using ASC.Web.Core.Users; using Microsoft.Extensions.Options; -using Newtonsoft.Json.Linq; - -namespace ASC.Files.Core -{ - [DataContract(Name = "editHistory", Namespace = "")] - [DebuggerDisplay("{ID} v{Version}")] - public class EditHistory +using Newtonsoft.Json.Linq; + +namespace ASC.Files.Core +{ + public class EditHistory { public EditHistory( IOptionsMonitor options, @@ -60,37 +57,34 @@ namespace ASC.Files.Core UserManager = userManager; DisplayUserSettingsHelper = displayUserSettingsHelper; } - - public int ID; - [DataMember(Name = "key")] public string Key; - [DataMember(Name = "version")] public int Version; - [DataMember(Name = "versionGroup")] public int VersionGroup; - - [DataMember(Name = "user")] public EditHistoryAuthor ModifiedBy; - - [DataMember(Name = "changeshistory", EmitDefaultValue = false)] public string ChangesString; - - [DataMember(Name = "changes", EmitDefaultValue = false)] - public List Changes - { - get - { - var changes = new List(); - if (string.IsNullOrEmpty(ChangesString)) return changes; - - //new scheme - Exception newSchemeException = null; - try - { - var jObject = JObject.Parse(ChangesString); - ServerVersion = jObject.Value("serverVersion"); - - var jChanges = jObject.Value("changes"); - - changes = jChanges.Children() - .Select(jChange => - { - var jUser = jChange.Value("user"); + + public int ID; + public string Key; + public int Version; + public int VersionGroup; + public EditHistoryAuthor ModifiedBy; + public string ChangesString; + + public List Changes + { + get + { + var changes = new List(); + if (string.IsNullOrEmpty(ChangesString)) return changes; + + //new scheme + Exception newSchemeException = null; + try + { + var jObject = JObject.Parse(ChangesString); + ServerVersion = jObject.Value("serverVersion"); + + var jChanges = jObject.Value("changes"); + + changes = jChanges.Children() + .Select(jChange => + { + var jUser = jChange.Value("user"); return new EditHistoryChanges(TenantUtil) { Date = jChange.Value("created"), @@ -99,24 +93,24 @@ namespace ASC.Files.Core Id = new Guid(jUser.Value("id") ?? Guid.Empty.ToString()), Name = jUser.Value("name"), }, - }; - }) - .ToList(); - return changes; - } - catch (Exception ex) - { - newSchemeException = ex; - } - - //old scheme - //todo: delete - try - { - var jChanges = JArray.Parse(ChangesString); - - changes = jChanges.Children() - .Select(jChange => + }; + }) + .ToList(); + return changes; + } + catch (Exception ex) + { + newSchemeException = ex; + } + + //old scheme + //todo: delete + try + { + var jChanges = JArray.Parse(ChangesString); + + changes = jChanges.Children() + .Select(jChange => new EditHistoryChanges(TenantUtil) { Date = jChange.Value("date"), @@ -125,27 +119,26 @@ namespace ASC.Files.Core Id = new Guid(jChange.Value("userid") ?? Guid.Empty.ToString()), Name = jChange.Value("username") } - }) - .ToList(); - } - catch (Exception ex) - { - Logger.Error("DeSerialize new scheme exception", newSchemeException); - Logger.Error("DeSerialize old scheme exception", ex); - } - - return changes; - } - set { throw new NotImplementedException(); } - } - - public DateTime ModifiedOn; - - [DataMember(Name = "created")] - public string ModifiedOnString - { - get { return ModifiedOn.Equals(default) ? null : ModifiedOn.ToString("g"); } - set { throw new NotImplementedException(); } + }) + .ToList(); + } + catch (Exception ex) + { + Logger.Error("DeSerialize new scheme exception", newSchemeException); + Logger.Error("DeSerialize old scheme exception", ex); + } + + return changes; + } + set { throw new NotImplementedException(); } + } + + public DateTime ModifiedOn; + + public string ModifiedOnString + { + get { return ModifiedOn.Equals(default) ? null : ModifiedOn.ToString("g"); } + set { throw new NotImplementedException(); } } public ILog Logger { get; } @@ -154,12 +147,10 @@ namespace ASC.Files.Core public UserManager UserManager { get; } public DisplayUserSettingsHelper DisplayUserSettingsHelper { get; } - [DataMember(Name = "serverVersion", EmitDefaultValue = false)] public string ServerVersion; - } - - [DataContract(Name = "user", Namespace = "")] - [DebuggerDisplay("{Id} {Name}")] - public class EditHistoryAuthor + public string ServerVersion; + } + + public class EditHistoryAuthor { public EditHistoryAuthor( AuthContext authContext, @@ -170,88 +161,82 @@ namespace ASC.Files.Core UserManager = userManager; DisplayUserSettingsHelper = displayUserSettingsHelper; } - - [DataMember(Name = "id")] public Guid Id; - - private string _name; - - [DataMember(Name = "name")] - public string Name - { - get - { - UserInfo user; - return - Id.Equals(AuthContext.CurrentAccount.ID) - ? FilesCommonResource.Author_Me - : Id.Equals(Guid.Empty) - || Id.Equals(ASC.Core.Configuration.Constants.Guest.ID) - || (user = UserManager.GetUsers(Id)).Equals(Constants.LostUser) - ? string.IsNullOrEmpty(_name) - ? FilesCommonResource.Guest - : _name - : user.DisplayUserName(false, DisplayUserSettingsHelper); - } - set { _name = value; } + + [DataMember(Name = "id")] public Guid Id; + + private string _name; + + [DataMember(Name = "name")] + public string Name + { + get + { + UserInfo user; + return + Id.Equals(AuthContext.CurrentAccount.ID) + ? FilesCommonResource.Author_Me + : Id.Equals(Guid.Empty) + || Id.Equals(ASC.Core.Configuration.Constants.Guest.ID) + || (user = UserManager.GetUsers(Id)).Equals(Constants.LostUser) + ? string.IsNullOrEmpty(_name) + ? FilesCommonResource.Guest + : _name + : user.DisplayUserName(false, DisplayUserSettingsHelper); + } + set { _name = value; } } public AuthContext AuthContext { get; } public UserManager UserManager { get; } public DisplayUserSettingsHelper DisplayUserSettingsHelper { get; } - } - - [DataContract(Name = "change", Namespace = "")] - [DebuggerDisplay("{Author.Name}")] - public class EditHistoryChanges + } + + public class EditHistoryChanges { public EditHistoryChanges(TenantUtil tenantUtil) { TenantUtil = tenantUtil; } - - [DataMember(Name = "user")] public EditHistoryAuthor Author; - - private DateTime _date; - - [DataMember(Name = "created")] - public string Date - { - get { return _date.Equals(default) ? null : _date.ToString("g"); } - set - { - if (DateTime.TryParse(value, out _date)) - { - _date = TenantUtil.DateTimeFromUtc(_date); - } - } + + public EditHistoryAuthor Author; + + private DateTime DateTime; + + public string Date + { + get { return DateTime.Equals(default) ? null : DateTime.ToString("g"); } + set + { + if (DateTime.TryParse(value, out DateTime)) + { + DateTime = TenantUtil.DateTimeFromUtc(DateTime); + } + } } public TenantUtil TenantUtil { get; } - } - - [DataContract(Name = "data")] - [DebuggerDisplay("{Version}")] - public class EditHistoryData - { - [DataMember(Name = "changesUrl", EmitDefaultValue = false)] public string ChangesUrl; - - [DataMember(Name = "key")] public string Key; - - [DataMember(Name = "previous", EmitDefaultValue = false)] public EditHistoryUrl Previous; - - [DataMember(Name = "token", EmitDefaultValue = false)] public string Token; - - [DataMember(Name = "url")] public string Url; - - [DataMember(Name = "version")] public int Version; - } - - [DataContract(Name = "url")] - [DebuggerDisplay("{Key} - {Url}")] - public class EditHistoryUrl - { - [DataMember(Name = "key")] public string Key; - - [DataMember(Name = "url")] public string Url; - } + } + + + public class EditHistoryData + { + public string ChangesUrl; + + public string Key; + + public EditHistoryUrl Previous; + + public string Token; + + public string Url; + + public int Version; + } + + public class EditHistoryUrl + { + public string Key; + + public string Url; + } } \ No newline at end of file diff --git a/products/ASC.Files/Server/Core/Entries/File.cs b/products/ASC.Files/Server/Core/Entries/File.cs index b840326099..43657e6dab 100644 --- a/products/ASC.Files/Server/Core/Entries/File.cs +++ b/products/ASC.Files/Server/Core/Entries/File.cs @@ -165,7 +165,7 @@ namespace ASC.Files.Core } [DataMember(EmitDefaultValue = false, Name = "locked")] - public bool Locked { get; set; } + public bool? Locked { get; set; } [DataMember(EmitDefaultValue = false, Name = "locked_by")] public string LockedBy { get; set; } @@ -183,7 +183,7 @@ namespace ASC.Files.Core } [DataMember(EmitDefaultValue = false, Name = "encrypted")] - public bool Encrypted { get; set; } + public bool? Encrypted { get; set; } public ForcesaveType Forcesave { get; set; } diff --git a/products/ASC.Files/Server/Core/FileStorageService.cs b/products/ASC.Files/Server/Core/FileStorageService.cs index 1fe25ff5d0..b03092eb36 100644 --- a/products/ASC.Files/Server/Core/FileStorageService.cs +++ b/products/ASC.Files/Server/Core/FileStorageService.cs @@ -299,7 +299,7 @@ namespace ASC.Web.Files.Services.WCFService parent.ParentFolderID = prevVisible.ID; } - parent.Shareable = FileSharing.CanSetAccess(parent) || parent.FolderType == FolderType.SHARE; + parent.Shareable = (FileSharing.CanSetAccess(parent) || parent.FolderType == FolderType.SHARE) ? (bool?)true : null; entries = entries.Where(x => x.FileEntryType == FileEntryType.Folder || !FileConverter.IsConverting((File)x)); @@ -1195,7 +1195,7 @@ namespace ASC.Web.Files.Services.WCFService FileMarker.RemoveMarkAsNewForAll(folder); } - providerDao.RemoveProviderInfo(folder.ProviderId); + providerDao.RemoveProviderInfo(folder.ProviderId == null ? 0 : (int) folder.ProviderId); FilesMessageService.Send(folder, GetHttpHeaders(), MessageAction.ThirdPartyDeleted, folder.ID.ToString(), providerInfo.ProviderKey); return folder.ID; @@ -1736,7 +1736,7 @@ namespace ASC.Web.Files.Services.WCFService var changed = false; bool? canShare = null; - if (file.Encrypted) canShare = false; + if (file.Encrypted == null ? false : (bool)file.Encrypted) canShare = false; var recipients = new List(); foreach (var email in mentionMessage.Emails) diff --git a/products/ASC.Files/Server/Core/Thirdparty/IThirdPartyProviderDao.cs b/products/ASC.Files/Server/Core/Thirdparty/IThirdPartyProviderDao.cs index 5e37274897..c86585e6a1 100644 --- a/products/ASC.Files/Server/Core/Thirdparty/IThirdPartyProviderDao.cs +++ b/products/ASC.Files/Server/Core/Thirdparty/IThirdPartyProviderDao.cs @@ -150,7 +150,7 @@ namespace ASC.Files.Thirdparty { fileEntry.CreateBy = ProviderInfo.Owner; fileEntry.ModifiedBy = ProviderInfo.Owner; - fileEntry.ProviderId = ProviderInfo.ID; + fileEntry.ProviderId = ProviderInfo.ID == 0 ? null :(int?)ProviderInfo.ID; fileEntry.ProviderKey = ProviderInfo.ProviderKey; fileEntry.RootFolderCreator = ProviderInfo.Owner; fileEntry.RootFolderType = ProviderInfo.RootFolderType; diff --git a/products/ASC.Files/Server/Core/Thirdparty/SharePoint/SharePointProviderInfo.cs b/products/ASC.Files/Server/Core/Thirdparty/SharePoint/SharePointProviderInfo.cs index 88f0119ab3..a4c8a06310 100644 --- a/products/ASC.Files/Server/Core/Thirdparty/SharePoint/SharePointProviderInfo.cs +++ b/products/ASC.Files/Server/Core/Thirdparty/SharePoint/SharePointProviderInfo.cs @@ -289,7 +289,7 @@ namespace ASC.Files.Thirdparty.SharePoint result.CreateOn = DateTime.UtcNow; result.ModifiedBy = Owner; result.ModifiedOn = DateTime.UtcNow; - result.ProviderId = ID; + result.ProviderId = ID == 0 ? null : (int?)ID; result.ProviderKey = ProviderKey; result.RootFolderCreator = Owner; result.RootFolderId = MakeId(RootFolder.ServerRelativeUrl); @@ -310,7 +310,7 @@ namespace ASC.Files.Thirdparty.SharePoint result.ModifiedBy = Owner; result.ModifiedOn = file.TimeLastModified.Kind == DateTimeKind.Utc ? TenantUtil.DateTimeFromUtc(file.TimeLastModified) : file.TimeLastModified; result.NativeAccessor = file; - result.ProviderId = ID; + result.ProviderId = ID == 0 ? null : (int?)ID; result.ProviderKey = ProviderKey; result.Title = MakeTitle(file.Name); result.RootFolderId = MakeId(SpRootFolderId); @@ -506,12 +506,12 @@ namespace ASC.Files.Thirdparty.SharePoint result.FolderType = FolderType.DEFAULT; result.ModifiedBy = Owner; result.ModifiedOn = DateTime.UtcNow; - result.ProviderId = ID; + result.ProviderId = ID == 0 ? null : (int?)ID; result.ProviderKey = ProviderKey; result.RootFolderCreator = Owner; result.RootFolderId = MakeId(SpRootFolderId); result.RootFolderType = RootFolderType; - result.Shareable = false; + result.Shareable = null; result.Title = MakeTitle(GetTitleById(errorFolder.ID)); result.TotalFiles = 0; result.TotalSubFolders = 0; @@ -529,12 +529,12 @@ namespace ASC.Files.Thirdparty.SharePoint result.FolderType = FolderType.DEFAULT; result.ModifiedBy = Owner; result.ModifiedOn = CreateOn; - result.ProviderId = ID; + result.ProviderId = ID == 0 ? null : (int?)ID; result.ProviderKey = ProviderKey; result.RootFolderCreator = Owner; result.RootFolderId = MakeId(RootFolder.ServerRelativeUrl); result.RootFolderType = RootFolderType; - result.Shareable = false; + result.Shareable = null; result.Title = isRoot ? CustomerTitle : MakeTitle(folder.Name); result.TotalFiles = 0; result.TotalSubFolders = 0; diff --git a/products/ASC.Files/Server/Helpers/DocuSignHelper.cs b/products/ASC.Files/Server/Helpers/DocuSignHelper.cs index 79229b5842..faeef0e90d 100644 --- a/products/ASC.Files/Server/Helpers/DocuSignHelper.cs +++ b/products/ASC.Files/Server/Helpers/DocuSignHelper.cs @@ -26,9 +26,7 @@ using System; using System.Collections.Generic; -using System.Diagnostics; using System.IO; -using System.Runtime.Serialization; using System.Security; using ASC.Common; @@ -427,40 +425,24 @@ namespace ASC.Web.Files.Helpers return file; } - - [DataContract] - [DebuggerDisplay("{AccountId} {BaseUri}")] + private class DocuSignAccount - { - [DataMember(Name = "account_id", EmitDefaultValue = false)] + { public string AccountId { get; set; } - - [DataMember(Name = "base_uri", EmitDefaultValue = false)] public string BaseUri { get; set; } } - [DataContract] private class DocuSignUserInfo { - [DataMember(Name = "accounts", EmitDefaultValue = false)] public List Accounts { get; set; } } } - [DataContract(Name = "docusign_data", Namespace = "")] - [DebuggerDisplay("{Name}")] public class DocuSignData { - [DataMember(Name = "folderId")] public string FolderId { get; set; } - - [DataMember(Name = "message")] public string Message { get; set; } - - [DataMember(Name = "name", IsRequired = true, EmitDefaultValue = false)] public string Name { get; set; } - - [DataMember(Name = "users")] public ItemList Users { get; set; } } diff --git a/products/ASC.Files/Server/Model/FileWrapper.cs b/products/ASC.Files/Server/Model/FileWrapper.cs index 0bcc1ce873..9ebc5b5c36 100644 --- a/products/ASC.Files/Server/Model/FileWrapper.cs +++ b/products/ASC.Files/Server/Model/FileWrapper.cs @@ -56,7 +56,7 @@ namespace ASC.Api.Documents /// /// [DataMember(EmitDefaultValue = true, IsRequired = false)] - public int Version { get; set; } + public int? Version { get; set; } /// /// @@ -194,7 +194,7 @@ namespace ASC.Api.Documents result.FileExst = FileUtility.GetFileExtension(file.Title); result.FileType = FileUtility.GetFileTypeByExtention(result.FileExst); - result.Version = file.Version; + result.Version = file.Version == 0 ? null : (int?)file.Version; result.VersionGroup = file.VersionGroup; result.ContentLength = file.ContentLengthString; result.FileStatus = file.FileStatus; diff --git a/products/ASC.Files/Server/Services/DocumentService/DocumentServiceParams.cs b/products/ASC.Files/Server/Services/DocumentService/DocumentServiceParams.cs index 845e68d11b..974eeb2ed8 100644 --- a/products/ASC.Files/Server/Services/DocumentService/DocumentServiceParams.cs +++ b/products/ASC.Files/Server/Services/DocumentService/DocumentServiceParams.cs @@ -1,94 +1,94 @@ -/* - * - * (c) Copyright Ascensio System Limited 2010-2018 - * - * This program is freeware. You can redistribute it and/or modify it under the terms of the GNU - * General Public License (GPL) version 3 as published by the Free Software Foundation (https://www.gnu.org/copyleft/gpl.html). - * In accordance with Section 7(a) of the GNU GPL its Section 15 shall be amended to the effect that - * Ascensio System SIA expressly excludes the warranty of non-infringement of any third-party rights. - * - * THIS PROGRAM IS DISTRIBUTED WITHOUT ANY WARRANTY; WITHOUT EVEN THE IMPLIED WARRANTY OF MERCHANTABILITY OR - * FITNESS FOR A PARTICULAR PURPOSE. For more details, see GNU GPL at https://www.gnu.org/copyleft/gpl.html - * - * You can contact Ascensio System SIA by email at sales@onlyoffice.com - * - * The interactive user interfaces in modified source and object code versions of ONLYOFFICE must display - * Appropriate Legal Notices, as required under Section 5 of the GNU GPL version 3. - * - * Pursuant to Section 7 § 3(b) of the GNU GPL you must retain the original ONLYOFFICE logo which contains - * relevant author attributions when distributing the software. If the display of the logo in its graphic - * form is not reasonably feasible for technical reasons, you must include the words "Powered by ONLYOFFICE" - * in every copy of the program you distribute. - * Pursuant to Section 7 § 3(e) we decline to grant you any rights under trademark law for use of our trademarks. - * -*/ - - -using System.IO; -using System.Runtime.Serialization; -using System.Runtime.Serialization.Json; -using System.Text; - -namespace ASC.Web.Files.Services.DocumentService -{ - [DataContract(Name = "docServiceParams", Namespace = "")] - public class DocumentServiceParams +/* + * + * (c) Copyright Ascensio System Limited 2010-2018 + * + * This program is freeware. You can redistribute it and/or modify it under the terms of the GNU + * General Public License (GPL) version 3 as published by the Free Software Foundation (https://www.gnu.org/copyleft/gpl.html). + * In accordance with Section 7(a) of the GNU GPL its Section 15 shall be amended to the effect that + * Ascensio System SIA expressly excludes the warranty of non-infringement of any third-party rights. + * + * THIS PROGRAM IS DISTRIBUTED WITHOUT ANY WARRANTY; WITHOUT EVEN THE IMPLIED WARRANTY OF MERCHANTABILITY OR + * FITNESS FOR A PARTICULAR PURPOSE. For more details, see GNU GPL at https://www.gnu.org/copyleft/gpl.html + * + * You can contact Ascensio System SIA by email at sales@onlyoffice.com + * + * The interactive user interfaces in modified source and object code versions of ONLYOFFICE must display + * Appropriate Legal Notices, as required under Section 5 of the GNU GPL version 3. + * + * Pursuant to Section 7 § 3(b) of the GNU GPL you must retain the original ONLYOFFICE logo which contains + * relevant author attributions when distributing the software. If the display of the logo in its graphic + * form is not reasonably feasible for technical reasons, you must include the words "Powered by ONLYOFFICE" + * in every copy of the program you distribute. + * Pursuant to Section 7 § 3(e) we decline to grant you any rights under trademark law for use of our trademarks. + * +*/ + + +using System.IO; +using System.Runtime.Serialization; +using System.Runtime.Serialization.Json; +using System.Text; + +namespace ASC.Web.Files.Services.DocumentService +{ + [DataContract(Name = "docServiceParams", Namespace = "")] + public class DocumentServiceParams { [DataMember(Name = "displayName")] - public string DisplayName; - - [DataMember(Name = "docKeyForTrack")] - public string DocKeyForTrack; - - [DataMember(Name = "editByUrl")] + public string DisplayName; + + [DataMember(Name = "docKeyForTrack")] + public string DocKeyForTrack; + + [DataMember(Name = "editByUrl")] public bool EditByUrl; [DataMember(Name = "email")] - public string Email; - - [DataMember(Name = "fileId", EmitDefaultValue = false)] - public string FileId; - - [DataMember(Name = "fileProviderKey", EmitDefaultValue = false)] - public string FileProviderKey; - - [DataMember(Name = "fileVersion", EmitDefaultValue = false)] - public int? FileVersion; - - [DataMember(Name = "linkToEdit")] - public string LinkToEdit; - - [DataMember(Name = "openHistory", EmitDefaultValue = false)] - public bool? OpenHistory; - - [DataMember(Name = "openinigDate")] - public string OpeninigDate; - - [DataMember(Name = "serverErrorMessage")] - public string ServerErrorMessage; - - [DataMember(Name = "shareLinkParam")] - public string ShareLinkParam; - - [DataMember(Name = "tabId")] - public string TabId; - - [DataMember(Name = "thirdPartyApp")] - public bool ThirdPartyApp; - - [DataMember(Name = "canGetUsers")] - public bool CanGetUsers; - - - public static string Serialize(DocumentServiceParams docServiceParams) - { - using (var ms = new MemoryStream()) - { - var serializer = new DataContractJsonSerializer(typeof (DocumentServiceParams)); - serializer.WriteObject(ms, docServiceParams); - ms.Seek(0, SeekOrigin.Begin); - return Encoding.UTF8.GetString(ms.GetBuffer(), 0, (int)ms.Length); - } - } - } + public string Email; + + [DataMember(Name = "fileId", EmitDefaultValue = false)] + public string FileId; + + [DataMember(Name = "fileProviderKey", EmitDefaultValue = false)] + public string FileProviderKey; + + [DataMember(Name = "fileVersion", EmitDefaultValue = false)] + public int? FileVersion; + + [DataMember(Name = "linkToEdit")] + public string LinkToEdit; + + [DataMember(Name = "openHistory", EmitDefaultValue = false)] + public bool? OpenHistory; + + [DataMember(Name = "openinigDate")] + public string OpeninigDate; + + [DataMember(Name = "serverErrorMessage")] + public string ServerErrorMessage; + + [DataMember(Name = "shareLinkParam")] + public string ShareLinkParam; + + [DataMember(Name = "tabId")] + public string TabId; + + [DataMember(Name = "thirdPartyApp")] + public bool ThirdPartyApp; + + [DataMember(Name = "canGetUsers")] + public bool CanGetUsers; + + + public static string Serialize(DocumentServiceParams docServiceParams) + { + using (var ms = new MemoryStream()) + { + var serializer = new DataContractJsonSerializer(typeof (DocumentServiceParams)); + serializer.WriteObject(ms, docServiceParams); + ms.Seek(0, SeekOrigin.Begin); + return Encoding.UTF8.GetString(ms.GetBuffer(), 0, (int)ms.Length); + } + } + } } \ No newline at end of file diff --git a/products/ASC.Files/Server/Services/WCFService/FileOperations/FileDeleteOperation.cs b/products/ASC.Files/Server/Services/WCFService/FileOperations/FileDeleteOperation.cs index 07b836c733..91950a6c13 100644 --- a/products/ASC.Files/Server/Services/WCFService/FileOperations/FileDeleteOperation.cs +++ b/products/ASC.Files/Server/Services/WCFService/FileOperations/FileDeleteOperation.cs @@ -155,7 +155,7 @@ namespace ASC.Web.Files.Services.WCFService.FileOperations { if (ProviderDao != null) { - ProviderDao.RemoveProviderInfo(folder.ProviderId == null ? 0 : (int)folder.ProviderId); + ProviderDao.RemoveProviderInfo(folder.ProviderId == null ? 0 : (int) folder.ProviderId); filesMessageService.Send(folder, _headers, MessageAction.ThirdPartyDeleted, folder.ID.ToString(), folder.ProviderKey); } diff --git a/products/ASC.Files/Server/Services/WCFService/Wrappers/MentionWrapper.cs b/products/ASC.Files/Server/Services/WCFService/Wrappers/MentionWrapper.cs index de298b8f39..7e7d00cff6 100644 --- a/products/ASC.Files/Server/Services/WCFService/Wrappers/MentionWrapper.cs +++ b/products/ASC.Files/Server/Services/WCFService/Wrappers/MentionWrapper.cs @@ -25,7 +25,6 @@ using System.Collections.Generic; -using System.Runtime.Serialization; using ASC.Core.Users; using ASC.Web.Core.Users; @@ -33,27 +32,20 @@ using ASC.Web.Files.Services.DocumentService; namespace ASC.Web.Files.Services.WCFService { - [DataContract(Name = "mention", Namespace = "")] public class MentionWrapper { - [DataMember(Name = "email", EmitDefaultValue = false)] public string Email { get { return User.Email; } set { } } - [DataMember(Name = "id", EmitDefaultValue = false)] public string Id { get { return User.ID.ToString(); } set { } } - - [DataMember(Name = "hasAccess", EmitDefaultValue = false)] - public bool? HasAccess { get; set; } - - [DataMember(Name = "name", EmitDefaultValue = false)] + public bool HasAccess { get; set; } public string Name { get { return User.DisplayUserName(false, DisplayUserSettingsHelper); } @@ -72,16 +64,10 @@ namespace ASC.Web.Files.Services.WCFService } - [DataContract(Name = "message", Namespace = "")] public class MentionMessageWrapper { - [DataMember(Name = "actionLink")] public ActionLinkConfig ActionLink { get; set; } - - [DataMember(Name = "emails")] public List Emails { get; set; } - - [DataMember(Name = "message")] public string Message { get; set; } } } \ No newline at end of file diff --git a/products/ASC.Files/Server/Utils/EntryManager.cs b/products/ASC.Files/Server/Utils/EntryManager.cs index 8fd1454e89..b2713cd620 100644 --- a/products/ASC.Files/Server/Utils/EntryManager.cs +++ b/products/ASC.Files/Server/Utils/EntryManager.cs @@ -32,7 +32,6 @@ using System.Net; using System.Security; using System.Text; using System.Threading; - using ASC.Common; using ASC.Common.Caching; using ASC.Common.Logging; @@ -597,12 +596,12 @@ namespace ASC.Web.Files.Utils folder.FolderType = FolderType.DEFAULT; folder.ModifiedBy = providerInfo.Owner; folder.ModifiedOn = providerInfo.CreateOn; - folder.ProviderId = providerInfo.ID; + folder.ProviderId = providerInfo.ID == 0 ? null : (int?)providerInfo.ID; folder.ProviderKey = providerInfo.ProviderKey; folder.RootFolderCreator = providerInfo.Owner; folder.RootFolderId = providerInfo.RootFolderId; folder.RootFolderType = providerInfo.RootFolderType; - folder.Shareable = false; + folder.Shareable = null; folder.Title = providerInfo.CustomerTitle; folder.TotalFiles = 0; folder.TotalSubFolders = 0; @@ -646,7 +645,7 @@ namespace ASC.Web.Files.Utils var tagLocked = tagsLocked.FirstOrDefault(t => t.EntryId.Equals(file.ID)); var lockedBy = tagLocked != null ? tagLocked.Owner : Guid.Empty; - file.Locked = lockedBy != Guid.Empty; + file.Locked = (lockedBy != Guid.Empty) == false? null : (bool?)(lockedBy != Guid.Empty); file.LockedBy = lockedBy != Guid.Empty && lockedBy != AuthContext.CurrentAccount.ID ? Global.GetUserName(lockedBy) : null; diff --git a/products/ASC.Files/Server/Utils/FileConverter.cs b/products/ASC.Files/Server/Utils/FileConverter.cs index d3f9080130..2e2fe0258c 100644 --- a/products/ASC.Files/Server/Utils/FileConverter.cs +++ b/products/ASC.Files/Server/Utils/FileConverter.cs @@ -513,7 +513,7 @@ namespace ASC.Web.Files.Utils return false; } - if (file.Encrypted != null && (bool)file.Encrypted) + if (file.Encrypted == null ? false : (bool)file.Encrypted) { return false; } diff --git a/products/ASC.Files/Server/Utils/FileUploader.cs b/products/ASC.Files/Server/Utils/FileUploader.cs index 9d01f2af61..f3f7bb0923 100644 --- a/products/ASC.Files/Server/Utils/FileUploader.cs +++ b/products/ASC.Files/Server/Utils/FileUploader.cs @@ -187,7 +187,7 @@ namespace ASC.Web.Files.Utils && !EntryManager.FileLockedForMe(file.ID) && !FileTracker.IsEditing(file.ID) && file.RootFolderType != FolderType.TRASH - && !(file.Encrypted); + && !file.Encrypted == null ? false : (bool) file.Encrypted; } private T GetFolderId(T folderId, IList relativePath)