Pass UserInfo (for security settings) to DisplayRO and StepTabRibbon

Check to see if the use is allowed to run the RO Editor before enabling the GoToRO button.
If an RO is selected in the text, the check to see if the user is allowed to run the RO Editor before enabling the GoTo button on the ribbon and context menu button, as well as enabling the <Shift><Ctrl><G> keystroke.
This commit is contained in:
2015-07-30 14:18:55 +00:00
parent 1ebe496589
commit 28a3a99c50
3 changed files with 36 additions and 3 deletions

View File

@@ -101,6 +101,14 @@ namespace Volian.Controls.Library
return null;
}
}
private static UserInfo _MyUserInfo = null;
public static UserInfo MyUserInfo
{
get { return _MyUserInfo; }
set { _MyUserInfo = value; }
}
private DevComponents.DotNetBar.ButtonItem _DefaultContextMenu;
public void ClearContextMenu()
@@ -659,17 +667,24 @@ namespace Volian.Controls.Library
btnCMEditRO.Enabled = false;
}
}
private bool CanEditROs()
{
// Test to see if the user is allowed to run the RO Edior
// writers and reviewers are not allowed to run the RO Editor
return MyUserInfo.IsAdministrator() || MyUserInfo.IsSetAdministrator(MyDVI) || MyUserInfo.IsROEditor(MyDVI);
}
private void SetupGoToButton()
{
if (MyEditItem is GridItem && (MyEditItem as GridItem).MyFlexGrid.IsRoTable)
btnCMGoTo.Enabled = btnGoTo.Enabled = true;
btnCMGoTo.Enabled = btnGoTo.Enabled = CanEditROs();//Don't allow Writers and Reviews run the RO Editor
else
{
if (_MyStepRTB == null) return;
if (_MyStepRTB.IsSelectionLinked(_MyStepRTB.SelectionStart, _MyStepRTB.SelectionLength))
{
// if selected text = ?, i.e. a missing/undefined destination, don't allow go to
btnCMGoTo.Enabled = btnGoTo.Enabled = !_MyStepRTB.SelectedText.StartsWith("?");
// if the selected link is an RO then check to see if the user is allowed to run the RO Editor (writers and reviewers cannot run the RO Editor)
btnCMGoTo.Enabled = btnGoTo.Enabled = !_MyStepRTB.SelectedText.StartsWith("?") && (_MyStepRTB.SelectedText.Contains("Transition") || (_MyStepRTB.SelectedText.Contains("ReferencedObject") && CanEditROs()));
}
else
btnCMGoTo.Enabled = btnGoTo.Enabled = false;