api-defaultvalue: fix

This commit is contained in:
SuhorukovAnton 2020-06-29 13:37:53 +03:00
parent 51be59740e
commit 6869d7c8d1
13 changed files with 284 additions and 332 deletions

View File

@ -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<ILog> 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<EditHistoryChanges> Changes
{
get
{
var changes = new List<EditHistoryChanges>();
if (string.IsNullOrEmpty(ChangesString)) return changes;
//new scheme
Exception newSchemeException = null;
try
{
var jObject = JObject.Parse(ChangesString);
ServerVersion = jObject.Value<string>("serverVersion");
var jChanges = jObject.Value<JArray>("changes");
changes = jChanges.Children()
.Select(jChange =>
{
var jUser = jChange.Value<JObject>("user");
public int ID;
public string Key;
public int Version;
public int VersionGroup;
public EditHistoryAuthor ModifiedBy;
public string ChangesString;
public List<EditHistoryChanges> Changes
{
get
{
var changes = new List<EditHistoryChanges>();
if (string.IsNullOrEmpty(ChangesString)) return changes;
//new scheme
Exception newSchemeException = null;
try
{
var jObject = JObject.Parse(ChangesString);
ServerVersion = jObject.Value<string>("serverVersion");
var jChanges = jObject.Value<JArray>("changes");
changes = jChanges.Children()
.Select(jChange =>
{
var jUser = jChange.Value<JObject>("user");
return new EditHistoryChanges(TenantUtil)
{
Date = jChange.Value<string>("created"),
@ -99,24 +93,24 @@ namespace ASC.Files.Core
Id = new Guid(jUser.Value<string>("id") ?? Guid.Empty.ToString()),
Name = jUser.Value<string>("name"),
},
};
})
.ToList();
return changes;
}
catch (Exception ex)
{
newSchemeException = ex;
}
//old scheme
//todo: delete
try
{
var jChanges = JArray.Parse(ChangesString);
changes = jChanges.Children<JObject>()
.Select(jChange =>
};
})
.ToList();
return changes;
}
catch (Exception ex)
{
newSchemeException = ex;
}
//old scheme
//todo: delete
try
{
var jChanges = JArray.Parse(ChangesString);
changes = jChanges.Children<JObject>()
.Select(jChange =>
new EditHistoryChanges(TenantUtil)
{
Date = jChange.Value<string>("date"),
@ -125,27 +119,26 @@ namespace ASC.Files.Core
Id = new Guid(jChange.Value<string>("userid") ?? Guid.Empty.ToString()),
Name = jChange.Value<string>("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;
}
}

View File

@ -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; }

View File

@ -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<T>)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<Guid>();
foreach (var email in mentionMessage.Emails)

View File

@ -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;

View File

@ -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;

View File

@ -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<DocuSignAccount> 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<Guid> Users { get; set; }
}

View File

@ -56,7 +56,7 @@ namespace ASC.Api.Documents
/// <summary>
/// </summary>
[DataMember(EmitDefaultValue = true, IsRequired = false)]
public int Version { get; set; }
public int? Version { get; set; }
/// <summary>
/// </summary>
@ -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;

View File

@ -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);
}
}
}
}

View File

@ -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);
}

View File

@ -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<string> Emails { get; set; }
[DataMember(Name = "message")]
public string Message { get; set; }
}
}

View File

@ -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;

View File

@ -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;
}

View File

@ -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>(T folderId, IList<string> relativePath)