Ejemplo n.º 1
0
        private void deleteUserFromGroup_Click(object sender, RoutedEventArgs e)
        {
            string groupListToDelete = "";

            foreach (var group in UserGropsListBox.SelectedItems)
            {
                groupListToDelete += " '" + group.ToString() + "' ";
            }

            DialogBox DialogBox1 = new DialogBox();

            DialogBox1.Show("User '" + UserNameBox.Text + "' will be removed from the groups:" + groupListToDelete + ". Would you like to continue?");

            if (DialogBox1.DialogResult == true)
            {
                foreach (var group in UserGropsListBox.SelectedItems)
                {
                    getCredentials();
                    string      removeFromTheGroupURL = "/user/group/direct?username="******"&groupname=" + group.ToString();
                    getResponse retrive = new getResponse();
                    string      data    = "";
                    retrive.DELETE(serverURL + removeFromTheGroupURL, auth, out data);
                }
                getUserGroup();
                log("Remove User From Group - " + UserNameBox.Text + ". Result: user removed from the groups:" + groupListToDelete);
            }
        }
Ejemplo n.º 2
0
        private void copyGroupsButton_Click(object sender, RoutedEventArgs e)
        {
            List <string> diffGroups  = new List <string>();
            string        XmlDocument = "";

            foreach (string group in listBoxSearchUser.Items)
            {
                if (listBox1.Items.Contains(group) == false)
                {
                    diffGroups.Add(group);
                }
            }



            if (diffGroups.Count != 0)
            {
                DialogBox DialogBox1 = new DialogBox();
                DialogBox1.Show("Group/s will be added. Would you like to continue?");
                if (DialogBox1.DialogResult == true)

                {
                    foreach (string group in diffGroups)
                    {
                        string      url     = serverURL + "/group?groupname=" + group;
                        getResponse retrive = new getResponse();
                        string      data    = "";
                        retrive.GET(url, auth0, out data);

                        if (data == "")

                        {
                            string createGroupURL = "/group";
                            XmlDocument = "<group name = \"" + group + "\" expand=\"attributes\"><type>GROUP</type><description>" + group + "</description><active>true</active><attributes><link rel =\"self\" href = \"/group?groupname=" + group + "\" /></attributes></group>";
                            retrive     = new getResponse();
                            data        = "";
                            retrive.POST(serverURL + createGroupURL, XmlDocument, auth0, out data);
                            log("Create Group - " + group + " - Result: group successfully created");
                        }

                        string addToGroupURL = "/user/group/direct?username="******"<group name=\"" + group + "\"/>";
                        retrive     = new getResponse();
                        data        = "";
                        retrive.POST(serverURL + addToGroupURL + userUnderProcess, XmlDocument, auth0, out data);
                        log("Add to Group - " + userUnderProcess + " - Result: was successfully added to the '" + group + "' group");
                        listBox1.Items.Add(group);
                    }
                }
            }


            this.DialogResult = true;
        }
Ejemplo n.º 3
0
        private void deleteGroupButton_Click(object sender, RoutedEventArgs e)
        {
            if (existingGroupsComboBox.Text == "")
            {
                MessageBox1("Please, select group to delete first");
                return;
            }
            DialogBox DialogBox1 = new DialogBox();

            DialogBox1.Show("Group " + existingGroupsComboBox.Text + " will be deleted from the system. Would you like to continue?");
            if (DialogBox1.DialogResult == true)
            {
                getCredentials();
                string      urlGroupSearch = serverURL + "/group?groupname=" + existingGroupsComboBox.Text;
                getResponse retrive        = new getResponse();
                string      groupList      = "";
                retrive.DELETE(urlGroupSearch, auth, out groupList);
                MessageBox1(existingGroupsComboBox.Text + " group successfully deleted");
                GroupsTab();
                log("Delete Group - " + existingGroupsComboBox.Text + ". Result: group successfully deleted");
            }
        }
Ejemplo n.º 4
0
        private void DeleteUserButton_Click(object sender, RoutedEventArgs e)
        {
            if (UserNameBox.Text == "")
            {
                MessageBox1("'User Name' field is empty");
                return;
            }

            DialogBox DialogBox1 = new DialogBox();

            DialogBox1.Show("User '" + UserNameBox.Text + "' will be deleted from the system. Would you like to continue?");

            if (DialogBox1.DialogResult == true)
            {
                getCredentials();

                string      removeUserURL = "/user?username="******"";
                retrive.DELETE(serverURL + removeUserURL, auth, out data);
                MessageBox1("User '" + UserNameBox.Text + "' was successfully removed from the system");
                log("Delete User - " + UserNameBox.Text + " - Result: successfully removed from the system");
            }
        }
        private void recreateButton_Click(object sender, RoutedEventArgs e)
        {
            newDomain = targetDomainComboBox.Text;
            getCredentials(domain);

            if (userNameLabel.Content.ToString() == "")
            {
                MessageBox1("'User Name' field is empty");
                return;
            }

            DialogBox DialogBox1 = new DialogBox();

            DialogBox1.Show("User '" + userName + "' will be recreated in " + targetDomainComboBox.Text + " derictory. Would you like to continue?");

            if (DialogBox1.DialogResult == true)
            {
                string      removeUserURL = "/user?username="******"";

                retrive.DELETE(serverURL + removeUserURL, auth, out data);

                getCredentials(newDomain);

                try
                {
                    //create

                    string pass        = "******" + DateTime.Now.Millisecond.ToString() + "Epam";
                    string url         = serverURL + "/user";
                    string XmlDocument = "<user name=\"" + userName + "\" expand=\"attributes\"><first-name>" + firstName + "</first-name><last-name>" + lastName + "</last-name><display-name>" + firstName + " " + lastName + "</display-name><email>" + email + "</email><active>true</active><attributes><link rel=\"self\" href=\"/user/attribute?username="******"\"/></attributes><password><link rel=\"edit\" href=\"/user/password?username="******"\"/><value>" + pass + "</value></password></user>";
                    retrive = new getResponse();
                    data    = "";
                    retrive.POST(url, XmlDocument, auth, out data);
                    //set group

                    foreach (string group in userGroupsList)
                    {
                        string addToGroupURL = "/user/group/direct?username="******"<group name=\"" + group + "\"/>";
                        retrive     = new getResponse();
                        data        = "";
                        retrive.POST(serverURL + addToGroupURL + userName, XmlDocument, auth, out data);
                    }

                    sendPassword();
                    MessageBox1(userNameLabel.Content + " was successfully recreated in " + targetDomainComboBox.Text + " directory");
                    this.DialogResult = true;
                    log("Recreate - " + userNameLabel.Content + " was successfully recreated in " + targetDomainComboBox.Text + " directory");
                    Close();
                }



                catch
                (Exception ex)
                {
                    MessageBox1(ex.Message);
                }
            }
        }