コード例 #1
0
        //void ToolStripButton1Click(object sender, EventArgs e)
        //{
        //    foreach (SynapseProfile_Control spc in objectListView1.Objects)
        //    {
        //        spc.save();
        //    }
        //    ComboBox1SelectedIndexChanged(this,e);
        //}

        void ComboBox3SelectedIndexChanged(object sender, EventArgs e)
        {
            cb_Form.Text = "";
            cb_Form.Items.Clear();
            foreach (SynapseControl C in AllControls)
            {
                if (!cb_Form.Items.Contains(C.FORM_NAME) && C.FK_MODULE_ID == ((SynapseModule)cb_Module.SelectedItem).ID)
                {
                    cb_Form.Items.Add(C.FORM_NAME);
                }
            }
            if (cb_Form.Items.Count > 0)
            {
                cb_Form.SelectedIndex = 0;
            }

            var ControlCollection = SynapseControl.Load("WHERE FORM_NAME='" + cb_Form.SelectedItem + "' AND FK_MODULE_ID=" + ((SynapseModule)cb_Module.SelectedItem).ID + " Order by CTRL_NAME");

            lst_ListOfControl.DataSource = ControlCollection.OrderBy(x => x.CTRL_NAME).ToList();

            var Groups = SynapseProfile.Load("WHERE FK_MODULEID=" + ((SynapseModule)cb_Module.SelectedItem).ID);

            cb_Profiles.DataSource    = Groups.OrderBy(x => x.TECHNICALNAME).ToList();
            cb_Profiles.DisplayMember = "TECHNICALNAME";
            cb_Profiles.ValueMember   = "ID";
            cb_Profiles.SelectedIndex = 0;
        }
コード例 #2
0
        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);
        }
コード例 #3
0
        private void NewGroup_Click(object sender, EventArgs e)
        {
            frmGroup fGroup = new frmGroup();

            fGroup.Action  = "NEW";
            fGroup.Profile = new SynapseProfile();
            if (fGroup.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                SynapseProfile _profile = fGroup.Profile;
                olvGroups.AddObject(_profile);
                olvGroups2.AddObject(_profile);

                switch (tabControl1.SelectedIndex)
                {
                case 0:
                    olvGroups.SelectedObject = _profile;
                    break;

                case 1:
                    olvGroups2.SelectedObject = _profile;
                    break;
                }
                AllProfileCollection = SynapseProfile.Load();
            }
        }
コード例 #4
0
ファイル: frmAccessTree.cs プロジェクト: WFR79/EngieEducation
        public override void initForm(SynapseCore.Security.Tools.SecureAndTranslateMode Mode)
        {
            base.initForm(Mode);

            ModuleCollection     = SynapseModule.Load();
            AllUserCollection    = SynapseUser.Load();
            AllProfileCollection = SynapseProfile.Load();
            initTree();
        }
