Ejemplo n.º 1
0
        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());
        }
Ejemplo n.º 2
0
        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());
        }
Ejemplo n.º 3
0
        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()));
        }
Ejemplo n.º 4
0
        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());
        }
Ejemplo n.º 5
0
 public Expression <Func <Contract, bool> > OnQueryContracts()
 {
     return(TenantFilter.BuildFilter <Contract>());
 }
Ejemplo n.º 6
0
 public Expression <Func <Party, bool> > OnQueryParties()
 {
     return(TenantFilter.BuildFilter <Party>());
 }
Ejemplo n.º 7
0
 public Expression <Func <AccountingEntity, bool> > OnQueryAccountingEntities()
 {
     return(TenantFilter.BuildFilter <AccountingEntity>());
 }
Ejemplo n.º 8
0
 public Expression <Func <JournalTemplateInput, bool> > OnQueryUserInput()
 {
     return(TenantFilter.BuildFilter <JournalTemplateInput>());
 }
Ejemplo n.º 9
0
 public Expression <Func <ScheduledJournalInputValue, bool> > OnQueryUserInputValue()
 {
     return(TenantFilter.BuildFilter <ScheduledJournalInputValue>());
 }
Ejemplo n.º 10
0
 public Expression <Func <ScheduledJournal, bool> > OnQueryScheduledJournal()
 {
     return(TenantFilter.BuildFilter <ScheduledJournal>());
 }
Ejemplo n.º 11
0
 public Expression <Func <SequenceNumber, bool> > OnQuerySequenceNumber()
 {
     return(TenantFilter.BuildFilter <SequenceNumber>());
 }
Ejemplo n.º 12
0
 public Expression <Func <Employment, bool> > OnQueryEmployments()
 {
     return(TenantFilter.BuildFilter <Employment>());
 }
Ejemplo n.º 13
0
 public async Task <List <Tenant> > Collection(TenantFilter filter)
 {
     throw new NotImplementedException();
 }
Ejemplo n.º 14
0
 public Expression <Func <LedgerTxn, bool> > OnQueryLedgerTxn()
 {
     return(TenantFilter.BuildFilter <LedgerTxn>());
 }
Ejemplo n.º 15
0
 public Expression <Func <WorkItemAttachment, bool> > OnQueryWorkItemAttachment()
 {
     return(TenantFilter.BuildFilter <WorkItemAttachment>());
 }
Ejemplo n.º 16
0
 public Expression <Func <WorkItem, bool> > OnQueryWorkItem()
 {
     return(TenantFilter.BuildFilter <WorkItem>());
 }
Ejemplo n.º 17
0
 public Expression <Func <DocumentContent, bool> > OnQueryDocumentContent()
 {
     return(TenantFilter.BuildFilter <DocumentContent>());
 }
Ejemplo n.º 18
0
 public Expression <Func <ProviderAccountParticipant, bool> > OnQueryProviderAccountParticipant()
 {
     return(TenantFilter.BuildFilter <ProviderAccountParticipant>());
 }
Ejemplo n.º 19
0
 public Expression <Func <Journal, bool> > OnQueryJournals()
 {
     return(TenantFilter.BuildFilter <Journal>());
 }
Ejemplo n.º 20
0
 public Expression <Func <JournalTemplateTxn, bool> > OnQueryJournalTemplateTxn()
 {
     return(TenantFilter.BuildFilter <JournalTemplateTxn>());
 }