本文整理汇总了C#中SobekCM.Core.Users.User_Object.Can_Edit_This_Item方法的典型用法代码示例。如果您正苦于以下问题:C# User_Object.Can_Edit_This_Item方法的具体用法?C# User_Object.Can_Edit_This_Item怎么用?C# User_Object.Can_Edit_This_Item使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SobekCM.Core.Users.User_Object
的用法示例。
在下文中一共展示了User_Object.Can_Edit_This_Item方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ManageMenu_ItemViewer
/// <summary> Constructor for a new instance of the ManageMenu_ItemViewer class </summary>
/// <param name="Current_Object"> Digital resource to display </param>
/// <param name="Current_User"> Current user for this session </param>
/// <param name="Current_Mode"> Navigation object which encapsulates the user's current request </param>
public ManageMenu_ItemViewer(SobekCM_Item Current_Object, User_Object Current_User, Navigation_Object Current_Mode)
{
// Save the current user and current mode information (this is usually populated AFTER the constructor completes,
// but in this case (QC viewer) we need the information for early processing
CurrentMode = Current_Mode;
CurrentUser = Current_User;
CurrentItem = Current_Object;
// Determine if this user can edit this item
if (CurrentUser == null)
{
Current_Mode.ViewerCode = String.Empty;
UrlWriterHelper.Redirect(Current_Mode);
return;
}
else
{
bool userCanEditItem = CurrentUser.Can_Edit_This_Item( CurrentItem.BibID, CurrentItem.Bib_Info.SobekCM_Type_String, CurrentItem.Bib_Info.Source.Code, CurrentItem.Bib_Info.HoldingCode, CurrentItem.Behaviors.Aggregation_Code_List );
if (!userCanEditItem)
{
Current_Mode.ViewerCode = String.Empty;
UrlWriterHelper.Redirect(Current_Mode);
return;
}
}
}
示例2: Citation_MARC_ItemViewer
/// <summary> Constructor for a new instance of the Citation_MARC_ItemViewer class, used to display the
/// descriptive citation in MARC21 format</summary>
/// <param name="BriefItem"> Digital resource object </param>
/// <param name="CurrentUser"> Current user, who may or may not be logged on </param>
/// <param name="CurrentRequest"> Information about the current request </param>
public Citation_MARC_ItemViewer(BriefItemInfo BriefItem, User_Object CurrentUser, Navigation_Object CurrentRequest)
{
// Save the arguments for use later
this.BriefItem = BriefItem;
this.CurrentUser = CurrentUser;
this.CurrentRequest = CurrentRequest;
// Set the behavior properties to the empy behaviors ( in the base class )
Behaviors = EmptyBehaviors;
// Check to see if the user can edit this
userCanEdit = false;
if ( CurrentUser != null )
userCanEdit = CurrentUser.Can_Edit_This_Item(BriefItem.BibID, BriefItem.Type, BriefItem.Behaviors.Source_Institution_Aggregation, BriefItem.Behaviors.Holding_Location_Aggregation, BriefItem.Behaviors.Aggregation_Code_List);
}
示例3: Has_Access
/// <summary> Flag indicates if the current user has access to this viewer for the item </summary>
/// <param name="CurrentItem"> Digital resource to see if the current user has correct permissions to use this viewer </param>
/// <param name="CurrentUser"> Current user, who may or may not be logged on </param>
/// <param name="IpRestricted"> Flag indicates if this item is IP restricted AND if the current user is outside the ranges </param>
/// <returns> TRUE if the user has access to use this viewer, otherwise FALSE </returns>
public bool Has_Access(BriefItemInfo CurrentItem, User_Object CurrentUser, bool IpRestricted)
{
// If there is no user (or they aren't logged in) then obviously, they can't edit this
if ((CurrentUser == null) || (!CurrentUser.LoggedOn))
{
return false;
}
// If INTERNAL, user has access
if ((CurrentUser.Is_Host_Admin) || (CurrentUser.Is_System_Admin) || (CurrentUser.Is_Portal_Admin) || (CurrentUser.Is_Internal_User))
return true;
// See if this user can edit this item
bool userCanEditItem = CurrentUser.Can_Edit_This_Item(CurrentItem.BibID, CurrentItem.Type, CurrentItem.Behaviors.Source_Institution_Aggregation, CurrentItem.Behaviors.Holding_Location_Aggregation, CurrentItem.Behaviors.Aggregation_Code_List);
if (!userCanEditItem)
{
// Can't edit, so don't show and return FALSE
return false;
}
// Apparently it can be shown
return true;
}
示例4: Add_Main_Menu
public void Add_Main_Menu(TextWriter Output, string CurrentCode, bool ItemRestrictedFromUserByIP, bool ItemCheckedOutByOtherUser, BriefItemInfo CurrentItem, Navigation_Object CurrentMode, User_Object CurrentUser, Custom_Tracer Tracer)
{
// Set some flags based on the resource type
bool is_bib_level = (String.Compare(CurrentItem.Type, "BIB_LEVEL", StringComparison.OrdinalIgnoreCase) == 0);
bool is_ead = (String.Compare(CurrentItem.Type, "EAD", StringComparison.OrdinalIgnoreCase) == 0);
// Determine if this user can edit this item
bool userCanEditItem = false;
if (CurrentUser != null)
{
userCanEditItem = CurrentUser.Can_Edit_This_Item(CurrentItem.BibID, CurrentItem.Type, CurrentItem.Behaviors.Source_Institution_Aggregation, CurrentItem.Behaviors.Holding_Location_Aggregation, CurrentItem.Behaviors.Aggregation_Code_List);
}
// Can this user (if there is one) edit this item?
bool canManage = (CurrentUser != null) && (CurrentUser.Can_Edit_This_Item(CurrentItem.BibID, CurrentItem.Type, CurrentItem.Behaviors.Source_Institution_Aggregation, CurrentItem.Behaviors.Holding_Location_Aggregation, CurrentItem.Behaviors.Aggregation_Code_List));
// Add the item views
Output.WriteLine("<!-- Add the different view and social options -->");
Output.WriteLine("<nav class=\"sbkMenu_Bar\" id=\"sbkIsw_MenuBar\" role=\"navigation\" aria-label=\"Item menu\">");
Output.WriteLine("\t<h2 class=\"hidden-element\">Item menu</h2>");
// Check that this item is not checked out by another user
bool itemCheckedOutByOtherUser = false;
if (CurrentItem.Behaviors.Single_Use)
{
if (!Engine_ApplicationCache_Gateway.Checked_List.Check_Out(CurrentItem.Web.ItemID, HttpContext.Current.Request.UserHostAddress))
{
itemCheckedOutByOtherUser = true;
}
}
// Add the sharing buttons if this is not restricted by IP address or checked out
if ((!ItemRestrictedFromUserByIP) && (!ItemCheckedOutByOtherUser) && (!CurrentMode.Is_Robot))
{
string add_text = "Add";
string remove_text = "Remove";
string send_text = "Send";
string print_text = "Print";
if (canManage)
{
add_text = String.Empty;
remove_text = String.Empty;
send_text = String.Empty;
print_text = String.Empty;
}
string logOnUrl = String.Empty;
bool isLoggedOn = CurrentUser != null && CurrentUser.LoggedOn;
if (!isLoggedOn)
{
string returnUrl = UrlWriterHelper.Redirect_URL(CurrentMode);
CurrentMode.Mode = Display_Mode_Enum.My_Sobek;
CurrentMode.My_Sobek_Type = My_Sobek_Type_Enum.Logon;
CurrentMode.Return_URL = returnUrl;
logOnUrl = UrlWriterHelper.Redirect_URL(CurrentMode);
CurrentMode.Mode = Display_Mode_Enum.Item_Display;
CurrentMode.Return_URL = String.Empty;
}
Output.WriteLine("\t<div id=\"menu-right-actions\">");
if (( CurrentItem.Web != null ) && ( CurrentItem.Web.ItemID > 0))
{
string print_item_form_open_url = UI_ApplicationCache_Gateway.Settings.Servers.Engine_URL + "items/html/print/" + CurrentItem.BibID + "/" + CurrentItem.VID + "/" + CurrentMode.ViewerCode;
Output.WriteLine("\t\t<span id=\"printbuttonitem\" class=\"action-sf-menu-item\" onclick=\"print_form_open('" + print_item_form_open_url + "');\"><img src=\"" + Static_Resources_Gateway.Printer_Png + "\" alt=\"\" style=\"vertical-align:middle\" /><span id=\"printbuttonspan\">" + print_text + "</span></span>");
}
else
{
Output.WriteLine("\t\t<span id=\"printbuttonitem\" class=\"action-sf-menu-item\" onclick=\"window.print();return false;\"><img src=\"" + Static_Resources_Gateway.Printer_Png + "\" alt=\"\" style=\"vertical-align:middle\" /><span id=\"printbuttonspan\">" + print_text + "</span></span>");
}
if (isLoggedOn)
{
string email_item_form_open_url = UI_ApplicationCache_Gateway.Settings.Servers.Engine_URL + "items/html/send/" + CurrentItem.BibID + "/" + CurrentItem.VID;
Output.WriteLine("\t\t<span id=\"sendbuttonitem\" class=\"action-sf-menu-item\" onclick=\"email_form_open('" + email_item_form_open_url + "');\"><img src=\"" + Static_Resources_Gateway.Email_Png + "\" alt=\"\" style=\"vertical-align:middle\" /><span id=\"sendbuttonspan\">" + send_text + "</span></span>");
if ((CurrentItem.Web != null) && (CurrentItem.Web.ItemID > 0))
{
if (CurrentUser.Is_In_Bookshelf(CurrentItem.BibID, CurrentItem.VID))
{
Output.WriteLine("\t\t<span id=\"addbuttonitem\" class=\"action-sf-menu-item\" onclick=\"return remove_item_itemviewer();\"><img src=\"" + Static_Resources_Gateway.Minussign_Png + "\" alt=\"\" style=\"vertical-align:middle\" /><span id=\"addbuttonspan\">" + remove_text + "</span></span>");
}
else
{
// Determine the URL
string add_item_form_open_url = UI_ApplicationCache_Gateway.Settings.Servers.Engine_URL + "items/html/bookshelf/" + CurrentUser.UserID + "/" + CurrentItem.BibID + "/" + CurrentItem.VID;
Output.WriteLine("\t\t<span id=\"addbuttonitem\" class=\"action-sf-menu-item\" onclick=\"add_item_form_open('" + add_item_form_open_url + "');return false;\"><img src=\"" + Static_Resources_Gateway.Plussign_Png + "\" alt=\"\" style=\"vertical-align:middle\" /><span id=\"addbuttonspan\">" + add_text + "</span></span>");
}
}
}
else
{
Output.WriteLine("\t\t<span id=\"sendbuttonitem\" class=\"action-sf-menu-item\" onclick=\"window.location='" + logOnUrl + "';return false;\"><img src=\"" + Static_Resources_Gateway.Email_Png + "\" alt=\"\" style=\"vertical-align:middle\" /><span id=\"sendbuttonspan\">" + send_text + "</span></span>");
if ((CurrentItem.Web != null) && (CurrentItem.Web.ItemID > 0))
Output.WriteLine("\t\t<span id=\"addbuttonitem\" class=\"action-sf-menu-item\" onclick=\"window.location='" + logOnUrl + "';return false;\"><img src=\"" + Static_Resources_Gateway.Plussign_Png + "\" alt=\"\" style=\"vertical-align:middle\" /><span id=\"addbuttonspan\">" + add_text + "</span></span>");
}
string share_item_form_open_url = UI_ApplicationCache_Gateway.Settings.Servers.Engine_URL + "items/html/share/" + CurrentItem.BibID + "/" + CurrentItem.VID;
//.........这里部分代码省略.........
示例5: QC_ItemViewer
/// <summary> Constructor for a new instance of the QC_ItemViewer class, used to perform quality control and
/// create the structural metadata ( page names and divisions ) for an online digital resource </summary>
/// <param name="BriefItem"> Digital resource object </param>
/// <param name="CurrentUser"> Current user, who may or may not be logged on </param>
/// <param name="CurrentRequest"> Information about the current request </param>
/// <param name="Tracer"> Trace object keeps a list of each method executed and important milestones in rendering </param>
public QC_ItemViewer(BriefItemInfo BriefItem, User_Object CurrentUser, Navigation_Object CurrentRequest, Custom_Tracer Tracer )
{
// Save the arguments for use later
this.BriefItem = BriefItem;
this.CurrentUser = CurrentUser;
this.CurrentRequest = CurrentRequest;
// If there is no user, send to the login
if (CurrentUser == null)
{
CurrentRequest.Mode = Display_Mode_Enum.My_Sobek;
CurrentRequest.My_Sobek_Type = My_Sobek_Type_Enum.Logon;
UrlWriterHelper.Redirect(CurrentRequest);
return;
}
// If the user cannot edit this item, go back
if (!CurrentUser.Can_Edit_This_Item(BriefItem.BibID, BriefItem.Type, BriefItem.Behaviors.Source_Institution_Aggregation, BriefItem.Behaviors.Holding_Location_Aggregation, BriefItem.Behaviors.Aggregation_Code_List))
{
CurrentRequest.ViewerCode = String.Empty;
UrlWriterHelper.Redirect(CurrentRequest);
return;
}
//If there are no pages for this item, redirect to the image upload screen
if ((BriefItem.Images == null ) || ( BriefItem.Images.Count == 0 ))
{
CurrentRequest.Mode = Display_Mode_Enum.My_Sobek;
CurrentRequest.My_Sobek_Type = My_Sobek_Type_Enum.Page_Images_Management;
UrlWriterHelper.Redirect(CurrentRequest);
return;
}
// Get the links for the METS
string greenstoneLocation = BriefItem.Web.Source_URL + "/";
complete_mets = greenstoneLocation + BriefItem.BibID + "_" + BriefItem.VID + ".mets.xml";
// MAKE THIS USE THE FILES.ASPX WEB PAGE if this is restricted (or dark)
if ((BriefItem.Behaviors.Dark_Flag) || (BriefItem.Behaviors.IP_Restriction_Membership > 0))
{
complete_mets = CurrentRequest.Base_URL + "files/" + BriefItem.BibID + "/" + BriefItem.VID + "/" + BriefItem.BibID + "_" + BriefItem.VID + ".mets.xml";
}
// Get the special qc_item, which matches the passed in Current_Object, at least the first time.
// If the QC work is already in process, we may find a temporary METS file to read.
// Determine the in process directory for this
userInProcessDirectory = UI_ApplicationCache_Gateway.Settings.Servers.In_Process_Submission_Location + "\\" + CurrentUser.UserName.Replace(".", "").Replace("@", "") + "\\qcwork\\" + BriefItem.BibID + "_" + BriefItem.VID;
if (CurrentUser.ShibbID.Trim().Length > 0)
userInProcessDirectory = UI_ApplicationCache_Gateway.Settings.Servers.In_Process_Submission_Location + "\\" + CurrentUser.ShibbID + "\\qcwork\\" + BriefItem.BibID + "_" + BriefItem.VID;
// Make the folder for the user in process directory
if (!Directory.Exists(userInProcessDirectory))
Directory.CreateDirectory(userInProcessDirectory);
// Create the name for the tempoary METS file?
metsInProcessFile = userInProcessDirectory + "\\" + BriefItem.BibID + "_" + BriefItem.VID + ".mets.xml";
// Is this work in the user's SESSION state?
qc_item = HttpContext.Current.Session[BriefItem.BibID + "_" + BriefItem.VID + " QC Work"] as SobekCM_Item;
if (qc_item == null)
{
//// Try to pull the full item
//Tracer.Add_Trace("Edit_Item_Behaviors_MySobekViewer.Constructor", "Try to pull this sobek complete item");
//qc_item = SobekEngineClient.Items.Get_Sobek_Item(BriefItem.BibID, BriefItem.VID, CurrentUser.UserID, Tracer);
//if (qc_item == null)
//{
// Tracer.Add_Trace("Edit_Item_Behaviors_MySobekViewer.Constructor", "Unable to build complete item");
// CurrentRequest.Mode = Display_Mode_Enum.Error;
// CurrentRequest.Error_Message = "Invalid Request : Unable to build complete item";
// return;
//}
////Save to the User's session
//HttpContext.Current.Session[BriefItem.BibID + "_" + BriefItem.VID + " QC Work"] = qc_item;
// Is there a temporary METS for this item, which is not expired?
if ((File.Exists(metsInProcessFile)) &&
(File.GetLastWriteTime(metsInProcessFile).Subtract(DateTime.Now).Hours < 8))
{
// Read the temporary METS file, and use that to build the qc_item
qc_item = SobekCM_Item_Factory.Get_Item(metsInProcessFile, BriefItem.BibID, BriefItem.VID, null, Tracer);
qc_item.Source_Directory = SobekFileSystem.Resource_Network_Uri(BriefItem);
}
else
{
// Just read the normal otherwise ( if we had the ability to deep copy a SobekCM_Item, we could skip this )
qc_item = SobekCM_Item_Factory.Get_Item(BriefItem.BibID, BriefItem.VID, null, Tracer);
}
// Save to the session, so it is easily available for next time
HttpContext.Current.Session[BriefItem.BibID + "_" + BriefItem.VID + " QC Work"] = qc_item;
}
//.........这里部分代码省略.........