Beispiel #1
0
        private async void button6_Click(object sender, EventArgs e)
        {
            List <string> grupy = new List <string>
            {
                "jira-users",
                "jira-restricted-users"
            };

            timer.Start();
            using (Authentication a = new Authentication())
            {
                AuthenticatedToken token = a.Authenticate();
                try
                {
                    SecurityServer s = a.securityServer;

                    List <string> JiraUsers       = new List <string>();
                    List <string> RestrictedUsers = new List <string>();
                    List <string> CommonUsers     = new List <string>();

                    SOAPGroup Jiragroup = await s.findGroup(token, grupy[0]);

                    SOAPGroup Restrictedgroup = await s.findGroup(token, grupy[1]);

                    JiraUsers.AddRange(Jiragroup.members.ToList());
                    RestrictedUsers.AddRange(Restrictedgroup.members.ToList());

                    CommonUsers = JiraUsers.FindAll(x => RestrictedUsers.Contains(x));

                    List <SOAPPrincipal> CommonPrincipals = new List <SOAPPrincipal>();
                    foreach (var user in CommonUsers)
                    {
                        SOAPPrincipal SOAPuser = await s.findPrincipalAsync(token, user);

                        if (SOAPuser.active)
                        {
                            CommonPrincipals.Add(SOAPuser);
                        }
                    }

                    MessageBox.Show(string.Join(" ", CommonPrincipals.Select(x => x.name)), timer.Elapsed.ToString());
                    timer.Reset();
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message);
                }
            }
        }
Beispiel #2
0
        private async void button5_Click(object sender, EventArgs e)
        {
            List <string> grupy = new List <string>
            {
                "jira-users",
                "jira-restricted-users",
                "confluence-users",
                "confluence-restricted-users",
                "stash-users"
            };

            timer.Start();
            using (Authentication a = new Authentication())
            {
                AuthenticatedToken token = a.Authenticate();
                try
                {
                    SecurityServer s = a.securityServer;

                    List <string> Allusers = await s.findAllPrincipalsAsync(token);

                    List <string> tempUsers = new List <string>();

                    foreach (string g in grupy)
                    {
                        SOAPGroup group = await s.findGroup(token, g);

                        foreach (var m in group.members)
                        {
                            Allusers.Remove(m);
                            this.Text = timer.Elapsed.ToString(@"mm\:ss\:ff");
                        }
                    }

                    tempUsers.AddRange(Allusers);

                    foreach (var u in tempUsers)
                    {
                        SOAPPrincipal SOAPuser = await s.findPrincipalAsync(token, u);

                        if (!SOAPuser.active)
                        {
                            Allusers.Remove(SOAPuser.name);
                            this.Text = timer.Elapsed.ToString(@"mm\:ss\:ff");
                        }
                    }

                    Allusers.Sort();

                    MessageBox.Show(string.Join(" ", Allusers), timer.Elapsed.ToString());
                    this.Text = "Form1";
                    timer.Reset();
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message);
                }
            }
        }