private void btnMembersAddWindowsUsersAndGroups_Click(object sender, EventArgs e) { try { this.HourGlass(true); ADObject[] res = DirectoryServicesUtils.ADObjectPickerShowDialog(this, this.applicationGroup.Application.Store.Storage.Mode == NetSqlAzManMode.Developer); /*Application.DoEvents();*/ if (res != null) { foreach (ADObject o in res) { if (!this.MembersToRemove.Remove(o.Sid) && !this.FindMember(this.applicationGroup.GetApplicationGroupMembers(), o.Sid) && !this.FindMember(this.MembersToAdd, o.Sid)) { WhereDefined wd = WhereDefined.LDAP; if (!o.ADSPath.StartsWith("LDAP")) { wd = WhereDefined.Local; } this.MembersToAdd.Add(new GenericMember(o.Name, new SqlAzManSID(o.Sid), wd)); this.modified = true; } } this.RefreshApplicationGroupProperties(); } this.HourGlass(false); } catch (Exception ex) { this.HourGlass(false); MessageBox.Show(ex.Message); } }
private void btnBrowseWindowsUser_Click(object sender, EventArgs e) { string userName = String.Empty; try { this.rbWindowsUser.Checked = true; ADObject[] res = DirectoryServicesUtils.ADObjectPickerShowDialog(this, false, true, false); /*Application.DoEvents();*/ if (res != null) { if (res.Length > 1) { this.ShowError(Globalization.MultilanguageResource.GetString("frmCheckAccessTest_Msg20"), Globalization.MultilanguageResource.GetString("frmCheckAccessTest_Msg10")); } if (res.Length == 1) { userName = res[0].UPN; this.wid = new WindowsIdentity(userName); this.txtWindowsUser.Text = userName; this.dbuser = null; } } } catch (Exception ex) { this.ShowError(ex.Message, Globalization.MultilanguageResource.GetString("frmCheckAccessTest_Msg10")); } finally { this.FormValidate(); } }
private void btnAddWindowsUsersAndGroups_Click(object sender, EventArgs e) { try { this.HourGlass(true); ADObject[] res = DirectoryServicesUtils.ADObjectPickerShowDialog(this, this.item.Application.Store.Storage.Mode == NetSqlAzManMode.Developer); /*Application.DoEvents();*/ if (res != null) { List <DataRow> rowsAdded = new List <DataRow>(); foreach (ADObject o in res) { WhereDefined wd = WhereDefined.LDAP; if (!o.ADSPath.StartsWith("LDAP")) { wd = WhereDefined.Local; } string displayName; bool isAGroup; bool isLocal; DirectoryServicesUtils.GetMemberInfo(o.Sid, out displayName, out isAGroup, out isLocal); GenericMember gm = new GenericMember(new SqlAzManSID(o.Sid), wd, AuthorizationType.Neutral, null, null); gm.Name = displayName; rowsAdded.Add(this.AddLDapDataRow(gm, isAGroup)); this.modified = true; } this.SelectDataGridViewRows(rowsAdded); } this.btnApply.Enabled = this.modified; //Adjust columns Width foreach (DataGridViewColumn dgvc in this.dgAuthorizations.Columns) { dgvc.Width = dgvc.GetPreferredWidth(DataGridViewAutoSizeColumnMode.AllCells, true); } this.HourGlass(false); } catch (Exception ex) { this.HourGlass(false); this.ShowError(ex.Message, Globalization.MultilanguageResource.GetString("frmItemAuthorizations_Msg10")); } finally { this.btnApply.Enabled = this.modified; } }
private void btnNonMembersAddWindowsUsersAndGroup_Click(object sender, EventArgs e) { this.HourGlass(true); ADObject[] res = DirectoryServicesUtils.ADObjectPickerShowDialog(this, this.storeGroup.Store.Storage.Mode == NetSqlAzManMode.Developer); if (res != null) { foreach (ADObject o in res) { if (!this.NonMembersToRemove.Remove(o.Sid) && !this.FindMember(this.storeGroup.GetStoreGroupNonMembers(), new SqlAzManSID(o.Sid)) && !this.FindMember(this.NonMembersToAdd, new SqlAzManSID(o.Sid))) { WhereDefined wd = WhereDefined.LDAP; if (!o.ADSPath.StartsWith("LDAP")) { wd = WhereDefined.Local; } this.NonMembersToAdd.Add(new GenericMember(o.Name, new SqlAzManSID(o.Sid), wd)); this.modified = true; } } this.RefreshStoreGroupProperties(); } this.HourGlass(false); }