private TeamDetailModel ConvertTeamModel(TeamModel model) { return(model == null ? null : new TeamDetailModel { Name = model.Name, Description = model.Description, Members = model.Members, Repositories = RepositoryRepository.GetPermittedRepositories(null, new[] { model.Name }).Select(x => x.Name).ToArray(), IsReadOnly = MembershipService.IsReadOnly() }); }
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); } }
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()); }