public void Execute()
        {
            logger.Info("Extract Users List in progress...");
            var         projectCollections = CatalogNodeBrowsingHelper.GetProjectCollections(configurationServer.CatalogNode);
            List <User> userList           = IdentityServiceManagementHelper.GetAllIdentities(configurationServer, projectCollections).ToList();

            // Now get the "ou" attribute from the Active Directory (so as to gets a user's Service)
            if (this.extractOUOption)
            {
                logger.Info("Fetch the ou property in the AD");
                Fetch_OU_ADProperty(userList);
            }

            string fileName = FileNameTool.GetFileName("TfsExtractUsersList");

            using (CsvWriter csv = new CsvWriter(new StreamWriter(fileName)))
            {
                csv.Configuration.RegisterClassMap <ProjectDefinitionCsvMap>();
                csv.WriteExcelSeparator();

                if (this.extractOUOption)
                {
                    csv.WriteRecords(userList.Where(x => !string.IsNullOrEmpty(x.OU) && !x.OU.StartsWith(Environment.GetEnvironmentVariable("LDAP_OU_FILTER_OUT"))).DistinctBy(x => x.OU).OrderBy(x => x.Name));
                }
                else
                {
                    csv.WriteRecords(userList.DistinctBy(x => x.Mail).OrderBy(x => x.Name));
                }
            }

            logger.Info("Extract Users done");
        }
예제 #2
0
        public ActionResult IdentityOverview()
        {
            IIdentityManagementService serverIdentityManagementService = configurationServer.GetService <IIdentityManagementService>();
            IdentityOverviewModel      iom = new IdentityOverviewModel();

            IdentityServiceManagementHelper.FeedIdentityData(iom.ApplicationGroupCollection, iom.UserCollection, serverIdentityManagementService, null);
            return(PartialView(iom));
        }
예제 #3
0
        // GET: DashboardView
        public ActionResult Index()
        {
            OrganizationalOverviewModel dashb = new OrganizationalOverviewModel()
            {
                ProjectCollectionCollection = CatalogNodeBrowsingHelper.GetProjectCollections(configurationServer.CatalogNode),
                ProjectCount = CatalogNodeBrowsingHelper.GetTeamProjects(configurationServer.CatalogNode, true).Count(),
                UserCount    = IdentityServiceManagementHelper.GetAllIdentityCount(configurationServer.GetService <IIdentityManagementService>())
            };

            return(View(dashb));
        }
        public ActionResult IdentityOverview(string id)
        {
            IdentityOverviewModel iom = new IdentityOverviewModel();

            if (!string.IsNullOrWhiteSpace(id))
            {
                TfsTeamProjectCollection   tpc = configurationServer.GetTeamProjectCollection(new Guid(id));
                IIdentityManagementService ims = tpc.GetService <IIdentityManagementService>();

                IdentityServiceManagementHelper.FeedIdentityData(iom.ApplicationGroupCollection, iom.UserCollection, ims, null);
            }
            return(PartialView(iom));
        }
예제 #5
0
        public ActionResult IdentityOverview(string id, string projectid)
        {
            if (string.IsNullOrEmpty(id) || string.IsNullOrEmpty(projectid))
            {
                return(RedirectToAction("Index"));
            }

            TfsTeamProjectCollection         tpc = configurationServer.GetTeamProjectCollection(new Guid(id));
            ReadOnlyCollection <CatalogNode> teamProjectNodes = tpc.CatalogNode.QueryChildren(
                new[] { CatalogResourceTypes.TeamProject }, new[] { new KeyValuePair <string, string>("ProjectID", projectid) },
                false, CatalogQueryOptions.None);
            IIdentityManagementService ims = tpc.GetService <IIdentityManagementService>();
            string projectUri;
            IdentityOverviewModel iom = new IdentityOverviewModel();

            if (teamProjectNodes.Count() == 1)
            {
                projectUri = teamProjectNodes[0].Resource.Properties["ProjectUri"];
                IdentityServiceManagementHelper.FeedIdentityData(iom.ApplicationGroupCollection, iom.UserCollection, ims, projectUri);
            }
            return(PartialView(iom));
        }