Added code to require a security key from Volian in order to start PROMS as a backdoor administrator or as a proxy using one of the already defined users of the database. Added code to allow all Volian personnel the ability to generate the daily security key by right clicking on their user name at the bottom of the screen.
This commit is contained in:
parent
02decee5a5
commit
d492bf69de
@ -284,24 +284,24 @@ namespace VEPROMS
|
||||
void tv_ExportImportProcedureSets(object sender, vlnTreeEventArgs args)
|
||||
{
|
||||
FolderInfo fi = (args.Node as VETreeNode).VEObject as FolderInfo;
|
||||
string msg = string.Empty;
|
||||
bool ok = MySessionInfo.CanCheckOutItem(fi.FolderID, CheckOutType.Folder, ref msg);
|
||||
if (!ok)
|
||||
{
|
||||
if(args.Index == 0)
|
||||
MessageBox.Show(this, msg, "Export Procedure Set Unavailable");
|
||||
string msg = string.Empty;
|
||||
bool ok = MySessionInfo.CanCheckOutItem(fi.FolderID, CheckOutType.Folder, ref msg);
|
||||
if (!ok)
|
||||
{
|
||||
if (args.Index == 0)
|
||||
MessageBox.Show(this, msg, "Export Procedure Set Unavailable");
|
||||
else
|
||||
MessageBox.Show(this, msg, "Import Procedure Set Unavailable");
|
||||
}
|
||||
else
|
||||
MessageBox.Show(this, msg, "Import Procedure Set Unavailable");
|
||||
}
|
||||
else
|
||||
{
|
||||
int ownerid = MySessionInfo.CheckOutItem(fi.FolderID, CheckOutType.Folder);
|
||||
dlgExportImport dlg = new dlgExportImport(args.Index == 0 ? "Export" : "Import", fi);
|
||||
dlg.ShowDialog(this);
|
||||
MySessionInfo.CheckInItem(ownerid);
|
||||
if(args.Index == 1 && dlg.MyNewFolder != null)
|
||||
tv.AddNewNode(dlg.MyNewFolder);
|
||||
}
|
||||
{
|
||||
int ownerid = MySessionInfo.CheckOutItem(fi.FolderID, CheckOutType.Folder);
|
||||
dlgExportImport dlg = new dlgExportImport(args.Index == 0 ? "Export" : "Import", fi);
|
||||
dlg.ShowDialog(this);
|
||||
MySessionInfo.CheckInItem(ownerid);
|
||||
if (args.Index == 1 && dlg.MyNewFolder != null)
|
||||
tv.AddNewNode(dlg.MyNewFolder);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -913,7 +913,7 @@ namespace VEPROMS
|
||||
{
|
||||
VlnSettings.UserID = parameter.Substring(3);
|
||||
}
|
||||
else if (parameter.StartsWith("/VeauLeeAnn")) //this is used by volian personnel to act as an existing user
|
||||
else if (parameter.StartsWith("/VeauLeeAnn" + GetSecurityKey())) //this is used by volian personnel to act as an existing user
|
||||
{
|
||||
//pop up user list to select from
|
||||
ContextMenuStrip cms = BuildUserMenu();
|
||||
@ -924,16 +924,47 @@ namespace VEPROMS
|
||||
}
|
||||
VlnSettings.UserID = proxyUser;
|
||||
}
|
||||
else if (parameter.StartsWith("/V3Pr0m5=")) //this is a backdoor to create another administrator
|
||||
else if (parameter.StartsWith("/V3Pr0m5" + GetSecurityKey() + "=")) //this is a backdoor to create another administrator
|
||||
{
|
||||
VlnSettings.UserID = parameter.Substring(9);
|
||||
VlnSettings.UserID = parameter.Substring(9 + GetSecurityKey().Length);
|
||||
User u = User.MakeUser(VlnSettings.UserID, "", "", "", "", "", "", "", "", "", "", DateTime.Now, VlnSettings.UserID);
|
||||
Group g = Group.GetByGroupName("Administrators");
|
||||
Membership.MakeMembership(u, g, null, "");
|
||||
}
|
||||
}
|
||||
lblUser.Text = VlnSettings.UserID;
|
||||
lblUser.MouseDown += new MouseEventHandler(lblUser_MouseDown);
|
||||
}
|
||||
private string GetSecurityKey()
|
||||
{
|
||||
Random rnd = new Random(DateTime.Now.Year + DateTime.Now.DayOfYear * 1000);
|
||||
return rnd.Next(10000).ToString();
|
||||
}
|
||||
void lblUser_MouseDown(object sender, MouseEventArgs e)
|
||||
{
|
||||
if (e.Button == MouseButtons.Right)
|
||||
{
|
||||
/*
|
||||
- Devin- Volian0
|
||||
- Diane- Volian0
|
||||
- Jess- Volian0
|
||||
- John- Volian0
|
||||
- Kathy- Volian0
|
||||
- Jim- JCB2-HP
|
||||
- Rich- WINDOWS7-RHM
|
||||
- Paul- Paul-PC
|
||||
- Michelle- Michelle-PC
|
||||
- Harry’s Mac- WIN-O4QLPEH7JKH
|
||||
- Harry’s PC- Harry-7100
|
||||
- Caitlin- Caitlin-PC
|
||||
*/
|
||||
if ("|VOLIAN0|JCB2-HP|WINDOWS7-RHM|PAUL-PC|MICHELLE-PC|WIN-O4QLPEH7JKH|HARRY-7100|CAITLIN-PC|".Contains("|" + Environment.UserDomainName + "|"))
|
||||
{
|
||||
Random rnd = new Random(DateTime.Now.Year + DateTime.Now.DayOfYear * 1000);
|
||||
MessageBox.Show(this, GetSecurityKey(), "Today's Security Key");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private ContextMenuStrip BuildUserMenu()
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user