public async Task <bool> ToWrite(Guid userId, Guid applicationId)
        {
            var userApplications = unitOfWork.Repository <Domain.UserApplication, int>();

            var spec        = ApplicationSpecifications.UserApplicationWithPermissions(userId, Domain.ApplicationPermissions.Admin).And(ApplicationSpecifications.UserApplicationById(applicationId));
            var application = await userApplications.FirstOrDefaultAsync(spec);

            return(application != null);
        }
Exemplo n.º 2
0
        public async Task <IEnumerable <Domain.Application> > ApplicationsWithPermissions()
        {
            var userId = authService.CurrentUserId();

            var userApplications            = unitOfWork.Repository <Domain.UserApplication, int>();
            var myApplicationsSpecification = ApplicationSpecifications.UserApplicationWithPermissions(userId, Domain.ApplicationPermissions.Read);
            var applications = await userApplications.GetAsync(myApplicationsSpecification, "Application");

            return(applications.Select(a => a.Application));
        }