// Holy crap that looks awful, this needs reworked later on #region Impersonate button private void toolStripSplitButton1_ButtonClick(object sender, EventArgs e) { if (userCredentials.Key != null && userCredentials.Value != null) { isImpersonating = !isImpersonating; try { if (isImpersonating) { impersonatedUser = new Impersonator(userCredentials.Key.ToString(), userCredentials.Value.ToString()); impersonatedUser.Impersonate(); toolStripSplitButton1.BackColor = Color.LightGreen; statusMessage.Text = "Impersonating user: "******"Ended impersonation of user: "******"Invalid username or password"; } } else { ShowImpersonateDialog(); } }
private void permissionsButton_Click(object sender, EventArgs e) { // Impersonates the specific user and reports back with permissions // If left blank then it uses the current user var test = new AdminShareTest(); try { if (textBox1.Text != String.Empty && textBox2.Text != String.Empty) { Impersonator user = new Impersonator(textBox1.Text, textBox2.Text); user.Impersonate(); test.DiscoverPermissions(comboBox1.Text); user.EndImpersonating(); } else { test.DiscoverPermissions(comboBox1.Text); } permissions.Text = test.report; } catch { permissions.Text = "Incorrect username or password"; } }
private void toolStripSplitButton1_ButtonClick(object sender, EventArgs e) { if (userCredentials.Key != null && userCredentials.Value != null) { isImpersonating = !isImpersonating; try { if (isImpersonating) { impersonatedUser = new Impersonator(userCredentials.Key.ToString(), userCredentials.Value.ToString()); impersonatedUser.Impersonate(); toolStripSplitButton1.BackColor = Color.LightGreen; statusMessage.Text = "Impersonating user: "******"Ended impersonation of user: "******"Invalid username or password"; } } else { ShowImpersonateDialog(); } }