コード例 #5
0
ファイル: frm_DataMig.cs プロジェクト: WFR79/EngieEducation
        private void btn_SyncAcc_Click(object sender, EventArgs e)
        {
            SynapseModule             mod = SynapseModule.LoadByID((long)comboBox1.SelectedValue);
            IList <ACCSynapseProfile> Ap  = ACCSynapseProfile.Load("WHERE FK_MODULEID = " + mod.ID);
            IList <SynapseProfile>    Pp  = SynapseProfile.Load("WHERE FK_MODULEID = " + mod.ID);

            if (Ap.Count != Pp.Count)
            {
                MessageBox.Show("ERROR : Sync before");
                return;
            }
            IList <ACCTOPRD> links = ACCTOPRD.Load("WHERE OBJECTTYPE = 'ACCSynapseProfile'");

            foreach (ACCSynapseProfile aprof in Ap)
            {
                if (links.Where(l => l.ACCID == aprof.ID).Count() == 0)
                {
                    ACCTOPRD atop = new ACCTOPRD();
                    atop.ACCID      = aprof.ID;
                    atop.PRDID      = Pp.Where(p => p.TECHNICALNAME == aprof.TECHNICALNAME).FirstOrDefault().ID;
                    atop.OBJECTTYPE = typeof(ACCSynapseProfile).Name;
                    if (atop.ACCID != 0 && atop.PRDID != 0)
                    {
                        atop.save();
                    }
                }
            }
            links = ACCTOPRD.Load("WHERE OBJECTTYPE = 'ACCSynapseProfile'");
            foreach (ACCSynapseUser u in olv_ACCUSERS.CheckedObjects)
            {
                SynapseUser pu = SynapseUser.LoadByUserID(u.UserID);
                IList <ACCSynapseUser_Profile> AccRoles = ACCSynapseUser_Profile.Load("WHERE [FK_SECURITY_USER] = " + u.ID + " AND [FK_SECURITY_PROFILE] in (" + string.Join(",", Ap.Select(a => a.ID.ToString()).ToArray()) + ")");
                IList <SynapseUser_Profile>    PrdRoles = SynapseUser_Profile.Load("WHERE [FK_SECURITY_USER] = " + pu.ID + " AND [FK_SECURITY_PROFILE] in (" + string.Join(",", Pp.Select(a => a.ID.ToString()).ToArray()) + ")");
                foreach (ACCSynapseUser_Profile Aup in AccRoles)
                {
                    if (PrdRoles.Where(pr => pr.FK_SECURITY_PROFILE == Ap.Where(a => a.ID == Aup.FK_SECURITY_PROFILE).FirstOrDefault().PrdID(links)).Count() == 0)
                    {
                        SynapseUser_Profile pup = new SynapseUser_Profile();
                        pup.FK_SECURITY_USER    = pu.ID;
                        pup.FK_SECURITY_PROFILE = Ap.Where(a => a.ID == Aup.FK_SECURITY_PROFILE).FirstOrDefault().PrdID(links);
                        if (MessageBox.Show("Add Group " + Ap.Where(a => a.ID == Aup.FK_SECURITY_PROFILE).FirstOrDefault().TECHNICALNAME + " to user " + pu.LASTNAME + " " + pu.FIRSTNAME, "Modify ?", MessageBoxButtons.YesNo) == System.Windows.Forms.DialogResult.Yes)
                        {
                            pup.save();
                        }
                    }
                }
            }
        }
コード例 #6
0
        private void fillGroups()
        {
            tsbEditGroup.Enabled    = false;
            tsbDeleteGroup.Enabled  = false;
            ctxEditGroup.Enabled    = false;
            ctxDeleteGroup.Enabled  = false;
            mnuEditGroup.Enabled    = false;
            mnuDeleteGroup.Enabled  = false;
            tsbAddUserGroup.Enabled = false;
            ctxAddUserGroup.Enabled = false;
            mnuAddUserGroup.Enabled = false;

            Hashtable LevelForProfile = new Hashtable();

            foreach (SynapseProfile Profile in SynapseForm.FormUser.Groups)
            {
                if (Profile.IS_OWNER)
                {
                    ModuleIdFilter += Profile.FK_ModuleID + ",";
                    if (!LevelForProfile.ContainsKey(Profile.FK_ModuleID))
                    {
                        LevelForProfile.Add(Profile.FK_ModuleID, Profile.LEVEL);
                    }
                    else
                    if ((Int64)LevelForProfile[Profile.FK_ModuleID] > Profile.LEVEL)
                    {
                        LevelForProfile[Profile.FK_ModuleID] = Profile.LEVEL;
                    }
                }
            }

            if (SynapseForm.FormUser.IsMemberOf("SYNAPSE_SECURITY_ADMIN"))
            {
                ProfileCollection = SynapseProfile.Load();
            }
            else if (ModuleIdFilter.Length > 1)
            {
                ProfileCollection = (from p in SynapseProfile.Load("WHERE FK_ModuleID in (" + ModuleIdFilter.TrimEnd(',') + ")") where p.LEVEL > (Int64)LevelForProfile[p.FK_ModuleID] select p).ToList();
            }
            else
            {
                ProfileCollection = new List <SynapseProfile>();
            }

            olvGroups.SetObjects(ProfileCollection.OrderBy(x => x.TECHNICALNAME.ToString()).ToList());
            olvGroups2.SetObjects(ProfileCollection.OrderBy(x => x.TECHNICALNAME.ToString()).ToList());
        }
