private IQueryable <Template> SecureQuery()
        {
            var currentUser = _userRepository.Find(User.Identity.GetUserId());

            if (currentUser == null)
            {
                return(null);
            }

            // access to organizations or user id
            var access = currentUser.Organizations;

            access.Add(currentUser.Id);

            return(_templateRepository
                   .All()
                   .Where(t => t.OrganizationId.In(access)));
        }
示例#2
0
 public async Task <IEnumerable <TemplateViewModel> > ListTemplates()
 {
     return(_mapper.Map <IEnumerable <TemplateViewModel> >(await _templateRepository.All()));
 }