public async Task UserReadAndWrite() { await LCUser.Login("hello", "world"); LCObject account = new LCObject("Account"); LCUser currentUser = await LCUser.GetCurrent(); LCACL acl = LCACL.CreateWithOwner(currentUser); account.ACL = acl; account["balance"] = 512; await account.Save(); Assert.IsTrue(acl.GetUserReadAccess(currentUser)); Assert.IsTrue(acl.GetUserWriteAccess(currentUser)); LCQuery <LCObject> query = new LCQuery <LCObject>("Account"); LCObject result = await query.Get(account.ObjectId); TestContext.WriteLine(result.ObjectId); Assert.NotNull(result.ObjectId); await LCUser.Logout(); result = await query.Get(account.ObjectId); Assert.IsNull(result); }
public async Task UserReadAndWrite() { await LCUser.Login(TestPhone, TestPhone); account = new Account(); LCUser currentUser = await LCUser.GetCurrent(); account.ACL = LCACL.CreateWithOwner(currentUser); account.Balance = 512; await account.Save(); Assert.IsTrue(account.ACL.GetUserReadAccess(currentUser)); Assert.IsTrue(account.ACL.GetUserWriteAccess(currentUser)); LCQuery <LCObject> query = new LCQuery <LCObject>("Account"); LCObject result = await query.Get(account.ObjectId); TestContext.WriteLine(result.ObjectId); Assert.NotNull(result.ObjectId); await LCUser.Logout(); try { await query.Get(account.ObjectId); } catch (LCException e) { Assert.AreEqual(e.Code, 403); } }