public async Task <bool> VerifyPermissionsAsync(ILLDbContext context, Guid portfolioId) { //For tenancy, property must belong to portfolio var hasProperty = await(from propertyDetails in context.PropertyDetails.AsNoTracking() join portfolio in context.Portfolios on propertyDetails.PortfolioId equals portfolio.Id where portfolio.Id == portfolioId select 1) .AnyAsync(); if (!hasProperty) { return(false); } return(true); }
public MustOwnPortfolioChecker(ILLDbContext context) { _context = context; }
public JourneysController(IJourneyDataProvider journeyDataProvider, ILLDbContext context) { _journeyDataProvider = journeyDataProvider; _context = context; }
public UserRepository(ILLDbContext context, ApplicationUserManager userManager, ApplicationRoleManager roleManager) { _context = context; _userManager = userManager; _roleManager = roleManager; }
public static async Task <bool> OwnsSupplierAsync(this Guid userId, Guid portfolioId, Guid supplierId, ILLDbContext context) { if (userId.IsDefault() || portfolioId.IsDefault() || supplierId.IsDefault() || context == null) { return(false); } return(await context.ApplicationUserPortfolios.AsNoTracking() .Join(context.Suppliers, aup => aup.PortfolioId, supplier => supplier.PortfolioId, (portfolio, supplier) => new { ApplicationUserPortfolio = portfolio, Supplier = supplier }) .Where(c => c.ApplicationUserPortfolio.UserId == userId && c.ApplicationUserPortfolio.PortfolioId == portfolioId && c.Supplier.Id == supplierId) .AnyAsync()); }
public MustOwnPropertyImageChecker(ILLDbContext context) { _context = context; }
public PropertyDetailsController(IPropertyDataProvider dataAccessProvider, ILLDbContext context) { _propertyDataProvider = dataAccessProvider; _context = context; }
public MustOwnSupplierChecker(ILLDbContext context) { _context = context; }
public static async Task <bool> OwnsPropertyDetailsAsync(this Guid userId, Guid propertyId, ILLDbContext context) { if (userId.IsDefault() || propertyId.IsDefault() || context == null) { return(false); } return(await context.PropertyDetails.Include(x => x.Portfolio.Users).AnyAsync(c => c.Portfolio.Users.Any(link => link.UserId == userId) && c.Id == propertyId)); }
public static async Task <bool> OwnsPropertyImageAsync(this Guid userId, Guid propertyImageId, ILLDbContext context) { if (userId.IsDefault() || propertyImageId.IsDefault() || context == null) { return(false); } return(await context.ApplicationUserPortfolios.Include(x => x.Portfolio.Users) .Where(aup => aup.Portfolio.Users.Any(link => link.UserId == userId)) .Join(context.PropertyDetails, aup => aup.PortfolioId, details => details.PortfolioId, (portfolio, details) => new { Portfolio = portfolio, PropertyDetails = details }) .Join(context.PropertyImages, arg => arg.PropertyDetails.Id, image => image.PropertyId, (details, image) => new { PropertyDetails = details, PropertyImage = image }) .AnyAsync(c => c.PropertyImage.Id == propertyImageId)); }
public static async Task <bool> OwnsChecklistAsync(this Guid portfolioId, Guid checklistId, ILLDbContext context) { if (portfolioId.IsDefault() || checklistId.IsDefault() || context == null) { return(false); } return(await context.ChecklistInstances.Where(c => c.PortfolioId == portfolioId && c.Id == checklistId).AnyAsync()); }
public MustOwnAccountChecker(ILLDbContext context) { _context = context; }
public static async Task <ApplicationUser> GetApplicationUserAsync(this ClaimsPrincipal claimsPrincipal, ILLDbContext context) { var userId = claimsPrincipal.GetUserId(); if (userId != default(Guid)) { return(await context.Users.FirstOrDefaultAsync(c => c.Id == userId)); } throw new InvalidOperationException("Unable to determine User"); }
public ConversationController(IConversationDataProvider conversationDataProvider, ILLDbContext context, NotificationsMessageHandler messageHandler) { _conversationDataProvider = conversationDataProvider; _context = context; _messageHandler = messageHandler; }
public static async Task <bool> OwnsPortfolioAsync(this Guid userId, Guid portfolioId, ILLDbContext context) { if (userId.IsDefault() || portfolioId.IsDefault() || context == null) { return(false); } return(await context.ApplicationUserPortfolios.AnyAsync(c => c.UserId == userId && c.PortfolioId == portfolioId)); }
public MustOwnPropertyDetailsChecker(ILLDbContext context) { _context = context; }
public static async Task <bool> OwnsAccountAsync(this Guid userId, Guid portfolioId, Guid accountId, ILLDbContext context) { if (userId.IsDefault() || portfolioId.IsDefault() || accountId.IsDefault() || context == null) { return(false); } return(await context.ApplicationUserPortfolios.AsNoTracking() .Join(context.Accounts, aup => aup.PortfolioId, account => account.PortfolioId, (portfolio, account) => new { ApplicationUserPortfolio = portfolio, Account = account }) .Where(c => c.ApplicationUserPortfolio.UserId == userId && c.ApplicationUserPortfolio.PortfolioId == portfolioId && c.Account.Id == accountId) .AnyAsync()); }
public TransactionsController(ITransactionsDataProvider transactionsDataProvider, ILLDbContext context) { _transactionsDataProvider = transactionsDataProvider; _context = context; }
public static async Task <bool> OwnsInvoiceAsync(this Guid userId, Guid portfolioId, Guid invoiceId, ILLDbContext context) { if (userId.IsDefault() || portfolioId.IsDefault() || invoiceId.IsDefault() || context == null) { return(false); } return(await context.ApplicationUserPortfolios.AsNoTracking() .Join(context.Invoices, aup => aup.PortfolioId, invoice => invoice.PortfolioId, (portfolio, invoice) => new { ApplicationUserPortfolio = portfolio, Invoice = invoice }) .Where(c => c.ApplicationUserPortfolio.UserId == userId && c.ApplicationUserPortfolio.PortfolioId == portfolioId && c.Invoice.Id == invoiceId) .AnyAsync()); }
public PropertyImageController(IPropertyImageDataProvider dataProvider, ILLDbContext context) { _dataProvider = dataProvider; _context = context; }
public MustOwnInvoiceChecker(ILLDbContext context) { _context = context; }