private void DeleteUser_Click(object sender, EventArgs e) { SynapseUser _user = new SynapseUser(); switch (tabControl1.SelectedIndex) { case 0: _user = (SynapseUser)olvUsers.SelectedObject; break; case 1: _user = (SynapseUser)olvUsers2.SelectedObject; break; } if (MessageBox.Show(GetLabel("Quest.0001"), GetLabel("Quest"), MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) == System.Windows.Forms.DialogResult.Yes) { var usergroups = SynapseUser_Profile.Load("WHERE FK_SECURITY_USER = " + _user.ID); foreach (SynapseUser_Profile sup in usergroups) { sup.delete(); } olvUsers.RemoveObject(_user); olvUsers2.RemoveObject(_user); _user.delete(); AllUserCollection = SynapseUser.Load(); olvUserGroups.Items.Clear(); } }
private void NewUser_Click(object sender, EventArgs e) { frmUser fUser = new frmUser(); fUser.Action = "NEW"; fUser.User = new SynapseUser(); if (fUser.ShowDialog() == System.Windows.Forms.DialogResult.OK) { SynapseUser _user = fUser.User; olvUsers.AddObject(_user); olvUsers2.AddObject(_user); switch (tabControl1.SelectedIndex) { case 0: olvUsers.SelectedObject = _user; break; case 1: olvUsers2.SelectedObject = _user; break; } AllUserCollection = SynapseUser.Load(); } }
public override void initForm(SynapseCore.Security.Tools.SecureAndTranslateMode Mode) { base.initForm(Mode); ModuleCollection = SynapseModule.Load(); AllUserCollection = SynapseUser.Load(); AllProfileCollection = SynapseProfile.Load(); initTree(); }
private void btn_RefreshUsers_Click(object sender, EventArgs e) { olv_PRDUSERS.ClearObjects(); olv_ACCUSERS.ClearObjects(); Prd_Users = SynapseUser.Load(); Acc_Users = ACCSynapseUser.Load(); Prd_UserProfiles = SynapseUser_Profile.Load(); Acc_UserProfiles = ACCSynapseUser_Profile.Load(); olv_ACCUSERS.SetObjects(Acc_Users.OrderBy(au => au.UserID)); olv_PRDUSERS.SetObjects(Prd_Users.OrderBy(pu => pu.UserID)); }
private List <SynapseUser> getUsers(Int64 profileID) { IList <SynapseUser> userList; if (profileID == 0) { userList = SynapseUser.Load(); } else { 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 = " + profileID); } return(userList.OrderBy(n => n.UserID.ToString()).ToList()); }
private void fillUsers() { olvUsers.Items.Clear(); tsbEditUser.Enabled = false; tsbDeleteUser.Enabled = false; ctxEditUser.Enabled = false; ctxDeleteUser.Enabled = false; mnuEditUser.Enabled = false; mnuDeleteUser.Enabled = false; IList <SynapseUser> userList = SynapseUser.Load(); olvUsers.SetObjects(userList); olvUsers2.SetObjects(userList); }
private void EditUser_Click(object sender, EventArgs e) { SynapseUser _user = new SynapseUser(); switch (tabControl1.SelectedIndex) { case 0: _user = (SynapseUser)olvUsers.SelectedObject; break; case 1: _user = (SynapseUser)olvUsers2.SelectedObject; break; } frmUser fUser = new frmUser(); fUser.Action = "EDIT"; fUser.User = _user; if (fUser.ShowDialog() == System.Windows.Forms.DialogResult.OK) { _user = fUser.User; olvUsers.RefreshObject(_user); olvUsers2.RefreshObject(_user); switch (tabControl1.SelectedIndex) { case 0: olvUsers.SelectedObject = _user; olvUsers2.SelectedObject = null; break; case 1: olvUsers.SelectedObject = null; olvUsers2.SelectedObject = _user; break; } AllUserCollection = SynapseUser.Load(); } }
private Boolean checkFields() { synapseErrorProvider1.SetError(txUserid, ""); synapseErrorProvider1.SetError(txFirstName, ""); synapseErrorProvider1.SetError(txLastName, ""); IList <SynapseUser> _users = SynapseUser.Load("WHERE USERID='" + txUserid.Text + "' AND ID <> " + _user.ID); if (_users.Count > 0) { synapseErrorProvider1.SetError(txUserid, GetLabel("Err.0015")); MessageBox.Show(GetLabel("Err.0015"), GetLabel("Err"), MessageBoxButtons.OK, MessageBoxIcon.Error); return(false); } txUserid.MandatoryErrorMessage = GetLabel("Err.0016"); txFirstName.MandatoryErrorMessage = GetLabel("Err.0017"); txLastName.MandatoryErrorMessage = GetLabel("Err.0018"); synapseErrorProvider1.ShowMessageBox = true; return(synapseErrorProvider1.ValidateControls()); }
private void treeMain_SelectedIndexChanged(object sender, EventArgs e) { //olvGroupUsers.Items.Clear(); if (treeMain.SelectedObject != null) { if (treeMain.SelectedObject is string) { if ((string)treeMain.SelectedObject == "USERS") { lbSelected.Text = "USERS"; olvGroupUsers.SetObjects(SynapseUser.Load().OrderBy(x => x.UserID.ToString()).ToList()); olvGroupUsers.Visible = true; lbEmpty.Visible = false; return; } } if (treeMain.SelectedObject is SynapseProfile) { if (treeMain.GetParent(treeMain.SelectedObject) is UserGroups) { } else { lbSelected.Text = ((SynapseProfile)treeMain.SelectedObject).TECHNICALNAME; olvGroupUsers.SetObjects(getUsers(((SynapseProfile)treeMain.SelectedObject).ID)); olvGroupUsers.Visible = true; lbEmpty.Visible = false; return; } } lbEmpty.Visible = true; lbSelected.Text = ""; olvGroupUsers.Visible = false; } }
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; }
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); }
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; }