public async Task Query() { LCQuery <LCRole> query = LCRole.GetQuery(); List <LCRole> list = await query.Find(); list.ForEach(item => { TestContext.WriteLine($"{item.ObjectId} : {item.Name}"); Assert.NotNull(item.ObjectId); Assert.NotNull(item.Name); TestContext.WriteLine(item.Roles.GetType()); TestContext.WriteLine(item.Users.GetType()); Assert.IsTrue(item.Roles is LCRelation <LCRole>); Assert.IsTrue(item.Users is LCRelation <LCUser>); }); }
public async Task Query() { LCQuery <LCRole> query = LCRole.GetQuery(); ReadOnlyCollection <LCRole> results = await query.Find(); foreach (LCRole item in results) { TestContext.WriteLine($"{item.ObjectId} : {item.Name}"); Assert.NotNull(item.ObjectId); Assert.NotNull(item.Name); TestContext.WriteLine(item.Roles.GetType()); TestContext.WriteLine(item.Users.GetType()); Assert.IsTrue(item.Roles is LCRelation <LCRole>); Assert.IsTrue(item.Users is LCRelation <LCUser>); } }
public async Task RoleReadAndWrite() { LCQuery <LCRole> query = LCRole.GetQuery(); LCRole owner = await query.Get("5e1440cbfc36ed006add1b8d"); LCObject account = new LCObject("Account"); LCACL acl = new LCACL(); acl.SetRoleReadAccess(owner, true); acl.SetRoleWriteAccess(owner, true); account.ACL = acl; await account.Save(); Assert.IsTrue(acl.GetRoleReadAccess(owner)); Assert.IsTrue(acl.GetRoleWriteAccess(owner)); }