// To enable Forms/Windows Authentication for the Web Application, edit the appropriate section of web.config file. protected override User GetAuthenticatedUser(IPrincipal principal) { using (documentmanagerEntities documentmanagerEntities = new documentmanagerEntities()) { User user = new User(); LocalServerService lLocalService = new LocalServerService(); user.ExpireDay = lLocalService.GetExpireDay(); try { var result = from r in documentmanagerEntities.user where r.user_name == principal.Identity.Name select r; if (result.Count() > 0) { DocumentManager.Web.Model.user lUser = result.First(); user.UserID = lUser.user_id; user.Name = lUser.user_name; user.Password = lUser.user_password; user.UserName = lUser.user_cname; user.RightDictionary = new Dictionary <int, bool>(); if (user.UserID != 1) { var resultaction = from r in documentmanagerEntities.useraction where r.user_id == lUser.user_id select r; if (resultaction.Count() > 0) { foreach (DocumentManager.Web.Model.useraction useraction in resultaction) { user.RightDictionary.Add(useraction.action_id.Value, useraction.hasRight.Value); } } } else { var resultaction = from r in documentmanagerEntities.action select r; if (resultaction.Count() > 0) { foreach (DocumentManager.Web.Model.action action in resultaction) { user.RightDictionary.Add(action.action_id, true); } } } } } catch (System.Exception ex) { } return(user); } }
/// <summary> /// Deprecated Method for adding a new object to the user EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// </summary> public void AddTouser(user user) { base.AddObject("user", user); }
/// <summary> /// Create a new user object. /// </summary> /// <param name="user_id">Initial value of the user_id property.</param> public static user Createuser(global::System.Int32 user_id) { user user = new user(); user.user_id = user_id; return user; }