Пример #1
0
 private IEnumerable <RepositoryDetailModel> GetIndexModel()
 {
     if (User.IsInRole(Definitions.Roles.Administrator))
     {
         return(ConvertRepositoryModels(RepositoryRepository.GetAllRepositories()));
     }
     else
     {
         var userTeams    = TeamRepository.GetTeams(User.Identity.Name).Select(i => i.Name).ToArray();
         var repositories = ConvertRepositoryModels(RepositoryRepository.GetPermittedRepositories(User.Identity.Name, userTeams));
         return(repositories);
     }
 }
Пример #2
0
        private IEnumerable <RepositoryDetailModel> GetIndexModel()
        {
            IEnumerable <RepositoryModel> repositoryModels;

            if (User.IsInRole(Definitions.Roles.Administrator))
            {
                repositoryModels = RepositoryRepository.GetAllRepositories();
            }
            else
            {
                var userTeams = TeamRepository.GetTeams(User.Id()).Select(i => i.Id).ToArray();
                repositoryModels = RepositoryRepository.GetPermittedRepositories(User.Id(), userTeams);
            }
            return(repositoryModels.Select(ConvertRepositoryModel).ToList());
        }