public async Task UserControllerFilter() { var data = new FakeApiDataResultHandler <Tenant, TenantDisplay>(); var list = new List <TenantDisplay> { TenantData.GetFirstDisplay() }; var filter = new TenantFilter { TenantRestrict = true }; data.Result.Setup(m => m.Execute(It.IsAny <TenantDisplayByFilter>())).Returns(list); var controller = new TenantController(data, Logic) { CurrentUser = SuperUser }; var result = await controller.Filter(filter) as OkObjectResult; result.Should().NotBeNull(); result.Should().BeOfType <OkObjectResult>(); result.Value.Should().NotBeNull(); var check = result.Value as PagedResult <IEnumerable <TenantDisplay> >; check.Should().NotBeNull(); check.Data.Count().Should().Be(list.Count); Assert.That(check.Data, Is.DeepEqualTo(list)); data.HasExecuted.Should().BeTrue(); data.Result.Verify(s => s.Execute(It.IsAny <TenantDisplayByFilter>()), Times.Once()); }
public async Task <IActionResult> Filter([FromBody] TenantFilter viewModel) { if (CurrentUser.Right.CanSuperuser) { var query = new TenantDisplayByFilter { Filter = viewModel, CurrentUser = CurrentUser }; await DataHandler.Execute(query); return(Ok(new PagedResult <IEnumerable <TenantDisplay> > { Data = Secure(query.Result), Paging = query.Paging, Success = true })); } return(Unauthorized()); }
public async Task TenantDisplayByFilterDataTestSearch() { var filter = new TenantFilter { Search = "Org", Take = 10 }; using var store = GetDocumentStore(); using var session = store.OpenAsyncSession(); var query = new TenantDisplayByFilter { Session = session, Filter = filter, CurrentUser = StandardUser }; await query.Execute(); query.Result.Should().NotBeNull(); query.Result.Count().Should().Be(1); Assert.That(query.Result.First(), Is.DeepEqualTo(TenantData.GetFirstDisplay())); }
public async Task UserControllerFilterUnauth() { var data = new FakeApiDataResultHandler <Tenant, TenantDisplay>(); var list = new List <TenantDisplay> { TenantData.GetFirstDisplay() }; var filter = new TenantFilter { TenantRestrict = true }; data.Result.Setup(m => m.Execute(It.IsAny <TenantDisplayByFilter>())).Returns(list); var controller = new TenantController(data, Logic) { CurrentUser = StandardUser }; var result = await controller.Filter(filter) as UnauthorizedResult; result.Should().NotBeNull(); result.Should().BeOfType <UnauthorizedResult>(); data.HasExecuted.Should().BeFalse(); data.Result.Verify(s => s.Execute(It.IsAny <TenantDisplayByFilter>()), Times.Never()); }
public Expression <Func <Contract, bool> > OnQueryContracts() { return(TenantFilter.BuildFilter <Contract>()); }
public Expression <Func <Party, bool> > OnQueryParties() { return(TenantFilter.BuildFilter <Party>()); }
public Expression <Func <AccountingEntity, bool> > OnQueryAccountingEntities() { return(TenantFilter.BuildFilter <AccountingEntity>()); }
public Expression <Func <JournalTemplateInput, bool> > OnQueryUserInput() { return(TenantFilter.BuildFilter <JournalTemplateInput>()); }
public Expression <Func <ScheduledJournalInputValue, bool> > OnQueryUserInputValue() { return(TenantFilter.BuildFilter <ScheduledJournalInputValue>()); }
public Expression <Func <ScheduledJournal, bool> > OnQueryScheduledJournal() { return(TenantFilter.BuildFilter <ScheduledJournal>()); }
public Expression <Func <SequenceNumber, bool> > OnQuerySequenceNumber() { return(TenantFilter.BuildFilter <SequenceNumber>()); }
public Expression <Func <Employment, bool> > OnQueryEmployments() { return(TenantFilter.BuildFilter <Employment>()); }
public async Task <List <Tenant> > Collection(TenantFilter filter) { throw new NotImplementedException(); }
public Expression <Func <LedgerTxn, bool> > OnQueryLedgerTxn() { return(TenantFilter.BuildFilter <LedgerTxn>()); }
public Expression <Func <WorkItemAttachment, bool> > OnQueryWorkItemAttachment() { return(TenantFilter.BuildFilter <WorkItemAttachment>()); }
public Expression <Func <WorkItem, bool> > OnQueryWorkItem() { return(TenantFilter.BuildFilter <WorkItem>()); }
public Expression <Func <DocumentContent, bool> > OnQueryDocumentContent() { return(TenantFilter.BuildFilter <DocumentContent>()); }
public Expression <Func <ProviderAccountParticipant, bool> > OnQueryProviderAccountParticipant() { return(TenantFilter.BuildFilter <ProviderAccountParticipant>()); }
public Expression <Func <Journal, bool> > OnQueryJournals() { return(TenantFilter.BuildFilter <Journal>()); }
public Expression <Func <JournalTemplateTxn, bool> > OnQueryJournalTemplateTxn() { return(TenantFilter.BuildFilter <JournalTemplateTxn>()); }