public override bool Equals(object obj) { if (obj == null) { return(false); } if (obj is Grant other) { if (Permission.Equals(other.Permission) && Grantee.Equals(other.Grantee)) { return(true); } } return(false); }
private void buttonAdd_Click(object sender, EventArgs e) { using (var form = new SecurityAddForm()) { if (form.ShowDialog() == DialogResult.OK) { var grantee = new Grantee(form.UserEmailOrId.Contains('@') ? GranteeType.Email : GranteeType.User, form.UserEmailOrId); foreach (DataGridViewRow row in dataGridViewACL.Rows) { if (grantee.Equals(row.Cells[1].Value)) { row.Selected = true; return; } } accessControlList.AddGrant(grantee, Permission.Default); SetACL(accessControlList); dataGridViewACL.Rows[dataGridViewACL.RowCount - 1].Selected = true; OnACLChanged(); } } }