private void frmSecurityOverView_Load(object sender, EventArgs e) { treeListView1.Columns[0].Text = SynapseForm.GetLabel("frmSecurityOverView.olvc_GROUP"); treeListView1.Columns[1].Text = SynapseForm.GetLabel("frmSecurityOverView.olvc_VISIBLE"); treeListView1.Columns[2].Text = SynapseForm.GetLabel("frmSecurityOverView.olvc_ACTIVE"); treeListView1.Columns[3].Text = SynapseForm.GetLabel("frmSecurityOverView.olvc_Text"); treeListView1.Columns[4].Text = SynapseForm.GetLabel("frmSecurityOverView.olvc_Comment"); ModuleCollection = SynapseModule.Load(); myControls = (from c in ControlSecurityOverview.Load() where c.GROUP != "Everybody" select c).ToList(); myProfiles = SynapseProfile.Load(); myModules = SynapseModule.Load(); fillModules(); foreach (SynapseModule mod in myModules) { HashMod.Add(mod.TECHNICALNAME, mod.ID); } List <E_module> modules = new List <E_module>(); foreach (string str in (from m in myControls select m.MODULE).Distinct()) { modules.Add((E_module)str); } treeListView1.SetObjects(modules); }
private void RefreshTreeview() { treeListView1.ClearObjects(); if (onlyControlsWithSecurityToolStripMenuItem.Checked) { myControls = (from c in ControlSecurityOverview.Load() where c.GROUP != "Everybody" select c).ToList(); //treeListView1.ClearObjects(); //List<E_module> modules = new List<E_module>(); //foreach (string str in (from m in myControls select m.MODULE).Distinct()) //{ // modules.Add((E_module)str); //} //treeListView1.SetObjects(modules); } else { myControls = ControlSecurityOverview.Load(); //treeListView1.ClearObjects(); //List<E_module> modules = new List<E_module>(); //foreach (string str in (from m in myControls select m.MODULE).Distinct()) //{ // modules.Add((E_module)str); //} //treeListView1.SetObjects(modules); } List <E_module> modules = new List <E_module>(); if (cbModules.SelectedIndex > 0) { foreach (string str in (from m in myControls where m.MODULEID == ((SynapseModule)cbModules.SelectedItem).ID select m.MODULE).Distinct()) { modules.Add((E_module)str); } } else { foreach (string str in (from m in myControls select m.MODULE).Distinct()) { modules.Add((E_module)str); } } treeListView1.SetObjects(modules); if (isExpanded) { treeListView1.ExpandAll(); } }
public frmSecurityOverView() { resourceManager = ResourceManager.CreateFileBasedResourceManager("formLabels", Application.StartupPath + @"/AllSynapseResources", null); InitializeComponent(); //olvc_Module.AspectGetter = delegate(object x) //{ // if (x is string) // return x.ToString(); // else // return x; //}; olvc_Comment.AspectToStringConverter = delegate(object x) { if (x is string && !x.ToString().Contains("is not a parameter-less method, property or field")) { return(x.ToString()); } else { return(string.Empty); } }; olvc_GROUP.ImageGetter = delegate(object x) { if (x is E_module) { return("module"); } if (x is E_form) { return("form"); } if (x is E_ctrl) { return("control"); } if (x is ControlSecurityOverview) { return("group"); } return(""); }; olvc_Text.AspectGetter = delegate(object x) { if (x is E_ctrl) { E_ctrl Ctrl = (E_ctrl)x; return(SynapseCore.Security.Tools.GetLabel(ref resourceManager, Ctrl.form + "." + Ctrl.ctrl, false)); } else { return(string.Empty); } }; treeListView1.CanExpandGetter = delegate(object x) { if (x is ControlSecurityOverview) { return(false); } else { return(true); } }; treeListView1.ChildrenGetter = delegate(object x) { if (x is E_module) { E_module currentModule = (E_module)x; List <E_form> forms = new List <E_form>(); foreach (string str in (from m in myControls where m.MODULE == currentModule.GROUP select m.FORM).Distinct()) { forms.Add(new E_form(str, currentModule.GROUP)); } return(forms); } if (x is E_form) { E_form currentForm = (E_form)x; List <E_type> types = new List <E_type>(); foreach (string str in (from m in myControls where m.MODULE == currentForm.module && m.FORM == currentForm.form select m.TYPE).Distinct()) { types.Add(new E_type(str, currentForm.form, currentForm.module)); } return(types); } if (x is E_type) { E_type currentType = (E_type)x; List <E_ctrl> ctrls = new List <E_ctrl>(); foreach (string str in (from m in myControls where m.MODULE == currentType.module && m.FORM == currentType.form && m.TYPE == currentType.type select m.CONTROL).Distinct()) { ctrls.Add(new E_ctrl(str, currentType.type, currentType.form, currentType.module)); } return(ctrls); } if (x is E_ctrl) { E_ctrl currentCtrl = (E_ctrl)x; IList <ControlSecurityOverview> groups = (from c in myControls where c.MODULE == currentCtrl.module && c.FORM == currentCtrl.form && c.TYPE == currentCtrl.type && c.CONTROL == currentCtrl.ctrl select c).Distinct().ToList(); bool containsEverybody = false; if ((from xg in groups where xg.GROUP == "Everybody" select xg).ToList().Count >= 1) { containsEverybody = true; } if (showImplicitGroupsToolStripMenuItem.Checked) { foreach (SynapseProfile profile in (from p in myProfiles where p.FK_ModuleID == (Int64)HashMod[currentCtrl.module] select p)) { if ((from g in groups where g.GROUP == profile.TECHNICALNAME select g).ToList().Count == 0) { ControlSecurityOverview cso = new ControlSecurityOverview(); cso.GROUP = profile.TECHNICALNAME; if (!containsEverybody) { cso.ACTIVE = false; cso.VISIBLE = false; cso.Comment = "Implicit"; } else { cso.ACTIVE = true; cso.VISIBLE = true; cso.Comment = "Implicit as everybody"; } groups.Add(cso); } } } return(groups); } return(null); }; olvc_ACTIVE.Renderer = new MappedImageRenderer(true, imageList1.Images["true"], false, imageList1.Images["false"]); olvc_VISIBLE.Renderer = new MappedImageRenderer(true, imageList1.Images["true"], false, imageList1.Images["false"]); }