Document most models

This commit is contained in:
ijungleboy 2021-05-21 18:28:21 +02:00
parent e4b12aa87f
commit 074b998bbc
17 changed files with 696 additions and 18 deletions

View File

@ -1,26 +1,65 @@
using System;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations.Schema;
namespace Oqtane.Models
{
/// <summary>
/// An Alias maps a url like `oqtane.my` or `oqtane.my/products` to a <see cref="Oqtane.Models.Site"/> and <see cref="Oqtane.Models.Tenant"/>
/// </summary>
public class Alias : IAuditable
{
/// <summary>
/// The primary ID for internal use. It's also used in API calls to identify the site.
/// </summary>
public int AliasId { get; set; }
/// <summary>
/// The Alias Name = URL.
/// The Name contains the entire path - so it can be `oqtane.me`, `www.oqtane.me` or `oqtane.me/products`
/// </summary>
public string Name { get; set; }
/// <summary>
/// The Tenant this Alias (and the Site) references.
/// It's important, as anything related to the Alias must be requested from a database, which is found by the Tenant it's in.
/// </summary>
public int TenantId { get; set; }
/// <summary>
/// The Site this Alias references.
/// </summary>
public int SiteId { get; set; }
/// <inheritdoc />
public string CreatedBy { get; set; }
/// <inheritdoc />
public DateTime CreatedOn { get; set; }
/// <inheritdoc />
public string ModifiedBy { get; set; }
/// <inheritdoc />
public DateTime ModifiedOn { get; set; }
/// <summary>
/// todoc - unclear what this is for
/// </summary>
[NotMapped]
public DateTime SyncDate { get; set; }
/// <summary>
/// todoc - unclear what this is for
/// </summary>
[NotMapped]
public List<SyncEvent> SyncEvents { get; set; }
/// <summary>
/// The path contains the url-part after the first slash.
/// * If the Name is `oqtane.me` the Path is empty
/// * if the Name is `oqtane.me/products` the Path is `products`
/// </summary>
[NotMapped]
public string Path
{

View File

@ -1,25 +1,82 @@
using System;
using System;
namespace Oqtane.Models
{
/// <summary>
/// Describes a File in Oqtane
/// </summary>
public class File : IAuditable
{
/// <summary>
/// ID to identify the file
/// </summary>
public int FileId { get; set; }
/// <summary>
/// Reference to the <see cref="Folder"/>.
/// Use this if you need to determine what <see cref="Site"/> the file belongs to.
/// </summary>
public int FolderId { get; set; }
/// <summary>
/// Name of the file
/// todo: with extension or not?
/// </summary>
public string Name { get; set; }
/// <summary>
/// File name extension like 'jpg'
/// * Always lower case
/// * Without the dot (.)
/// </summary>
public string Extension { get; set; }
/// <summary>
/// File size
/// </summary>
public int Size { get; set; }
/// <summary>
/// The height of an image (if the file is an image) in pixels.
/// This is calculated at time of Upload, so if the file is manually replaced, the value will be wrong.
/// </summary>
public int ImageHeight { get; set; }
/// <summary>
/// The width of an image (if the file is an image) in pixels.
/// This is calculated at time of Upload, so if the file is manually replaced, the value will be wrong.
/// </summary>
public int ImageWidth { get; set; }
#region IAuditable Properties
/// <inheritdoc />
public string CreatedBy { get; set; }
/// <inheritdoc />
public DateTime CreatedOn { get; set; }
/// <inheritdoc />
public string ModifiedBy { get; set; }
/// <inheritdoc />
public DateTime ModifiedOn { get; set; }
#endregion
#region Extended IAuditable Properties, may be moved to an Interface some day so not documented yet
public string DeletedBy { get; set; }
public DateTime? DeletedOn { get; set; }
public bool IsDeleted { get; set; }
#endregion
/// <summary>
/// Object reference to the <see cref="Folder"/> object.
/// Use this if you need to determine what <see cref="Site"/> the file belongs to.
/// TODO: not sure if this is always populated, must verify and document
/// </summary>
public Folder Folder { get; set; }
}
}

View File

@ -1,30 +1,89 @@
using System;
using System;
using System.ComponentModel.DataAnnotations.Schema;
namespace Oqtane.Models
{
/// <summary>
/// Describes a Folder in Oqtane
/// </summary>
public class Folder : IAuditable
{
/// <summary>
/// ID to identify the folder
/// </summary>
public int FolderId { get; set; }
/// <summary>
/// Reference to the <see cref="Site"/>.
/// </summary>
public int SiteId { get; set; }
/// <summary>
/// Reference to the parent <see cref="Folder"/>, if it has a parent folder.
/// </summary>
public int? ParentId { get; set; }
/// <summary>
/// Folder name
/// </summary>
public string Name { get; set; }
/// <summary>
/// Path to the folder
/// TODO: document from where the path starts
/// </summary>
public string Path { get; set; }
/// <summary>
/// Sorting order of the folder
/// </summary>
public int Order { get; set; }
/// <summary>
/// TODO: unclear what this is for
/// </summary>
public bool IsSystem { get; set; }
#region IAuditable Properties
/// <inheritdoc />
public string CreatedBy { get; set; }
/// <inheritdoc />
public DateTime CreatedOn { get; set; }
/// <inheritdoc />
public string ModifiedBy { get; set; }
/// <inheritdoc />
public DateTime ModifiedOn { get; set; }
#endregion
#region Extended IAuditable Properties, may be moved to an Interface some day so not documented yet
public string DeletedBy { get; set; }
public DateTime? DeletedOn { get; set; }
public bool IsDeleted { get; set; }
#endregion
/// <summary>
/// TODO: todoc what would this contain?
/// </summary>
[NotMapped]
public string Permissions { get; set; }
/// <summary>
/// Folder Depth
/// TODO: todoc Where does this start, so Depth 0 or 1 is where in the file system?
/// </summary>
[NotMapped]
public int Level { get; set; }
/// <summary>
/// Information if this folder has sub-items like more <see cref="Folder"/> or <see cref="File"/> objects
/// </summary>
[NotMapped]
public bool HasChildren { get; set; }
}

View File

@ -2,24 +2,52 @@ using System;
namespace Oqtane.Models
{
/// <summary>
/// Language Information for <see cref="Site"/>s
/// TODO: todoc - unclear how this is different from <see cref="Culture"/>
/// </summary>
public class Language : IAuditable
{
/// <summary>
/// Internal ID
/// </summary>
public int LanguageId { get; set; }
/// <summary>
/// Reference to a <see cref="Site"/>
/// TODO: todoc - unclear why it's nullable
/// </summary>
public int? SiteId { get; set; }
/// <summary>
/// Language Name
/// </summary>
public string Name { get; set; }
/// <summary>
/// Language / Culture code, like 'en-US'
/// </summary>
public string Code { get; set; }
/// <summary>
/// Is this the default language on a <see cref="Site"/>
/// </summary>
public bool IsDefault { get; set; }
#region IAuditable Properties
/// <inheritdoc/>
public string CreatedBy { get; set; }
/// <inheritdoc/>
public DateTime CreatedOn { get; set; }
/// <inheritdoc/>
public string ModifiedBy { get; set; }
/// <inheritdoc/>
public DateTime ModifiedOn { get; set; }
#endregion
}
}

View File

@ -1,23 +1,69 @@
using System;
using System;
namespace Oqtane.Models
{
/// <summary>
/// A log entry in the events log.
/// </summary>
public class Log
{
/// <summary>
/// Internal ID
/// </summary>
public int LogId { get; set; }
/// <summary>
/// Reference to the <see cref="Site"/>
/// </summary>
public int? SiteId { get; set; }
/// <summary>
/// Timestamp
/// </summary>
public DateTime LogDate { get; set; }
/// <summary>
/// Reference to the <see cref="Page"/>
/// </summary>
public int? PageId { get; set; }
/// <summary>
/// Reference to the <see cref="Module"/>
/// </summary>
public int? ModuleId { get; set; }
/// <summary>
/// Reference to the <see cref="User"/>
/// </summary>
public int? UserId { get; set; }
/// <summary>
/// Url if relevant for this log entry.
/// </summary>
public string Url { get; set; }
/// <summary>
/// Name of the server that created this entry
/// </summary>
public string Server { get; set; }
public string Category { get; set; } // usually the full typename of the
public string Feature { get; set; }
public string Function { get; set; }
/// <summary>
/// Log level / severity
/// </summary>
public string Level { get; set; }
/// <summary>
/// Log Message
/// </summary>
public string Message { get; set; }
public string MessageTemplate { get; set; }
/// <summary>
/// Information about raised Exceptions
/// </summary>
public string Exception { get; set; }
public string Properties { get; set; }
}

View File

@ -5,38 +5,75 @@ using System.ComponentModel.DataAnnotations.Schema;
namespace Oqtane.Models
{
/// <summary>
/// Describes a Module _Instance_ which will be shown on a page. This is different from a <see cref="ModuleDefinition"/> which describes a Module.
/// </summary>
public class Module : IAuditable
{
/// <summary>
/// The ID of this instance
/// </summary>
public int ModuleId { get; set; }
/// <summary>
/// Reference to the <see cref="Site"/>
/// </summary>
public int SiteId { get; set; }
/// <summary>
/// Reference to the <see cref="ModuleDefinition"/>
/// </summary>
public string ModuleDefinitionName { get; set; }
/// <summary>
/// Determines if this Module Instance should be shown on all pages of the current <see cref="Site"/>
/// </summary>
public bool AllPages { get; set; }
#region IAuditable Properties
/// <inheritdoc/>
public string CreatedBy { get; set; }
/// <inheritdoc/>
public DateTime CreatedOn { get; set; }
/// <inheritdoc/>
public string ModifiedBy { get; set; }
/// <inheritdoc/>
public DateTime ModifiedOn { get; set; }
#endregion
#region Extended IAuditable Properties, may be moved to an Interface some day so not documented yet
[NotMapped]
public string DeletedBy { get; set; }
[NotMapped]
public DateTime? DeletedOn { get; set; }
[NotMapped]
public bool IsDeleted { get; set; }
#endregion
[NotMapped]
public string Permissions { get; set; }
[NotMapped]
public Dictionary<string, string> Settings { get; set; }
// PageModule properties
#region PageModule properties
[NotMapped]
public int PageModuleId { get; set; }
/// <summary>
/// Reference to the <see cref="Page"/> this module is on.
/// </summary>
[NotMapped]
public int PageId { get; set; }
[NotMapped]
public string Title { get; set; }
/// <summary>
/// The Pane this module is shown in.
/// </summary>
[NotMapped]
public string Pane { get; set; }
[NotMapped]
@ -44,7 +81,10 @@ namespace Oqtane.Models
[NotMapped]
public string ContainerType { get; set; }
// SiteRouter properties
#endregion
#region SiteRouter properties
[NotMapped]
public string ModuleType { get; set; }
[NotMapped]
@ -52,11 +92,20 @@ namespace Oqtane.Models
[NotMapped]
public int PaneModuleCount { get; set; }
// ModuleDefinition
#endregion
#region ModuleDefinition
/// <summary>
/// Reference to the <see cref="ModuleDefinition"/> used for this module.
/// TODO: todoc - unclear if this is always populated
/// </summary>
[NotMapped]
public ModuleDefinition ModuleDefinition { get; set; }
// IModuleControl properties
#endregion
#region IModuleControl properties
// TODO: unclear why these are IModuleControl properties - there is no such interface
[NotMapped]
public SecurityAccessLevel SecurityAccessLevel { get; set; }
[NotMapped]
@ -65,5 +114,7 @@ namespace Oqtane.Models
public string Actions { get; set; }
[NotMapped]
public bool UseAdminContainer { get; set; }
#endregion
}
}

View File

@ -1,10 +1,16 @@
using System;
using System.ComponentModel.DataAnnotations.Schema;
using Oqtane.Documentation;
namespace Oqtane.Models
{
/// <summary>
/// Describes a Module type (Definition) in Oqtane.
/// The available Modules are determined at StartUp.
/// </summary>
public class ModuleDefinition : IAuditable
{
[PrivateApi("The constructor is probably just for internal use and shouldn't appear in the docs")]
public ModuleDefinition()
{
Name = "";
@ -26,18 +32,41 @@ namespace Oqtane.Models
Template = "";
}
/// <summary>
/// Reference to the <see cref="ModuleDefinition"/>.
/// </summary>
public int ModuleDefinitionId { get; set; }
/// <summary>
/// Name of the <see cref="ModuleDefinition"/>
/// </summary>
public string ModuleDefinitionName { get; set; }
/// <summary>
/// Nice name to show in admin / edit dialogs.
/// </summary>
public string Name { get; set; }
/// <summary>
/// Module description for admin dialogs.
/// </summary>
public string Description { get; set; }
public string Categories { get; set; }
public string Version { get; set; }
#region IAuditable Properties
/// <inheritdoc/>
public string CreatedBy { get; set; }
/// <inheritdoc/>
public DateTime CreatedOn { get; set; }
/// <inheritdoc/>
public string ModifiedBy { get; set; }
/// <inheritdoc/>
public DateTime ModifiedOn { get; set; }
#endregion
// additional IModule properties
[NotMapped]
public string Owner { get; set; }

View File

@ -4,33 +4,103 @@ using System.ComponentModel.DataAnnotations.Schema;
namespace Oqtane.Models
{
/// <summary>
/// Describes a Page in Oqtane
/// </summary>
public class Page : IAuditable, IDeletable
{
/// <summary>
/// Id of the Page
/// </summary>
public int PageId { get; set; }
/// <summary>
/// Reference to the <see cref="Site"/>.
/// </summary>
public int SiteId { get; set; }
/// <summary>
/// Reference to the parent <see cref="Page"/> if it has one.
/// </summary>
public int? ParentId { get; set; }
/// <summary>
/// Page Name.
/// TODO: todoc where this is used
/// </summary>
public string Name { get; set; }
/// <summary>
/// Page Title which is shown in the browser tab.
/// </summary>
public string Title { get; set; }
/// <summary>
/// Path of the page.
/// TODO: todoc relative to what? site root, parent-page, domain?
/// </summary>
public string Path { get; set; }
/// <summary>
/// Sort order in the list of other sibling pages
/// </summary>
public int Order { get; set; }
/// <summary>
/// Full URL to this page.
/// TODO: verify that this is the case - does it contain domain etc. or just from domain or alias root?
/// </summary>
public string Url { get; set; }
/// <summary>
/// Reference to a <see cref="Theme"/> which will be used to show this page.
/// </summary>
public string ThemeType { get; set; }
/// <summary>
/// Reference to a Container which will be used for modules on this page.
/// </summary>
public string DefaultContainerType { get; set; }
/// <summary>
/// Icon file for this page.
/// TODO: unclear what this is for, and what icon library is used. Probably FontAwesome?
/// </summary>
public string Icon { get; set; }
public bool IsNavigation { get; set; }
public int? UserId { get; set; }
public bool IsPersonalizable { get; set; }
#region IAuditable Properties
/// <inheritdoc/>
public string CreatedBy { get; set; }
/// <inheritdoc/>
public DateTime CreatedOn { get; set; }
/// <inheritdoc/>
public string ModifiedBy { get; set; }
/// <inheritdoc/>
public DateTime ModifiedOn { get; set; }
#endregion
#region Extended IAuditable Properties, may be moved to an Interface some day so not documented yet
public string DeletedBy { get; set; }
public DateTime? DeletedOn { get; set; }
public bool IsDeleted { get; set; }
#endregion
/// <summary>
/// List of Pane-names which this Page has.
/// </summary>
[NotMapped]
public List<string> Panes { get; set; }
/// <summary>
/// List of <see cref="Resource"/> (CSS, JS) which this page needs to render properly.
/// </summary>
[NotMapped]
public List<Resource> Resources { get; set; }
[NotMapped]
@ -39,9 +109,15 @@ namespace Oqtane.Models
public Dictionary<string, string> Settings { get; set; }
[NotMapped]
public int Level { get; set; }
/// <summary>
/// Determines if there are sub-pages. True if this page has sub-pages.
/// </summary>
[NotMapped]
public bool HasChildren { get; set; }
#region Deprecated Properties
[Obsolete("This property is deprecated", false)]
[NotMapped]
public bool EditMode { get; set; }
@ -50,5 +126,6 @@ namespace Oqtane.Models
[NotMapped]
public string LayoutType { get; set; }
#endregion
}
}

View File

@ -1,26 +1,72 @@
using System;
using System;
namespace Oqtane.Models
{
/// <summary>
/// Information about a <see cref="Module"/> instance on a <see cref="Page"/>
/// </summary>
public class PageModule : IAuditable, IDeletable
{
/// <summary>
/// Internal ID to identify this instance.
/// </summary>
public int PageModuleId { get; set; }
/// <summary>
/// Reference to the <see cref="Page"/>.
/// </summary>
public int PageId { get; set; }
/// <summary>
/// Reference to the <see cref="Module"/>.
/// </summary>
public int ModuleId { get; set; }
/// <summary>
/// Module title. Will be shown in the Container if the container shows titles.
/// </summary>
public string Title { get; set; }
/// <summary>
/// The Pane which this module instance appears.
/// </summary>
public string Pane { get; set; }
/// <summary>
/// The sorting order / position in the Pane where this module appears.
/// </summary>
public int Order { get; set; }
/// <summary>
/// Reference to a Razor Container which wraps this module instance.
/// </summary>
public string ContainerType { get; set; }
#region IAuditable Properties
/// <inheritdoc/>
public string CreatedBy { get; set; }
/// <inheritdoc/>
public DateTime CreatedOn { get; set; }
/// <inheritdoc/>
public string ModifiedBy { get; set; }
/// <inheritdoc/>
public DateTime ModifiedOn { get; set; }
#endregion
#region Extended IAuditable Properties, may be moved to an Interface some day so not documented yet
public string DeletedBy { get; set; }
public DateTime? DeletedOn { get; set; }
public bool IsDeleted { get; set; }
#endregion
/// <summary>
/// The <see cref="Module"/> itself.
/// TODO: todoc - unclear if this is always populated
/// </summary>
public Module Module { get; set; }
}
}

View File

@ -1,19 +1,49 @@
using System;
using System;
namespace Oqtane.Models
{
/// <summary>
/// Describes a Security Role in Oqtane.
/// </summary>
public class Role : IAuditable
{
/// <summary>
/// Primary ID
/// </summary>
public int RoleId { get; set; }
/// <summary>
/// Reference to a <see cref="Site"/> if applicable.
/// </summary>
public int? SiteId { get; set; }
/// <summary>
/// Role name to show in Admin dialogs.
/// </summary>
public string Name { get; set; }
/// <summary>
/// Brief description for Admin dialogs.
/// </summary>
public string Description { get; set; }
/// <summary>
/// Determines if users automatically get assigned to this role.
/// </summary>
public bool IsAutoAssigned { get; set; }
public bool IsSystem { get; set; }
#region IAuditable Properties
/// <inheritdoc/>
public string CreatedBy { get; set; }
/// <inheritdoc/>
public DateTime CreatedOn { get; set; }
/// <inheritdoc/>
public string ModifiedBy { get; set; }
/// <inheritdoc/>
public DateTime ModifiedOn { get; set; }
#endregion
}
}

View File

@ -1,18 +1,48 @@
using System;
using System;
namespace Oqtane.Models
{
/// <summary>
/// A setting for any kind of object like <see cref="Tenant"/>, <see cref="Site"/>, <see cref="Page"/>, <see cref="Module"/> etc.
/// </summary>
public class Setting : IAuditable
{
/// <summary>
/// ID in the Database - mainly used to later update an existing setting.
/// </summary>
public int SettingId { get; set; }
/// <summary>
/// What kind of entity the setting is for, like `Page`, `Site` etc.
/// </summary>
public string EntityName { get; set; }
/// <summary>
/// Id of the Entity we're describing - so it could be `Site` number 2
/// </summary>
public int EntityId { get; set; }
/// <summary>
/// Name of the setting.
/// </summary>
public string SettingName { get; set; }
/// <summary>
/// The value of this Setting. It's always a string, so make sure to convert/cast as needed.
/// </summary>
public string SettingValue { get; set; }
#region IAuditable Properties
/// <inheritdoc/>
public string CreatedBy { get; set; }
/// <inheritdoc/>
public DateTime CreatedOn { get; set; }
/// <inheritdoc/>
public string ModifiedBy { get; set; }
/// <inheritdoc/>
public DateTime ModifiedOn { get; set; }
#endregion
}
}

View File

@ -3,30 +3,81 @@ using System.ComponentModel.DataAnnotations.Schema;
namespace Oqtane.Models
{
/// <summary>
/// Describes a Site in a <see cref="Tenant"/> in an Oqtane installation.
/// Sites can have multiple <see cref="Alias"/>es.
/// </summary>
public class Site : IAuditable, IDeletable
{
/// <summary>
/// Internal ID, not to be confused with the <see cref="Alias.AliasId"/>
/// </summary>
public int SiteId { get; set; }
/// <summary>
/// Reference to the <see cref="Tenant"/> the Site is in
/// </summary>
public int TenantId { get; set; }
/// <summary>
/// The site Name
/// TODO: todoc where this will be used / shown
/// </summary>
public string Name { get; set; }
/// <summary>
/// Reference to a <see cref="File"/> which has the Logo for this site.
/// Should be an image.
/// The theme can then use this where needed.
/// </summary>
public int? LogoFileId { get; set; }
/// <summary>
/// Reference to a <see cref="File"/> which has the FavIcon for this site.
/// Should be an image.
/// The theme can then use this where needed.
/// TODO: todoc does this get applied automatically, or does the Theme do this?
/// </summary>
public int? FaviconFileId { get; set; }
public string DefaultThemeType { get; set; }
public string DefaultContainerType { get; set; }
public string AdminContainerType { get; set; }
public bool PwaIsEnabled { get; set; }
public int? PwaAppIconFileId { get; set; }
public int? PwaSplashIconFileId { get; set; }
/// <summary>
/// Determines if users may register / create accounts
/// </summary>
public bool AllowRegistration { get; set; }
/// <summary>
/// Unique GUID to identify the Site.
/// </summary>
public string SiteGuid { get; set; }
#region IAuditable Properties
/// <inheritdoc/>
public string CreatedBy { get; set; }
/// <inheritdoc/>
public DateTime CreatedOn { get; set; }
/// <inheritdoc/>
public string ModifiedBy { get; set; }
/// <inheritdoc/>
public DateTime ModifiedOn { get; set; }
#endregion
#region Extended IAuditable Properties, may be moved to an Interface some day so not documented yet
public string DeletedBy { get; set; }
public DateTime? DeletedOn { get; set; }
public bool IsDeleted { get; set; }
#endregion
[NotMapped]
public string SiteTemplateType { get; set; }

View File

@ -1,10 +1,14 @@
using System.Collections.Generic;
using System.Collections.Generic;
namespace Oqtane.Models
{
public class SqlQuery
{
/// <summary>
/// Reference to the <see cref="Tenant"/> this belongs to
/// </summary>
public int TenantId { get; set; }
public string Query { get; set; }
public List<Dictionary<string, string>> Results { get; set; }
}

View File

@ -1,17 +1,48 @@
using System;
using System;
namespace Oqtane.Models
{
/// <summary>
/// Describes a Tenant in Oqtane.
/// Tenants can contain multiple <see cref="Site"/>s and have all their data in a separate Database.
/// </summary>
public class Tenant : IAuditable
{
/// <summary>
/// ID of the Tenant.
/// </summary>
public int TenantId { get; set; }
/// <summary>
/// Name of the Tenant to show in Tenant lists.
/// </summary>
public string Name { get; set; }
/// <summary>
/// Connection string to access this Tenant DB.
/// </summary>
public string DBConnectionString { get; set; }
/// <summary>
/// Type of DB used in this Tenant
/// </summary>
/// <remarks>
/// New in v2.1.0
/// </remarks>
public string DBType { get; set; }
public string Version { get; set; }
#region IAuditable Properties
/// <inheritdoc/>
public string CreatedBy { get; set; }
/// <inheritdoc/>
public DateTime CreatedOn { get; set; }
/// <inheritdoc/>
public string ModifiedBy { get; set; }
/// <inheritdoc/>
public DateTime ModifiedOn { get; set; }
#endregion
}
}

View File

@ -34,6 +34,8 @@ namespace Oqtane.Models
public List<ThemeControl> Containers { get; set; }
public string Template { get; set; }
#region Obsolete Properties
[Obsolete("This property is obsolete. Use Themes instead.", false)]
public string ThemeControls { get; set; }
[Obsolete("This property is obsolete. Use Layouts instead.", false)]
@ -42,5 +44,8 @@ namespace Oqtane.Models
public string ContainerControls { get; set; }
[Obsolete("This property is obsolete.", false)]
public List<ThemeControl> Layouts { get; set; }
#endregion
}
}

View File

@ -1,33 +1,91 @@
using System;
using System;
using System.ComponentModel.DataAnnotations.Schema;
namespace Oqtane.Models
{
/// <summary>
/// Describes a User in Oqtane.
/// </summary>
public class User : IAuditable, IDeletable
{
/// <summary>
/// ID of this User.
/// </summary>
public int UserId { get; set; }
/// <summary>
/// Username used for login.
/// </summary>
public string Username { get; set; }
/// <summary>
/// Name shown in menus / dialogs etc.
/// </summary>
public string DisplayName { get; set; }
/// <summary>
/// User E-Mail address.
/// </summary>
public string Email { get; set; }
/// <summary>
/// Reference to a <see cref="File"/> containing the users photo.
/// </summary>
public int? PhotoFileId { get; set; }
/// <summary>
/// Timestamp of last login.
/// </summary>
public DateTime? LastLoginOn { get; set; }
/// <summary>
/// Tracking information of IP used when the user last worked on this site.
/// </summary>
public string LastIPAddress { get; set; }
/// <summary>
/// Reference to the <see cref="Site"/> this user belongs to.
/// </summary>
[NotMapped]
public int SiteId { get; set; }
/// <summary>
/// Role names this user has.
/// TODO: todoc - is this comma separated?
/// </summary>
[NotMapped]
public string Roles { get; set; }
#region IAuditable Properties
/// <inheritdoc/>
public string CreatedBy { get; set; }
/// <inheritdoc/>
public DateTime CreatedOn { get; set; }
/// <inheritdoc/>
public string ModifiedBy { get; set; }
/// <inheritdoc/>
public DateTime ModifiedOn { get; set; }
#endregion
#region Extended IAuditable Properties, may be moved to an Interface some day so not documented yet
public string DeletedBy { get; set; }
public DateTime? DeletedOn { get; set; }
public bool IsDeleted { get; set; }
#endregion
/// <summary>
/// The users password. Note that this is not plaintext, so you can probably never really work with this.
/// </summary>
[NotMapped]
public string Password { get; set; }
/// <summary>
/// Information if this user is authenticated. Anonymous users are not authenticated.
/// </summary>
[NotMapped]
public bool IsAuthenticated { get; set; }
}

View File

@ -1,22 +1,59 @@
using System;
using System;
namespace Oqtane.Models
{
/// <summary>
/// Assigns a <see cref="Role"/> to a <see cref="User"/>
/// </summary>
public class UserRole : IAuditable
{
/// <summary>
/// Id of this assignment
/// </summary>
public int UserRoleId { get; set; }
/// <summary>
/// Reference to the <see cref="User"/> who receives this <see cref="Role"/> assignment.
/// </summary>
public int UserId { get; set; }
/// <summary>
/// Reference to the <see cref="Role"/> which the <see cref="User"/> receives
/// </summary>
public int RoleId { get; set; }
/// <summary>
/// Start of when this assignment is valid. See also <see cref="ExpiryDate"/>
/// </summary>
public DateTime? EffectiveDate { get; set; }
/// <summary>
/// End of when this assignment is valid. See also <see cref="EffectiveDate"/>
/// </summary>
public DateTime? ExpiryDate { get; set; }
#region IAuditable Properties
/// <inheritdoc/>
public string CreatedBy { get; set; }
/// <inheritdoc/>
public DateTime CreatedOn { get; set; }
/// <inheritdoc/>
public string ModifiedBy { get; set; }
/// <inheritdoc/>
public DateTime ModifiedOn { get; set; }
#endregion
/// <summary>
/// Direct reference to the <see cref="Role"/> object.
/// TODO: todoc - is this always populated?
/// </summary>
public Role Role { get; set; }
/// <summary>
/// Direct reference to the <see cref="User"/> object.
/// TODO: todoc - is this always populated?
/// </summary>
public User User { get; set; }
}
}