B2020-114 Fixed crash when Set Admin clicked on the Links button.

C2020-035 Don’t allow Set Admin run Repair tools and show only folders associated with Set Admin for the update Transition and RO links
2020-034 Don’t show Format and Security options for Set Amin users, disable Admin button for all other users.
This commit is contained in:
2020-10-08 19:38:19 +00:00
parent fe1e392e4e
commit d7832cfa57
4 changed files with 293 additions and 272 deletions

View File

@@ -21,7 +21,7 @@ namespace VEPROMS
get { return _MySessionInfo; }
set { _MySessionInfo = value; }
}
private bool IsAdministratorUser = false; //C2020-035 used to control what Set Amins can do
// C2017-030 - new Admin Tools user interface
// pass in session info to constructor
public frmBatchRefresh(SessionInfo sessionInfo)
@@ -29,6 +29,18 @@ namespace VEPROMS
InitializeComponent();
_MySessionInfo = sessionInfo;
setupProgessSteps1(); // C2017-030 - new Admin Tools user interface
UserInfo ui = UserInfo.GetByUserID(MySessionInfo.UserID);
IsAdministratorUser = ui.IsAdministrator();
if (!IsAdministratorUser)
{
//C2020-035 if not full Admin disable repair tools
// only full Admin users can run the repair tools
btnRunRepair.Enabled = false;
swRmObsoleteROData.Enabled = false;
swRmOrphanDataRecs.Enabled = false;
swRefreshWordAttmts.Enabled = false;
swStandardHypenChars.Enabled = false;
}
}
// NOTE: removed the Refresh ROs and Refresh Transitions and ROs options (now only Transitions can be refreshed)
// the Update ROs and Refresh ROs logic was merged together. The Update ROs will functionally do both
@@ -100,7 +112,7 @@ namespace VEPROMS
{
btnFixLinks.Enabled = false;
this.Cursor = Cursors.WaitCursor;
myTreeNodePath = new List<string>();
//myTreeNodePath = new List<string>();
myTV.Nodes.Clear();
myDocVersions.Clear();
FolderInfo fi = FolderInfo.GetTop();
@@ -114,18 +126,28 @@ namespace VEPROMS
}
private void LoadChildFolders(FolderInfo fi, TreeNode tn, bool noProcs)
{
bool loadedWorkingDraft = false;
foreach (FolderInfo fic in fi.SortedChildFolders)
{
TreeNode tnc = tn.Nodes.Add(fic.Name);
tnc.Tag = fic;
if (fic.ChildFolderCount > 0)
LoadChildFolders(fic, tnc, noProcs);
// B2020-114 and C2020-035 only show folders the Set Admin can access
if (fic.FolderDocVersionCount > 0)
LoadDocVersions(fic, tnc, noProcs);
{
if (!LoadDocVersions(fic, tnc, noProcs))
tnc.Remove();
else
loadedWorkingDraft = true;
}
}
if (tn.Parent != null && !loadedWorkingDraft)
tn.Remove();
}
private void LoadDocVersions(FolderInfo fic, TreeNode tnc, bool noProcs)
private bool LoadDocVersions(FolderInfo fic, TreeNode tnc, bool noProcs)
{
bool rtnval = false;
foreach (DocVersionInfo dvi in fic.FolderDocVersions)
{
UserInfo ui = UserInfo.GetByUserID(MySessionInfo.UserID);
@@ -138,11 +160,11 @@ namespace VEPROMS
if (dvi.Procedures.Count > 0)
LoadProcedures(dvi, tnc);
}
myTreeNodePath.Add(tnc.FullPath);
rtnval = true;
}
else
{
while (tnc != null && tnc.Text != "VEPROMS" && !IsUsedPath(tnc.FullPath))
if (tnc != null && tnc.Text != "VEPROMS") // B2020-114 - mad if statement removed: && !IsUsedPath(tnc.FullPath))
{
TreeNode tmp = tnc.Parent;
tnc.Remove();
@@ -150,15 +172,7 @@ namespace VEPROMS
}
}
}
}
private bool IsUsedPath(string path)
{
foreach (string s in myTreeNodePath)
{
if (s.StartsWith(path))
return true;
}
return false;
return rtnval;
}
private void LoadProcedures(DocVersionInfo dvi, TreeNode tnc)
{
@@ -965,6 +979,8 @@ namespace VEPROMS
AdminToolType = E_AdminToolType.Repair;
lblAdmToolProgressType.Text = "Repairing:";
setupProgessSteps1();
if (!IsAdministratorUser) // C2020-035 notify Set Amin user that only Full Admins can run repair tools
MessageBox.Show("Only Full PROMS Administrator Users can run these data repair tools","Data Repair Tools",MessageBoxButtons.OK,MessageBoxIcon.Exclamation);
}
// C2017-030 new Admin Tools user interface