当前位置: 首页>>代码示例>>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;未经允许,请勿转载。