Use static function to check user’s security level

Pass user security info to the panels, fix security related issues on the V button (B2015-188, B2015-193)
Added static functions to check the user’s security level
Use static function to check user’s security level in allowing applicability changes
Use static function to check user’s security level in enabling Inserting and RO and in Editing an RO
This commit is contained in:
2015-12-09 21:01:13 +00:00
parent 0159fc2955
commit d8f7b0619c
6 changed files with 102 additions and 36 deletions

View File

@@ -375,6 +375,14 @@ namespace Volian.Controls.Library
ei.MyStepRTB.Focus();
}
}
private static UserInfo _MyUserInfo = null;
public static UserInfo MyUserInfo
{
get { return _MyUserInfo; }
set { _MyUserInfo = value; }
}
public DisplayApplicability()
{
InitializeComponent();
@@ -384,6 +392,7 @@ namespace Volian.Controls.Library
void DisplayApplicability_VisibleChanged(object sender, EventArgs e)
{
MyItemInfo = MyItemInfo;
gpItem.Enabled = UserInfo.CanEdit(MyUserInfo,(MyItemInfo == null) ? null : MyItemInfo.MyDocVersion); //Can Change Applicability
}
}
}

View File

@@ -767,13 +767,22 @@ namespace Volian.Controls.Library
{
return VlnFlexGrid.ROTableUpdate(sender, args);
}
private static UserInfo _MyUserInfo = null;
public static UserInfo MyUserInfo
{
get { return _MyUserInfo; }
set { _MyUserInfo = value; }
}
private void DisplayTagRTF(TreeNode tn)
{
if (tn.Tag != null)
{
if (tn.Tag is GridAuditInfo)
{
btnRestore.Enabled = true;
btnRestore.Enabled = UserInfo.CanEdit(MyUserInfo, MyProcedureInfo.MyDocVersion);//CanRestore();
GridAuditInfo gai = tn.Tag as GridAuditInfo;
myVFG.Visible = true;
myVFG.BringToFront();
@@ -791,7 +800,7 @@ namespace Volian.Controls.Library
}
if (tn.Tag is ContentAuditInfo)
{
btnRestore.Enabled = true;
btnRestore.Enabled = UserInfo.CanEdit(MyUserInfo, MyProcedureInfo.MyDocVersion);//CanRestore();
myVFG.Clear();
ContentAuditInfo cai = tn.Tag as ContentAuditInfo;
GridAuditInfoList gail = GridAuditInfoList.Get(cai.ContentID);
@@ -827,7 +836,7 @@ namespace Volian.Controls.Library
}
if (tn.Tag is ItemAuditInfo)
{
btnRestore.Enabled = true;
btnRestore.Enabled = UserInfo.CanEdit(MyUserInfo, MyProcedureInfo.MyDocVersion);//CanRestore();
ItemAuditInfo iai = tn.Tag as ItemAuditInfo;
ContentAuditInfoList cail = ContentAuditInfoList.Get(iai.ContentID);
foreach (ContentAuditInfo cai in cail)
@@ -842,7 +851,7 @@ namespace Volian.Controls.Library
}
if (tn.Tag is AnnotationAuditInfo)
{
btnRestore.Enabled = true;
btnRestore.Enabled = UserInfo.CanEdit(MyUserInfo, MyProcedureInfo.MyDocVersion);//CanRestore();
AnnotationAuditInfo iai = tn.Tag as AnnotationAuditInfo;
myRTB.Font = new Font("Arial", 12, FontStyle.Regular);
myRTB.Rtf = iai.RtfText;

View File

@@ -230,9 +230,9 @@ namespace Volian.Controls.Library
//btnCancelRO.Enabled = ((_SavCurROLink != null) && chld.roid.Substring(0, 12).ToLower() != SavROLink.ROID.Substring(0, 12).ToLower());
string childroid = chld.roid.ToLower() + "0000";
childroid = childroid.Substring(0, 16);
btnSaveRO.Enabled = ((_SavCurROLink == null) || !(childroid.Equals(SavROLink.ROID.ToLower())));
btnSaveRO.Enabled = UserInfo.CanEdit(MyUserInfo, Mydvi) && ((_SavCurROLink == null) || !(childroid.Equals(SavROLink.ROID.ToLower()))); //added security check (UserInfo.CanEdit)
btnCancelRO.Enabled = ((_SavCurROLink != null) && childroid != SavROLink.ROID.ToLower());
btnGoToRO.Enabled = CanEditROs(); // Writers and Reviewers cannot edit ROs (run the RO Editor)
btnGoToRO.Enabled = UserInfo.CanEditROs(MyUserInfo, Mydvi); // Writers and Reviewers cannot edit ROs (run the RO Editor)
switch (chld.type)
{
case 1: // standard (regular) text RO type
@@ -851,18 +851,11 @@ 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 (!UserInfo.CanEditROs(MyUserInfo, Mydvi)) 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");