當前位置: 首頁>>代碼示例>>C#>>正文


C# User_Object.Set_Value_By_Mapping方法代碼示例

本文整理匯總了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
開發者ID:Elkolt,項目名稱:SobekCM-Web-Application,代碼行數:67,代碼來源:SobekCM_Page_Globals.cs


注:本文中的SobekCM.Core.Users.User_Object.Set_Value_By_Mapping方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。