private void menuAddGroup_Click(object sender, EventArgs e) { var node = treeViewAdv1.SelectedNode.Tag as AclNode; if (node.Text == "Groups") { AddUserAndGroup dlg = new AddUserAndGroup(); dlg.SetGroups(Hdb.Instance.AclGroupNames()); // dlg.Username = node.Text; if (dlg.ShowDialog() == DialogResult.OK) { Hdb.Instance.AclAddUserAndGroup(dlg.Username, dlg.Group); node.Nodes.Add(CreateNode(dlg.Group, AclNodeType.GroupFolder)); } } }
private void menuAddUser_Click(object sender, EventArgs e) { var users = treeViewAdv1.SelectedNode.Tag as AclNode; AclNode group = users.Parent as AclNode; AddUserAndGroup dlg = new AddUserAndGroup(); dlg.SetGroups(Hdb.Instance.AclGroupNames()); dlg.Username = ""; if (group != null) { dlg.Group = group.Text; } if (dlg.ShowDialog() == DialogResult.OK) { Hdb.Instance.AclAddUserAndGroup(dlg.Username, dlg.Group); var usr = CreateNode(dlg.Username, AclNodeType.User); users.Nodes.Add(usr); } }