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

@@ -186,6 +186,14 @@ namespace Volian.Controls.Library
// }
//}
private static UserInfo _MyUserInfo = null;
public static UserInfo MyUserInfo
{
get { return _MyUserInfo; }
set { _MyUserInfo = value; }
}
#endregion
#region Constructors
public DisplayRO()
@@ -224,7 +232,7 @@ namespace Volian.Controls.Library
childroid = childroid.Substring(0, 16);
btnSaveRO.Enabled = ((_SavCurROLink == null) || !(childroid.Equals(SavROLink.ROID.ToLower())));
btnCancelRO.Enabled = ((_SavCurROLink != null) && childroid != SavROLink.ROID.ToLower());
btnGoToRO.Enabled = true;
btnGoToRO.Enabled = CanEditROs(); // Writers and Reviewers cannot edit ROs (run the RO Editor)
switch (chld.type)
{
case 1: // standard (regular) text RO type
@@ -843,10 +851,18 @@ namespace Volian.Controls.Library
#endregion // utils
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 string _SelectedRoidBeforeRoEditor = null;
private void lbROId_DoubleClick(object sender, EventArgs e)
{
if (tvROFST.SelectedNode == null) return;
if (!CanEditROs()) return; // do not allow writers and reviews to run the RO Editor
if (VlnSettings.ReleaseMode.Equals("DEMO"))
{
MessageBox.Show("Referenced Object Editor not available in the Demo version.", "PROMS Demo Version");