B2108-112 Use IsAllowedToEdit in call to SetButtonEnablingForEnhanced() so that a reviewer cannot toggle out of View mode, and cannot delete from the context menu.

B2018-112 Added IsAllowedToEdit method for use in setting up the menu and context menu items
This commit is contained in:
John Jenko 2018-08-08 15:23:38 +00:00
parent 59946e12b3
commit 4ad9fd65bf
2 changed files with 7 additions and 2 deletions

View File

@ -1232,6 +1232,11 @@ namespace VEPROMS.CSLA.Library
}
return false;
}
// B2018-112 added for easy check if user's PROMS Security allows making edits - used in StepTabRibbon - SetButtonAndMenuEnabling()
public bool IsAllowedToEdit(DocVersionInfo dvi)
{
return IsAdministrator() || IsSetAdministrator(dvi) || IsWriter(dvi);
}
public static UserInfo GetByUserID(string userID)
{
try

View File

@ -1490,7 +1490,7 @@ namespace Volian.Controls.Library
if (!MyItemInfo.IsEnhancedStep && !MyItemInfo.IsEnhancedSection &&
(((MyItemInfo.ActiveFormat.PlantFormat.FormatData.PurchaseOptions.Value & E_PurchaseOptions.EnhancedBackgrounds) == E_PurchaseOptions.EnhancedBackgrounds) ||
((MyItemInfo.ActiveFormat.PlantFormat.FormatData.PurchaseOptions.Value & E_PurchaseOptions.EnhancedDeviations) == E_PurchaseOptions.EnhancedDeviations)))
SetButtonEnablingForEnhanced(true);
SetButtonEnablingForEnhanced(MyUserInfo.IsAllowedToEdit(dvi)); // B2018-112 - set context menu and ribbon buttons based on user's PROMS Security setting
if (dvi.VersionType > 127 || MyEditItem.MyStepPanel.VwMode == E_ViewMode.View)
{
@ -1629,7 +1629,7 @@ namespace Volian.Controls.Library
bool allowDel = false;
EnhancedDocuments eds = MyItemInfo.GetMyEnhancedDocuments();
// note in follow if statements, 'setting' == false when in enhanced document:
if (!setting && MyItemInfo.IsStep && (eds == null || eds.Count == 0)) // this step is in enhanced, but not linked
if (setting && MyItemInfo.IsStep && (eds == null || eds.Count == 0)) // this step is in enhanced, but not linked // B2018-112 and is allowed to edit
allowDel = true; // allow delete if not linked
btnCpyStp.Enabled = setting;
//B20170-158 Allow a Unlinked Step to be pasted before or after a linked step.