Add UserInfo property and modified code to assure a person with Reviewer security can only manage annotations created by themself.

Added SessionInfo property to DisplayTabControl class and managed opening and closing DisplayTabItems.
Added OwnerID and UserRole properties to DisplayTabItem class and obtained owner id and setup security based on user role when opening an item.
Added property to allow forced check in of word document to ignore any changes made by user.
Removed debug code
Added methods to setup ribbon control based on user's security role.
Added SessionInfo property and events and methods to setup proper menu items to appear on the right click of a node based on user's role and checked out status of item.
This commit is contained in:
Rich
2013-11-20 23:12:47 +00:00
parent a7562422b2
commit 50910d00b8
7 changed files with 712 additions and 156 deletions

View File

@@ -24,6 +24,12 @@ namespace Volian.Controls.Library
/// <summary>
/// ItemInfo associated with this DisplayTabItem
/// </summary>
private int _OwnerID;
public int OwnerID
{
get { return _OwnerID; }
set { _OwnerID = value; }
}
public ItemInfo MyItemInfo
{
get { return _MyItemInfo; }
@@ -54,6 +60,12 @@ namespace Volian.Controls.Library
get { return _MyDSOTabPanel; }
set { _MyDSOTabPanel = value; }
}
private string _MyUserRole;
public string MyUserRole
{
get { return _MyUserRole; }
set { _MyUserRole = value; }
}
/// <summary>
/// Current SelectedItemInfo for this page
/// </summary>
@@ -77,9 +89,14 @@ namespace Volian.Controls.Library
#region Constructors
public DisplayTabItem(IContainer container, DisplayTabControl myDisplayTabControl, ItemInfo myItemInfo, string myKey)
{
_MyItemInfo = myItemInfo;
if(MyItemInfo.MyContent.MyEntry == null)
OwnerID = myDisplayTabControl.MySessionInfo.CheckOutItem(myItemInfo.MyProcedure.ItemID, CheckOutType.Procedure);
else
OwnerID = myDisplayTabControl.MySessionInfo.CheckOutItem(myItemInfo.MyContent.MyEntry.DocID, CheckOutType.Document);
Console.WriteLine("DisplayTabItem");
_MyKey = myKey;
_MyDisplayTabControl = myDisplayTabControl;
_MyItemInfo = myItemInfo;
container.Add(this);
InitializeComponent();
this.Click += new EventHandler(DisplayTabItem_Click);
@@ -87,8 +104,59 @@ namespace Volian.Controls.Library
SetupStepTabPanel();
else
SetupDSOTabPanel();
SetupSecurity(myItemInfo);
Name = string.Format("DisplayTabItem {0}", myItemInfo.ItemID);
}
private bool MesssageShown = false;
public void SetupSecurity(ItemInfo myItem)
{
UserInfo ui = UserInfo.GetByUserID(OwnerInfo.Get(OwnerID).SessionUserID);
if (ui == null)
{
if (!MesssageShown)
{
System.Windows.Forms.MessageBox.Show("Security has not been defined for PROMS. All functionality has been defaulted to the lowest level for all users until security is defined.", "no security defined", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Warning);
MesssageShown = true;
}
_MyStepTabPanel.MyStepTabRibbon.SetupReviewerMode();
}
else if (ui.IsAdministrator())
{
if(_MyStepTabPanel != null)
_MyStepTabPanel.MyStepTabRibbon.SetupAdminMode();
MyUserRole = Volian.Base.Library.VlnSettings.UserID + " - Administrator";
}
else if (ui.IsSetAdministrator(myItem.MyDocVersion))
{
if (_MyStepTabPanel != null)
_MyStepTabPanel.MyStepTabRibbon.SetupSetAdminMode();
MyUserRole = Volian.Base.Library.VlnSettings.UserID + " - Set Administrator";
}
else if (ui.IsROEditor(myItem.MyDocVersion))
{
if (_MyStepTabPanel != null)
_MyStepTabPanel.MyStepTabRibbon.SetupROEditorMode();
MyUserRole = Volian.Base.Library.VlnSettings.UserID + " - RO Editor";
}
else if (ui.IsWriter(myItem.MyDocVersion))
{
if (_MyStepTabPanel != null)
_MyStepTabPanel.MyStepTabRibbon.SetupWriterMode();
MyUserRole = Volian.Base.Library.VlnSettings.UserID + " - Writer";
}
else if (ui.IsReviewer(myItem.MyDocVersion))
{
if (_MyStepTabPanel != null)
_MyStepTabPanel.MyStepTabRibbon.SetupReviewerMode();
MyUserRole = Volian.Base.Library.VlnSettings.UserID + " - Reviewer";
}
else
{
if (_MyStepTabPanel != null)
_MyStepTabPanel.MyStepTabRibbon.SetupReviewerMode();
MyUserRole = Volian.Base.Library.VlnSettings.UserID + " - Reviewer";
}
}
public DisplayTabItem(IContainer container, DisplayTabControl myDisplayTabControl, DocumentInfo myDocumentInfo, string myKey)
{
_MyKey = myKey;