本文整理汇总了C#中SobekCM.Core.Users.User_Object.Set_Value_By_Mapping方法的典型用法代码示例。如果您正苦于以下问题:C# User_Object.Set_Value_By_Mapping方法的具体用法?C# User_Object.Set_Value_By_Mapping怎么用?C# User_Object.Set_Value_By_Mapping使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SobekCM.Core.Users.User_Object
的用法示例。
在下文中一共展示了User_Object.Set_Value_By_Mapping方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: perform_user_checks
//.........这里部分代码省略.........
}
}
}
tracer.Add_Trace("SobekCM_Page_Globals.Constructor", "Setting session user from shibboleth id");
possible_user_by_shibboleth_id.Authentication_Type = User_Authentication_Type_Enum.Shibboleth;
HttpContext.Current.Session["user"] = possible_user_by_shibboleth_id;
}
else
{
tracer.Add_Trace("SobekCM_Page_Globals.Constructor", "User from shibboleth id was null.. adding user");
// Now build the user object
User_Object newUser = new User_Object();
if ((HttpContext.Current.Request.ServerVariables["HTTP_PRIMARY-AFFILIATION"] != null) && (HttpContext.Current.Request.ServerVariables["HTTP_PRIMARY-AFFILIATION"].IndexOf("F") >= 0))
newUser.Can_Submit = true;
else
newUser.Can_Submit = false;
newUser.Send_Email_On_Submission = true;
newUser.Email = String.Empty;
newUser.Family_Name = String.Empty;
newUser.Given_Name = String.Empty;
newUser.Organization = String.Empty;
newUser.ShibbID = shibboleth_id;
newUser.UserID = -1;
// Set the user information from the server variables here
foreach (string var in HttpContext.Current.Request.ServerVariables)
{
User_Object_Attribute_Mapping_Enum mapping = UI_ApplicationCache_Gateway.Settings.Authentication.Shibboleth.Get_User_Object_Mapping(var);
if (mapping != User_Object_Attribute_Mapping_Enum.NONE)
{
string value = HttpContext.Current.Request.ServerVariables[var];
newUser.Set_Value_By_Mapping(mapping, value);
if (UI_ApplicationCache_Gateway.Settings.Authentication.Shibboleth.Debug)
{
tracer.Add_Trace("SobekCM_Page_Globals.Constructor", "Server Variable " + var + " ( " + value + " ) mapped to " + User_Object_Attribute_Mapping_Enum_Converter.ToString(mapping));
}
}
else if (UI_ApplicationCache_Gateway.Settings.Authentication.Shibboleth.Debug)
{
tracer.Add_Trace("SobekCM_Page_Globals.Constructor", "Server Variable " + var + " is not mapped to a user attribute");
}
}
// Set any constants as well
foreach (KeyValuePair<User_Object_Attribute_Mapping_Enum, string> constantMapping in UI_ApplicationCache_Gateway.Settings.Authentication.Shibboleth.Constants)
{
if (constantMapping.Key != User_Object_Attribute_Mapping_Enum.NONE)
{
newUser.Set_Value_By_Mapping(constantMapping.Key, constantMapping.Value);
if (UI_ApplicationCache_Gateway.Settings.Authentication.Shibboleth.Debug)
{
tracer.Add_Trace("SobekCM_Page_Globals.Constructor", "Setting constant value ( " + constantMapping.Value + " ) to " + User_Object_Attribute_Mapping_Enum_Converter.ToString(constantMapping.Key));
}
}
}
// Set the username
if (String.IsNullOrEmpty(newUser.UserName))
{
if (newUser.Email.Length > 0)
newUser.UserName = newUser.Email;
else