public static Template MakeNew(string Name, BusinessLogic.User u, Template master) { //ensure unique alias if (GetByAlias(Name) != null) { Name = EnsureUniqueAlias(Name, 1); } Template t = MakeNew(Name, u); t.MasterTemplate = master.Id; t.Design = ""; if (UmbracoSettings.UseAspNetMasterPages) { string design = t.getMasterPageHeader() + "\n"; foreach (string cpId in master.contentPlaceholderIds()) { design += "<asp:content ContentPlaceHolderId=\"" + cpId + "\" runat=\"server\">\n\t\n</asp:content>\n\n"; } t.Design = design; } t.Save(); return(t); }
public static StyleSheet MakeNew(BusinessLogic.User user, string Text, string FileName, string Content) { if (FileName.IsNullOrWhiteSpace()) { FileName = Text.EnsureEndsWith(".css"); } // validate if node ends with css, if it does we'll remove it as we append it later if (Text.ToLowerInvariant().EndsWith(".css")) { Text = Text.TrimEnd(".css"); } var newSheet = new Stylesheet(FileName) { Content = Content }; ApplicationContext.Current.Services.FileService.SaveStylesheet(newSheet); var newCss = new StyleSheet(newSheet); var e = new NewEventArgs(); newCss.OnNew(e); return(newCss); }
public static StylesheetProperty MakeNew(string Text, StyleSheet sheet, BusinessLogic.User user) { CMSNode newNode = CMSNode.MakeNew(sheet.Id, moduleObjectType, user.Id, 2, Text, Guid.NewGuid()); Microsoft.ApplicationBlocks.Data.SqlHelper.ExecuteNonQuery(_ConnString, CommandType.Text, "Insert into cmsStylesheetProperty (nodeId,stylesheetPropertyAlias,stylesheetPropertyValue) values ('" + newNode.Id + "','" + Text + "','')"); return(new StylesheetProperty(newNode.Id)); }
public int create(templateCarrier carrier, string username, string password) { Authenticate(username, password); if (carrier.Id != 0) { throw new Exception("ID may not be specified when creating"); } if (carrier == null) { throw new Exception("No carrier specified"); } // Get the user BusinessLogic.User user = GetUser(username, password); // Create template var template = cms.businesslogic.template.Template.MakeNew(carrier.Name, user); template.MasterTemplate = carrier.MastertemplateId; template.Alias = carrier.Alias; template.Text = carrier.Name; template.Design = carrier.Design; template.Save(); ClearCachedTemplate(template); return(template.Id); }
public override void DoHandleMedia(Media media, PostedMediaFile postedFile, BusinessLogic.User user) { // Get Image object, width and height var image = System.Drawing.Image.FromStream(postedFile.InputStream); var fileWidth = image.Width; var fileHeight = image.Height; // Get umbracoFile property var propertyId = media.getProperty("umbracoFile").Id; // Get paths var destFileName = ConstructDestFileName(propertyId, postedFile.FileName); var destPath = ConstructDestPath(propertyId); var destFilePath = VirtualPathUtility.Combine(destPath, destFileName); var ext = VirtualPathUtility.GetExtension(destFileName).Substring(1); var absoluteDestPath = HttpContext.Current.Server.MapPath(destPath); var absoluteDestFilePath = HttpContext.Current.Server.MapPath(destFilePath); // Set media properties media.getProperty("umbracoFile").Value = destFilePath; media.getProperty("umbracoWidth").Value = fileWidth; media.getProperty("umbracoHeight").Value = fileHeight; media.getProperty("umbracoBytes").Value = postedFile.ContentLength; if (media.getProperty("umbracoExtension") != null) { media.getProperty("umbracoExtension").Value = ext; } if (media.getProperty("umbracoExtensio") != null) { media.getProperty("umbracoExtensio").Value = ext; } // Create directory if (UmbracoSettings.UploadAllowDirectories) { Directory.CreateDirectory(absoluteDestPath); } // Generate thumbnail var thumbDestFilePath = Path.Combine(absoluteDestPath, Path.GetFileNameWithoutExtension(destFileName) + "_thumb"); GenerateThumbnail(image, 100, fileWidth, fileHeight, thumbDestFilePath + ".jpg"); // Generate additional thumbnails based on PreValues set in DataTypeDefinition uploadField GenerateAdditionalThumbnails(image, fileWidth, fileHeight, thumbDestFilePath); image.Dispose(); // Save file postedFile.SaveAs(absoluteDestFilePath); // Close stream postedFile.InputStream.Close(); // Save media media.Save(); }
public static Template MakeNew(string name, BusinessLogic.User u) { // CMSNode MakeNew(int parentId, Guid objectType, int userId, int level, string text, Guid uniqueID) CMSNode n = CMSNode.MakeNew(-1, _objectType, u.Id, 1, name, Guid.NewGuid()); //ensure unique alias name = helpers.Casing.SafeAlias(name); if (GetByAlias(name) != null) { name = EnsureUniqueAlias(name, 1); } name = name.Replace("/", ".").Replace("\\", ""); if (name.Length > 100) { name = name.Substring(0, 95) + "..."; } SqlHelper.ExecuteNonQuery("INSERT INTO cmsTemplate (NodeId, Alias, design, master) VALUES (@nodeId, @alias, @design, @master)", SqlHelper.CreateParameter("@nodeId", n.Id), SqlHelper.CreateParameter("@alias", name), SqlHelper.CreateParameter("@design", ' '), SqlHelper.CreateParameter("@master", DBNull.Value)); Template t = new Template(n.Id); NewEventArgs e = new NewEventArgs(); t.OnNew(e); return(t); }
public async Task <ActionResult> Index(LoginViewModel user) { try { if (!ModelState.IsValid) { return(View()); } var businessUser = new BusinessLogic.User { Email = user.Email, Password = user.Password }; var dbuser = await _repository.GetAsync(businessUser); HttpContext.Session.SetString("Email", businessUser.Email); return(RedirectToAction("Index", "Home")); } catch { return(RedirectToAction(nameof(Index))); } }
public static Media MakeNew(string Name, MediaType dct, BusinessLogic.User u, int ParentId) { var e = new NewEventArgs(); OnNewing(e); if (e.Cancel) { return(null); } var media = ApplicationContext.Current.Services.MediaService.CreateMedia(Name, ParentId, dct.Alias, u.Id); //The media object will only have the 'WasCancelled' flag set to 'True' if the 'Creating' event has been cancelled if (((Entity)media).WasCancelled) { return(null); } ApplicationContext.Current.Services.MediaService.Save(media); var tmp = new Media(media); tmp.OnNew(e); return(tmp); }
/// <summary> /// Create a new MemberGroup /// </summary> /// <param Name="Name">The Name of the MemberGroup</param> /// <param Name="u">The creator of the MemberGroup</param> /// <returns>The new MemberGroup</returns> public static MemberGroup MakeNew(string Name, BusinessLogic.User u) { Guid newId = Guid.NewGuid(); CMSNode.MakeNew(-1, _objectType, u.Id, 1, Name, newId); return(new MemberGroup(newId)); }
private static Template MakeNew(string Name, BusinessLogic.User u, Template master, string design) { Template t = MakeNew(Name, u, design); t.MasterTemplate = master.Id; t.Save(); return(t); }
public bool ValidateUser(string username, string password) { if (ValidateCredentials(username, password)) { var u = new BusinessLogic.User(username); BasePage.doLogin(u); return true; } return false; }
public static StyleSheet MakeNew(BusinessLogic.User user, string Text, string FileName, string Content) { // Create the Umbraco node CMSNode newNode = CMSNode.MakeNew(-1, moduleObjectType, user.Id, 1, Text, Guid.NewGuid()); // Create the stylesheet data Microsoft.ApplicationBlocks.Data.SqlHelper.ExecuteNonQuery(_ConnString, CommandType.Text, "insert into cmsStylesheet (nodeId, filename, content) values ('" + newNode.Id.ToString() + "','" + FileName + "',@content)", new SqlParameter("@content", Content)); return(new StyleSheet(newNode.UniqueId)); }
/// <summary> /// Creates a new datatypedefinition given its Name and the user which creates it. /// </summary> /// <param Name="u">The user who creates the datatypedefinition</param> /// <param Name="Text">The Name of the DataTypeDefinition</param> /// <returns></returns> public static DataTypeDefinition MakeNew(BusinessLogic.User u, string Text) { int newId = CMSNode.MakeNew(-1, _objectType, u.Id, 1, Text, Guid.NewGuid()).Id; Cms.BusinessLogic.datatype.controls.Factory f = new Cms.BusinessLogic.datatype.controls.Factory(); Guid FirstControlId = f.GetAll()[0].Id; Microsoft.ApplicationBlocks.Data.SqlHelper.ExecuteNonQuery(_ConnString, CommandType.Text, "Insert into cmsDataType (nodeId, controlId, dbType) values (" + newId.ToString() + ",'" + FirstControlId.ToString() + "','Ntext')"); return(new DataTypeDefinition(newId)); }
public bool ValidateUser(string username, string password) { if (ValidateCredentials(username, password)) { var u = new BusinessLogic.User(username); BasePage.doLogin(u); return(true); } return(false); }
public override bool Completed() { BusinessLogic.User u = BusinessLogic.User.GetUser(0); if (u.NoConsole || u.Disabled) return true; if (u.GetPassword() != "default") return true; return false; }
public static void UpdateCruds(BusinessLogic.User User, Cms.BusinessLogic.CMSNode Node, string Permissions) { // delete all settings on the node for this user Microsoft.ApplicationBlocks.Data.SqlHelper.ExecuteNonQuery(GlobalSettings.DbDSN, CommandType.Text, "delete from umbracoUser2NodePermission where userId = @userId and nodeId = @nodeId", new SqlParameter("@userId", User.Id), new SqlParameter("@nodeId", Node.Id)); // Loop through the permissions and create them foreach (char c in Permissions.ToCharArray()) { MakeNew(User, Node, c); } }
public static StylesheetProperty MakeNew(string Text, StyleSheet sheet, BusinessLogic.User user) { var newNode = CMSNode.MakeNew(sheet.Id, ModuleObjectType, user.Id, 2, Text, Guid.NewGuid()); SqlHelper.ExecuteNonQuery(String.Format("Insert into cmsStylesheetProperty (nodeId,stylesheetPropertyAlias,stylesheetPropertyValue) values ('{0}','{1}','')", newNode.Id, Text)); var ssp = new StylesheetProperty(newNode.Id); var e = new NewEventArgs(); ssp.OnNew(e); return(ssp); }
/// <summary> /// Create a new MemberType /// </summary> /// <param Name="Text">The Name of the MemberType</param> /// <param Name="u">Creator of the MemberType</param> public static MemberType MakeNew(BusinessLogic.User u, string Text) { int ParentId = -1; int level = 1; Guid uniqueId = Guid.NewGuid(); CMSNode n = CMSNode.MakeNew(ParentId, _objectType, u.Id, level, Text, uniqueId); ContentType.Create(n.Id, Text, ""); return(new MemberType(n.Id)); }
private static Template MakeNew(string name, BusinessLogic.User u, Template master, string design) { // CMSNode MakeNew(int parentId, Guid objectType, int userId, int level, string text, Guid uniqueID) CMSNode n = CMSNode.MakeNew(-1, _objectType, u.Id, 1, name, Guid.NewGuid()); //ensure unique alias name = helpers.Casing.SafeAlias(name); if (GetByAlias(name) != null) { name = EnsureUniqueAlias(name, 1); } name = name.Replace("/", ".").Replace("\\", ""); if (name.Length > 100) { name = name.Substring(0, 95) + "..."; } SqlHelper.ExecuteNonQuery("INSERT INTO cmsTemplate (NodeId, Alias, design, master) VALUES (@nodeId, @alias, @design, @master)", SqlHelper.CreateParameter("@nodeId", n.Id), SqlHelper.CreateParameter("@alias", name), SqlHelper.CreateParameter("@design", ' '), SqlHelper.CreateParameter("@master", DBNull.Value)); Template t = new Template(n.Id); NewEventArgs e = new NewEventArgs(); t.OnNew(e); if (master != null) { t.MasterTemplate = master.Id; } switch (DetermineRenderingEngine(t, design)) { case RenderingEngine.Mvc: ViewHelper.CreateViewFile(t, true); break; case RenderingEngine.WebForms: MasterPageHelper.CreateMasterPage(t, true); break; } //if a design is supplied ensure it is updated. if (!design.IsNullOrWhiteSpace()) { t.ImportDesign(design); } return(t); }
public static StylesheetProperty MakeNew(string Text, StyleSheet sheet, BusinessLogic.User user) { CMSNode newNode = CMSNode.MakeNew(sheet.Id, moduleObjectType, user.Id, 2, Text, Guid.NewGuid()); SqlHelper.ExecuteNonQuery("Insert into cmsStylesheetProperty (nodeId,stylesheetPropertyAlias,stylesheetPropertyValue) values ('" + newNode.Id + "','" + Text + "','')"); StylesheetProperty ssp = new StylesheetProperty(newNode.Id); NewEventArgs e = new NewEventArgs(); ssp.OnNew(e); return(ssp); }
/// <summary> /// Maps active directory account to umbraco user account /// </summary> /// <param name="loginName">Name of the login.</param> private void ActiveDirectoryMapping(string loginName, string email) { // Password is not copied over because it is stored in active directory for security! // The user is create with default access to content and as a writer user type if (BusinessLogic.User.getUserId(loginName) == -1) { BusinessLogic.User.MakeNew(loginName, loginName, string.Empty, email, BusinessLogic.UserType.GetUserType(2)); BusinessLogic.User u = new BusinessLogic.User(loginName); u.addApplication("content"); } }
/// <summary> /// Create a new MemberGroup /// </summary> /// <param name="Name">The name of the MemberGroup</param> /// <param name="u">The creator of the MemberGroup</param> /// <returns>The new MemberGroup</returns> public static MemberGroup MakeNew(string Name, BusinessLogic.User u) { Guid newId = Guid.NewGuid(); CMSNode.MakeNew(-1, _objectType, u.Id, 1, Name, newId); MemberGroup mg = new MemberGroup(newId); NewEventArgs e = new NewEventArgs(); mg.OnNew(e); return(mg); }
public static Template MakeNew(string Name, BusinessLogic.User u) { // CMSNode MakeNew(int parentId, Guid objectType, int userId, int level, string text, Guid uniqueId) CMSNode n = CMSNode.MakeNew(-1, _objectType, u.Id, 1, Name, Guid.NewGuid()); if (Name.Length > 100) { Name = Name.Substring(0, 95) + "..."; } Microsoft.ApplicationBlocks.Data.SqlHelper.ExecuteNonQuery(_ConnString, CommandType.Text, "Insert into cmsTemplate (NodeId, Alias, design,master) Values (" + n.Id + ",'" + SqlHelper.SafeString(Name) + "',' ',0)"); return(new Template(n.Id)); }
/// <summary> /// Creates a new Media /// </summary> /// <param Name="Name">The Name of the media</param> /// <param Name="dct">The type of the media</param> /// <param Name="u">The user creating the media</param> /// <param Name="ParentId">The id of the folder under which the media is created</param> /// <returns></returns> public static Media MakeNew(string Name, MediaType dct, BusinessLogic.User u, int ParentId) { Guid newId = Guid.NewGuid(); // Updated to match level from base node CMSNode n = new CMSNode(ParentId); int newLevel = n.Level; newLevel++; CMSNode.MakeNew(ParentId, _objectType, u.Id, newLevel, Name, newId); Media tmp = new Media(newId); tmp.CreateContent(dct); return(tmp); }
public static StylesheetProperty MakeNew(string Text, StyleSheet sheet, BusinessLogic.User user) { //we need to create it with a temp place holder! var prop = new Umbraco.Core.Models.StylesheetProperty(Text, "#" + Text.ToSafeAlias(), ""); sheet.StylesheetEntity.AddProperty(prop); ApplicationContext.Current.Services.FileService.SaveStylesheet(sheet.StylesheetEntity); var ssp = new StylesheetProperty(sheet.StylesheetEntity, prop); var e = new NewEventArgs(); ssp.OnNew(e); return(ssp); }
/// <summary> /// Create a new MemberGroup /// </summary> /// <param name="Name">The name of the MemberGroup</param> /// <param name="u">The creator of the MemberGroup</param> /// <returns>The new MemberGroup</returns> public static MemberGroup MakeNew(string Name, BusinessLogic.User u) { var group = new global::Umbraco.Core.Models.MemberGroup { Name = Name }; ApplicationContext.Current.Services.MemberGroupService.Save(group); var mg = new MemberGroup(group); var e = new NewEventArgs(); mg.OnNew(e); return(mg); }
public static DataTypeDefinition Import(XmlNode xmlData) { string _name = xmlData.Attributes["Name"].Value; string _id = xmlData.Attributes["Id"].Value; string _def = xmlData.Attributes["Definition"].Value; //Make sure that the dtd is not already present if (!CMSNode.IsNode(new Guid(_def)) ) { BusinessLogic.User u = umbraco.BusinessLogic.User.GetCurrent(); if (u == null) { u = BusinessLogic.User.GetUser(0); } cms.businesslogic.datatype.controls.Factory f = new umbraco.cms.businesslogic.datatype.controls.Factory(); DataTypeDefinition dtd = MakeNew(u, _name, new Guid(_def)); var dataType = f.DataType(new Guid(_id)); if (dataType == null) { throw new NullReferenceException("Could not resolve a data type with id " + _id); } dtd.DataType = dataType; dtd.Save(); //add prevalues foreach (XmlNode xmlPv in xmlData.SelectNodes("PreValues/PreValue")) { XmlAttribute val = xmlPv.Attributes["Value"]; if (val != null) { PreValue p = new PreValue(0, 0, val.Value); p.DataTypeId = dtd.Id; p.Save(); } } return(dtd); } return(null); }
public bool ValidateUser(string username, string password) { if (System.Web.Security.Membership.Providers[UmbracoSettings.DefaultBackofficeProvider].ValidateUser( username, password)) { BusinessLogic.User u = new BusinessLogic.User(username); BasePage.doLogin(u); return(true); } else { return(false); } }
/// <summary> /// Create a new Mediatype /// </summary> /// <param name="u">The Umbraco user context</param> /// <param name="Text">The name of the MediaType</param> /// <returns>The new MediaType</returns> public static MediaType MakeNew(BusinessLogic.User u, string Text) { int ParentId = -1; int level = 1; Guid uniqueId = Guid.NewGuid(); CMSNode n = CMSNode.MakeNew(ParentId, _objectType, u.Id, level, Text, uniqueId); ContentType.Create(n.Id, Text, ""); MediaType mt = new MediaType(n.Id); NewEventArgs e = new NewEventArgs(); mt.OnNew(e); return(mt); }
internal static MediaType MakeNew(BusinessLogic.User u, string text, int parentId) { var mediaType = new Umbraco.Core.Models.MediaType(parentId) { Name = text, Alias = text, CreatorId = u.Id, Thumbnail = "folder.png", Icon = "folder.gif" }; ApplicationContext.Current.Services.ContentTypeService.Save(mediaType, u.Id); var mt = new MediaType(mediaType.Id); NewEventArgs e = new NewEventArgs(); mt.OnNew(e); return(mt); }
public override bool Completed() { BusinessLogic.User u = BusinessLogic.User.GetUser(0); if (u.NoConsole || u.Disabled) { return(true); } if (u.GetPassword() != "default") { return(true); } return(false); }
public bool ValidateUser(string username, string password) { if (System.Web.Security.Membership.Providers[UmbracoSettings.DefaultBackofficeProvider].ValidateUser( username, password)) { BusinessLogic.User u = new BusinessLogic.User(username); BasePage.doLogin(u); return true; } else { return false; } }
public ActionResult Create(UserCreate users) { if (ModelState.IsValid) { BusinessLogic.User _u = new BusinessLogic.User { Name = users.Name, Role_id = users.Role_id, Password = users.Password }; _u.Save(); return RedirectToAction("LogOn"); } return View(users); }
public static void Save(PackageInstance package, string dataSource) { try { Reload(dataSource); XmlNode _xmlDef = GetFromId(package.Id, dataSource, false); _xmlDef.Attributes.GetNamedItem("name").Value = package.Name; _xmlDef.Attributes.GetNamedItem("version").Value = package.Version; _xmlDef.Attributes.GetNamedItem("url").Value = package.Url; _xmlDef.Attributes.GetNamedItem("packagepath").Value = package.PackagePath; _xmlDef.Attributes.GetNamedItem("repositoryGuid").Value = package.RepositoryGuid; _xmlDef.Attributes.GetNamedItem("packageGuid").Value = package.PackageGuid; _xmlDef.Attributes.GetNamedItem("hasUpdate").Value = package.HasUpdate.ToString(); _xmlDef.Attributes.GetNamedItem("enableSkins").Value = package.EnableSkins.ToString(); _xmlDef.Attributes.GetNamedItem("skinRepoGuid").Value = package.SkinRepoGuid.ToString(); _xmlDef.SelectSingleNode("license").FirstChild.Value = package.License; _xmlDef.SelectSingleNode("license").Attributes.GetNamedItem("url").Value = package.LicenseUrl; _xmlDef.SelectSingleNode("author").InnerText = package.Author; _xmlDef.SelectSingleNode("author").Attributes.GetNamedItem("url").Value = package.AuthorUrl; _xmlDef.SelectSingleNode("readme").InnerXml = "<![CDATA[" + package.Readme + "]]>"; if(_xmlDef.SelectSingleNode("actions") == null) _xmlDef.AppendChild(xmlHelper.addTextNode(Source, "actions", "")); _xmlDef.SelectSingleNode("actions").InnerXml = package.Actions; _xmlDef.SelectSingleNode("content").Attributes.GetNamedItem("nodeId").Value = package.ContentNodeId.ToString(); _xmlDef.SelectSingleNode("content").Attributes.GetNamedItem("loadChildNodes").Value = package.ContentLoadChildNodes.ToString(); _xmlDef.SelectSingleNode("macros").InnerText = joinList(package.Macros, ','); _xmlDef.SelectSingleNode("templates").InnerText = joinList(package.Templates, ','); _xmlDef.SelectSingleNode("stylesheets").InnerText = joinList(package.Stylesheets, ','); _xmlDef.SelectSingleNode("documenttypes").InnerText = joinList(package.Documenttypes, ','); _xmlDef.SelectSingleNode("languages").InnerText = joinList(package.Languages, ','); _xmlDef.SelectSingleNode("dictionaryitems").InnerText = joinList(package.DictionaryItems, ','); _xmlDef.SelectSingleNode("datatypes").InnerText = joinList(package.DataTypes, ','); _xmlDef.SelectSingleNode("files").InnerXml = ""; foreach (string fileStr in package.Files) { if(!string.IsNullOrEmpty(fileStr.Trim())) _xmlDef.SelectSingleNode("files").AppendChild(xmlHelper.addTextNode(data.Source, "file", fileStr)); } _xmlDef.SelectSingleNode("loadcontrol").InnerText = package.LoadControl; Source.Save(dataSource); } catch(Exception F) { BusinessLogic.User myUser = new BusinessLogic.User(0); BusinessLogic.Log.Add(BusinessLogic.LogTypes.Error, myUser, 0, F.ToString()); } }
bool Authenticate() { Dat.V1.Utils.Security.Token.TokenGenerator token = null; Guid userGuid = Guid.Empty; BusinessLogic.User _user = new BusinessLogic.User(); AnonymousRole = new BusinessLogic.Role(); AnonymousRole.ByRoleName("anonymous"); if (string.IsNullOrWhiteSpace(Resource.AuthenticationToken)) { if (_user.ByEmailAddress("*****@*****.**")) token = new Dat.V1.Utils.Security.Token.TokenGenerator(_user.UserGuid.ToString(), DateTime.Now.AddDays(1)); else throw new Exceptions.HttpModulesException(System.Net.HttpStatusCode.NotFound, "Account not found."); } else token = Dat.V1.Utils.Security.Token.TokenGenerator.FromTokenString(Resource.AuthenticationToken, Dat.V1.Utils.Security.Token.TokenGenerator.PrivateKey); if (token == null) throw new Dat.V1.Framework.HttpModules.Exceptions.HttpModulesException(System.Net.HttpStatusCode.BadRequest, "Invalid token"); //else if (token.Expires <= DateTime.Now) // throw new Dat.V1.Utils.Security.Exceptions.TokenException(Errors.TokenExpired); else if (string.IsNullOrWhiteSpace(token.Value) || !Guid.TryParse(token.Value, out userGuid) || userGuid == Guid.Empty) throw new Dat.V1.Framework.HttpModules.Exceptions.HttpModulesException(System.Net.HttpStatusCode.BadRequest, "Invalid token"); else if (!_user.ByUserGuid(userGuid)) throw new Dat.V1.Framework.HttpModules.Exceptions.HttpModulesException(System.Net.HttpStatusCode.InternalServerError, "Retrieving user failed."); else if (_user.UserId < 1 | _user.UserGuid == Guid.Empty) throw new Dat.V1.Framework.HttpModules.Exceptions.HttpModulesException(System.Net.HttpStatusCode.NotFound, "Account not found."); else { LoggedInUser = _user; Resource.AuthenticatedUser = _user.UserGuid; Resource.IsAnonymous = IsAnonymous; return true; } throw new Dat.V1.Framework.HttpModules.Exceptions.HttpModulesException(System.Net.HttpStatusCode.PreconditionFailed, "Authentication Failed."); }