diff --git a/Storage/Storage.Test/ACLTest.cs b/Storage/Storage.Test/ACLTest.cs index 967da0c..11fa5df 100644 --- a/Storage/Storage.Test/ACLTest.cs +++ b/Storage/Storage.Test/ACLTest.cs @@ -1,5 +1,6 @@ using NUnit.Framework; using System.Threading.Tasks; +using System.Collections.ObjectModel; using LeanCloud; using LeanCloud.Storage; @@ -74,5 +75,16 @@ namespace Storage.Test { TestContext.WriteLine(account.ObjectId); Assert.NotNull(account.ObjectId); } + + [Test] + public async Task Serialization() { + LCQuery query = new LCQuery("Account") { + IncludeACL = true + }; + ReadOnlyCollection accounts = await query.Find(); + foreach (LCObject account in accounts) { + TestContext.WriteLine(account); + } + } } } diff --git a/Storage/Storage/Internal/Query/LCCompositionalCondition.cs b/Storage/Storage/Internal/Query/LCCompositionalCondition.cs index 426a904..7217927 100644 --- a/Storage/Storage/Internal/Query/LCCompositionalCondition.cs +++ b/Storage/Storage/Internal/Query/LCCompositionalCondition.cs @@ -24,6 +24,10 @@ namespace LeanCloud.Storage.Internal.Query { get; set; } + public bool IncludeACL { + get; set; + } + public LCCompositionalCondition(string composition = And) { this.composition = composition; Skip = 0; @@ -217,6 +221,9 @@ namespace LeanCloud.Storage.Internal.Query { if (selectedKeys != null && selectedKeys.Count > 0) { dict["keys"] = string.Join(",", selectedKeys); } + if (IncludeACL) { + dict["returnACL"] = "true"; + } return dict; } diff --git a/Storage/Storage/LCQuery.cs b/Storage/Storage/LCQuery.cs index 7d391d9..586a91d 100644 --- a/Storage/Storage/LCQuery.cs +++ b/Storage/Storage/LCQuery.cs @@ -333,6 +333,17 @@ namespace LeanCloud.Storage { return this; } + /// + /// 是否包含 ACL + /// + public bool IncludeACL { + get { + return Condition.IncludeACL; + } set { + Condition.IncludeACL = value; + } + } + /// /// 跳过 /// diff --git a/Storage/Storage/LCUser.cs b/Storage/Storage/LCUser.cs index 7a9cc6c..b86001b 100644 --- a/Storage/Storage/LCUser.cs +++ b/Storage/Storage/LCUser.cs @@ -49,13 +49,13 @@ namespace LeanCloud.Storage { public bool EmailVerified { get { - return (bool)this["emailVerified"]; + return Convert.ToBoolean(this["emailVerified"]); } } public bool MobileVerified { get { - return (bool)this["mobilePhoneVerified"]; + return Convert.ToBoolean(this["mobilePhoneVerified"]); } }