コード例 #7
0
        private void EditGroup_Click(object sender, EventArgs e)
        {
            if (tsbEditGroup.Visible || tsbEditGroup2.Visible)
            {
                SynapseProfile _profile = new SynapseProfile();
                switch (tabControl1.SelectedIndex)
                {
                case 0:
                    _profile = (SynapseProfile)olvGroups.SelectedObject;
                    break;

                case 1:
                    _profile = (SynapseProfile)olvGroups2.SelectedObject;
                    break;
                }
                if (_profile != null)
                {
                    frmGroup fGroup = new frmGroup();
                    fGroup.Action  = "EDIT";
                    fGroup.Profile = _profile;
                    if (fGroup.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                    {
                        _profile = fGroup.Profile;
                        olvGroups.RefreshObject(_profile);
                        olvGroups2.RefreshObject(_profile);

                        switch (tabControl1.SelectedIndex)
                        {
                        case 0:
                            olvGroups.SelectedObject  = _profile;
                            olvGroups2.SelectedObject = null;
                            break;

                        case 1:
                            olvGroups.SelectedObject  = null;
                            olvGroups2.SelectedObject = _profile;
                            break;
                        }
                        AllProfileCollection = SynapseProfile.Load();
                    }
                }
            }
        }
コード例 #8
0
        public frmAccessRights()
        {
            InitializeComponent();

            AllUserCollection    = SynapseUser.Load();
            AllProfileCollection = SynapseProfile.Load();
            ModuleCollection     = SynapseModule.Load();

            olvUsers_USERID.ImageGetter = delegate(object row)
            {
                return(1);
            };

            olvUsers2_USERID.ImageGetter = delegate(object row)
            {
                return(1);
            };

            olvGroups_Group.ImageGetter = delegate(object row)
            {
                return(0);
            };

            olvGroups_Description.AspectGetter = delegate(object x)
            {
                return(((SynapseProfile)x).Description.ToString());
            };
            olvGroups_Owner.AspectGetter = delegate(object x)
            {
                return(((SynapseProfile)x).IS_OWNER);
            };
            olvGroups_Owner.Renderer = new MappedImageRenderer(new Object[] { true, imageList2.Images[0], "x", imageList2.Images[1] });

            olvGroup2_Group.ImageGetter = delegate(object row)
            {
                return(0);
            };

            olvGroup2_Owner.AspectGetter = delegate(object x)
            {
                return(((SynapseProfile)x).IS_OWNER);
            };
            olvGroup2_Owner.Renderer = new MappedImageRenderer(new Object[] { true, imageList2.Images[0], "x", imageList2.Images[1] });

            olvUserGroup_GroupName.ImageGetter = delegate(object row)
            {
                return(0);
            };

            olvUserGroup_GroupName.AspectGetter = delegate(object x)
            {
                SynapseUser_Profile SUserProfile = (SynapseUser_Profile)x;

                foreach (SynapseProfile Sp in AllProfileCollection)
                {
                    if (Sp.ID == SUserProfile.FK_SECURITY_PROFILE)
                    {
                        return(Sp.TECHNICALNAME);
                    }
                }
                return("Unknown");
            };
            olvUserGroup_Description.AspectGetter = delegate(object x)
            {
                SynapseUser_Profile SUserProfile = (SynapseUser_Profile)x;

                foreach (SynapseProfile Sp in AllProfileCollection)
                {
                    if (Sp.ID == SUserProfile.FK_SECURITY_PROFILE)
                    {
                        return(Sp.Description.ToString());
                    }
                }
                return("");
            };
            olvUserGroup_Module.AspectGetter = delegate(object x)
            {
                SynapseUser_Profile SUserProfile = (SynapseUser_Profile)x;

                foreach (SynapseProfile Sp in AllProfileCollection)
                {
                    if (Sp.ID == SUserProfile.FK_SECURITY_PROFILE)
                    {
                        foreach (SynapseModule Module in ModuleCollection)
                        {
                            if (Module.ID == Sp.FK_ModuleID)
                            {
                                return(Module.FriendlyName);
                            }
                        }
                    }
                }
                return("Unknown");
            };
            olvUserGroups.PrimarySortColumn = olvUserGroup_Module;

            olvGroupUsers_USERID.ImageGetter = delegate(object row)
            {
                return(1);
            };

            olvGroupUsers_USERID.AspectGetter = delegate(object x)
            {
                SynapseUser_Profile SUserProfile = (SynapseUser_Profile)x;

                foreach (SynapseUser Su in AllUserCollection)
                {
                    if (Su.ID == SUserProfile.FK_SECURITY_USER)
                    {
                        return(Su.UserID);
                    }
                }
                return("Unknown");
            };

            olvGroupUsers_FIRSTNAME.AspectGetter = delegate(object x)
            {
                SynapseUser_Profile SUserProfile = (SynapseUser_Profile)x;

                foreach (SynapseUser Su in AllUserCollection)
                {
                    if (Su.ID == SUserProfile.FK_SECURITY_USER)
                    {
                        return(Su.FIRSTNAME);
                    }
                }
                return("Unknown");
            };

            olvGroupUsers_LASTNAME.AspectGetter = delegate(object x)
            {
                SynapseUser_Profile SUserProfile = (SynapseUser_Profile)x;

                foreach (SynapseUser Su in AllUserCollection)
                {
                    if (Su.ID == SUserProfile.FK_SECURITY_USER)
                    {
                        return(Su.LASTNAME);
                    }
                }
                return("Unknown");
            };
            olvGroupUsers.PrimarySortColumn = olvGroupUsers_USERID;
        }
コード例 #9
0
ファイル: frm_DataMig.cs プロジェクト: WFR79/EngieEducation
        private void btn_analyse_Click(object sender, EventArgs e)
        {
            Presentation.Clear();
            string[] ids    = (from id in olv_Modules.CheckedObjects.Cast <SynapseModule>() select id.ID.ToString()).ToArray();
            string   str_id = string.Join(",", ids);

            Prd_Users = SynapseUser.Load();
            Acc_Users = ACCSynapseUser.Load();
            obj_sync pr = new obj_sync();

            pr.Name   = typeof(SynapseUser).FullName;
            pr.PrdCnt = Prd_Users.Count;
            pr.AccCnt = Acc_Users.Count;
            pr.Link   = (from l in AccToPrdID where l.OBJECTTYPE == typeof(ACCSynapseUser).Name select l).Count();
            Presentation.Add(pr);

            Prd_Profiles = SynapseProfile.Load("WHERE FK_MODULEID in (" + str_id + ")");
            Acc_Profiles = ACCSynapseProfile.Load("WHERE FK_MODULEID in (" + str_id + ")");
            pr           = new obj_sync();
            pr.Name      = typeof(SynapseProfile).FullName;
            pr.PrdCnt    = Prd_Profiles.Count;
            pr.AccCnt    = Acc_Profiles.Count;
            IList <Int64> Acc_Profiles_IDs = (from i in Acc_Profiles select i.ID).ToList();

            pr.Link = (from l in AccToPrdID where l.OBJECTTYPE == typeof(ACCSynapseProfile).Name && Acc_Profiles_IDs.Contains(l.ACCID) select l).Count();
            Presentation.Add(pr);
            string Prd_ProfilesID = string.Join(",", (from p in Prd_Profiles select p.ID.ToString()).ToArray());
            string Acc_ProfilesID = string.Join(",", (from p in Acc_Profiles select p.ID.ToString()).ToArray());

            Prd_Controls = SynapseControl.Load("WHERE FK_MODULE_ID in (" + str_id + ")");
            Acc_Controls = ACCSynapseControl.Load("WHERE FK_MODULE_ID in (" + str_id + ")");
            pr           = new obj_sync();
            pr.Name      = typeof(SynapseControl).FullName;
            pr.PrdCnt    = Prd_Controls.Count;
            pr.AccCnt    = Acc_Controls.Count;
            IList <Int64> Acc_Controls_IDs = (from i in Acc_Controls select i.ID).ToList();

            pr.Link = (from l in AccToPrdID where l.OBJECTTYPE == typeof(ACCSynapseControl).Name && Acc_Controls_IDs.Contains(l.ACCID) select l).Count();
            Presentation.Add(pr);
            string Prd_ControlsID = string.Join(",", (from c in Prd_Controls select c.ID.ToString()).ToArray());
            string Acc_ControlsID = string.Join(",", (from c in Acc_Controls select c.ID.ToString()).ToArray());

            if (Prd_ControlsID.Length <= 0)
            {
                Prd_ProfileControls = new List <SynapseProfile_Control>();
            }
            else
            {
                Prd_ProfileControls = SynapseProfile_Control.Load("WHERE FK_CONTROLID in (" + Prd_ControlsID + ")");
            }

            try
            {
                Acc_ProfileControls = ACCSynapseProfile_Control.Load("WHERE FK_CONTROLID in (" + Acc_ControlsID + ")");
            }
            catch
            {
                Acc_ProfileControls = new List <ACCSynapseProfile_Control>();
            }
            pr        = new obj_sync();
            pr.Name   = typeof(SynapseProfile_Control).FullName;
            pr.PrdCnt = Prd_ProfileControls.Count;
            pr.AccCnt = Acc_ProfileControls.Count;
            IList <Int64> Acc_ProfileControls_IDs = (from i in Acc_ProfileControls select i.ID).ToList();

            pr.Link = (from l in AccToPrdID where l.OBJECTTYPE == typeof(ACCSynapseProfile_Control).Name && Acc_ProfileControls_IDs.Contains(l.ACCID)  select l).Count();
            Presentation.Add(pr);

            if (Prd_ProfilesID.Length <= 0)
            {
                Prd_UserProfiles = new List <SynapseUser_Profile>();
            }
            else
            {
                Prd_UserProfiles = SynapseUser_Profile.Load("WHERE FK_SECURITY_PROFILE in (" + Prd_ProfilesID + ")");
            }

            Acc_UserProfiles = ACCSynapseUser_Profile.Load("WHERE FK_SECURITY_PROFILE in (" + Acc_ProfilesID + ")");
            pr        = new obj_sync();
            pr.Name   = typeof(SynapseUser_Profile).FullName;
            pr.PrdCnt = Prd_UserProfiles.Count;
            pr.AccCnt = Acc_UserProfiles.Count;
            IList <Int64> Acc_UserProfiles_IDs = (from i in Acc_UserProfiles select i.ID).ToList();

            pr.Link = (from l in AccToPrdID where l.OBJECTTYPE == typeof(ACCSynapseUser_Profile).Name && Acc_UserProfiles_IDs.Contains(l.ACCID) select l).Count();
            Presentation.Add(pr);

            olv_analyse.SetObjects(Presentation);
        }
コード例 #10
0
ファイル: frmAccessTree.cs プロジェクト: WFR79/EngieEducation
        public frmAccessTree()
        {
            InitializeComponent();

            #region AspectGetter
            treeMain.CanExpandGetter = delegate(object x)
            {
                if (x is string)
                {
                    return(true);
                }
                if (x is SynapseModule)
                {
                    return(true);
                }
                if (x is SynapseUser)
                {
                    if (treeMain.GetParent(x) is SynapseProfile)
                    {
                        return(false);
                    }
                    else
                    {
                        return(true);
                    }
                }
                if (x is SynapseProfile)
                {
                    if (treeMain.GetParent(x) is UserGroups)
                    {
                        return(false);
                    }
                    else
                    {
                        return(true);
                    }
                }
                if (x is ModuleGroups)
                {
                    return(true);
                }
                if (x is UserGroups)
                {
                    return(true);
                }
                return(false);
            };

            olvColName.AspectGetter = delegate(object x)
            {
                if (x is string)
                {
                    return(((string)x).ToUpperInvariant());
                }

                if (x is SynapseModule)
                {
                    SynapseModule _module = (SynapseModule)x;
                    return(_module.FriendlyName);
                }

                if (x is SynapseProfile)
                {
                    SynapseProfile _profile = (SynapseProfile)x;
                    return(_profile.TECHNICALNAME);
                }

                if (x is SynapseUser)
                {
                    SynapseUser _user = (SynapseUser)x;
                    string      _col  = _user.UserID + " " + _user.LASTNAME + " " + _user.FIRSTNAME;
                    return(_col);
                }

                if (x is ModuleGroups)
                {
                    return("MODULE'S GROUPS");
                }

                if (x is UserGroups)
                {
                    return("USER'S GROUPS");
                }
                return("");
            };

            olvColName.ImageGetter = delegate(object x)
            {
                if (x is string)
                {
                    return(x);
                }
                if (x is ModuleGroups)
                {
                    return("GROUPS");
                }
                if (x is UserGroups)
                {
                    return("GROUPS");
                }

                return("");
            };

            treeMain.ChildrenGetter = delegate(object x)
            {
                if (x is string)
                {
                    string _type = (string)x;
                    switch (_type)
                    {
                    case "MODULES":
                        return(ModuleCollection.OrderBy(n => n.FriendlyName.ToString()).ToList());

                    case "GROUPS":
                        return(getAutorizedGroups(AllProfileCollection).OrderBy(n => n.TECHNICALNAME.ToString()).ToList());

                    case "USERS":
                        return(getUsers(0).OrderBy(n => n.UserID.ToString()).ToList());
                    }
                    return("");
                }
                if (x is SynapseUser)
                {
                    IList <UserGroups> _groupingGroups = new List <UserGroups>();
                    UserGroups         _groups         = new UserGroups();
                    _groups.User = (SynapseUser)x;
                    _groupingGroups.Add(_groups);
                    return(_groupingGroups);
                }
                if (x is SynapseProfile)
                {
                    IList <SynapseUser> userList = new List <SynapseUser>();
                    userList = getUsers(((SynapseProfile)x).ID);
                    //userList = SynapseUser.LoadFromQuery("SELECT dbo.Synapse_Security_User.* FROM dbo.Synapse_Security_User INNER JOIN dbo.[Synapse_Security_User Profile] ON dbo.Synapse_Security_User.ID = dbo.[Synapse_Security_User Profile].FK_SECURITY_USER WHERE dbo.[Synapse_Security_User Profile].FK_SECURITY_PROFILE = " + ((SynapseProfile)x).ID);
                    return(userList.OrderBy(n => n.UserID.ToString()).ToList());
                }

                if (x is UserGroups)
                {
                    IList <SynapseProfile> UserProfiles = SynapseProfile.Load("INNER JOIN [Synapse_Security_User Profile] ON Synapse_Security_Profile.ID=[Synapse_Security_User Profile].FK_SECURITY_PROFILE WHERE [Synapse_Security_User Profile].FK_SECURITY_USER="******"INNER JOIN [Synapse_Module] ON Synapse_Security_Profile.FK_MODULEID=[Synapse_Module].ID WHERE [Synapse_Module].ID=" + ((ModuleGroups)x).Module.ID.ToString());
                    return(getAutorizedGroups(UserProfiles).OrderBy(n => n.TECHNICALNAME.ToString()).ToList());
                }
                return("");
            };
            #endregion
        }
コード例 #11
0
ファイル: UserEdit.cs プロジェクト: WFR79/EngieEducation
        void UserEditLoad(object sender, EventArgs e)
        {
            Hashtable LevelForProfile = new Hashtable();

            this.ssl_StatusLabel.Text = FormUser.UserID;

            foreach (SynapseProfile Profile in SynapseForm.FormUser.Groups)
            {
                if (Profile.IS_OWNER)
                {
                    ModuleIdFilter += Profile.FK_ModuleID + ",";
                    if (!LevelForProfile.ContainsKey(Profile.FK_ModuleID))
                    {
                        LevelForProfile.Add(Profile.FK_ModuleID, Profile.LEVEL);
                    }
                    else
                    if ((Int64)LevelForProfile[Profile.FK_ModuleID] > Profile.LEVEL)
                    {
                        LevelForProfile[Profile.FK_ModuleID] = Profile.LEVEL;
                    }
                }
            }

            var UserCollection = SynapseUser.Load();


            if (SynapseForm.FormUser.IsMemberOf("SYNAPSE_SECURITY_ADMIN"))
            {
                ProfileCollection = SynapseProfile.Load();
            }
            else if (ModuleIdFilter.Length > 1)
            {
                ProfileCollection = (from p in SynapseProfile.Load("WHERE FK_ModuleID in (" + ModuleIdFilter.TrimEnd(',') + ")") where p.LEVEL > (Int64)LevelForProfile[p.FK_ModuleID] select p).ToList();
            }
            else
            {
                ProfileCollection = new List <SynapseProfile>();
            }
            IList <SynapseProfile> AllProfileCollection;

            AllProfileCollection = SynapseProfile.Load();

            ModuleCollection = SynapseModule.Load();

            olvcGroups.ImageGetter = delegate(object row) {
                return(0);
            };

            olvcUsers.ImageGetter = delegate(object row) {
                return(1);
            };

            olvc_GroupName.ImageGetter = delegate(object row) {
                return(0);
            };

            olvc_GroupName.AspectGetter = delegate(object x) {
                SynapseUser_Profile SUserProfile = (SynapseUser_Profile)x;

                foreach (SynapseProfile Sp in AllProfileCollection)
                {
                    if (Sp.ID == SUserProfile.FK_SECURITY_PROFILE)
                    {
                        return(Sp.TECHNICALNAME);
                    }
                }
                return("Unknown");
            };
            olvc_Module.AspectGetter = delegate(object x) {
                SynapseUser_Profile SUserProfile = (SynapseUser_Profile)x;

                foreach (SynapseProfile Sp in AllProfileCollection)
                {
                    if (Sp.ID == SUserProfile.FK_SECURITY_PROFILE)
                    {
                        foreach (SynapseModule Module in ModuleCollection)
                        {
                            if (Module.ID == Sp.FK_ModuleID)
                            {
                                return(Module.FriendlyName);
                            }
                        }
                    }
                }
                return("Unknown");
            };
            olv_GroupsOfUser.PrimarySortColumn = olvc_Module;
            olv_Groups.SetObjects(ProfileCollection);
            olv_Users.SetObjects(UserCollection);

            cb_Modules.DisplayMember = "FriendlyName";
            cb_Modules.ValueMember   = "ID";
            cb_Modules.Items.Clear();
            cb_Modules.Items.Add("ALL");
            foreach (SynapseModule Mod in ModuleCollection)
            {
                cb_Modules.Items.Add(Mod);
            }
            cb_Modules.SelectedIndex = 0;
        }