From 66e07a204128221385082f10e9b63647119813a2 Mon Sep 17 00:00:00 2001 From: oneRain Date: Wed, 27 May 2020 14:33:55 +0800 Subject: [PATCH] =?UTF-8?q?chore:=20=E9=81=BF=E5=85=8D=E5=BC=BA=E8=BD=AC?= =?UTF-8?q?=E7=A9=BA=E6=8C=87=E9=92=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Storage/Storage.Test/ACLTest.cs | 12 ++++++++++++ .../Internal/Query/LCCompositionalCondition.cs | 7 +++++++ Storage/Storage/LCQuery.cs | 11 +++++++++++ Storage/Storage/LCUser.cs | 4 ++-- 4 files changed, 32 insertions(+), 2 deletions(-) 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"]); } }